Jump to content
  • 0

Question

Posted

Problemă întâlnită (descriere): Am luat un script de Texas Hold'em Poker , si am o problema in joc. Cand dau in joc pe prima optiune a dialogului permis doar adminilor rCON , imi apare in consola o eroare.

 

 

[18:50:04] [debug] Run time error 3: "Stack/heap collision (insufficient stack size)"

[18:50:04] [debug]  Stack pointer (STK) is 0x30C1C, heap pointer (HEA) is 0x30CB4
[18:50:04] [debug] AMX backtrace:
[18:50:04] [debug] #0 00031db4 in public OnDialogResponse (0x00000000, 0x00007d64, 0x00000001, 0x00000000, 0x00030c54) from poker.amx

Ero(area / rile) / warning-(ul / urile): Nici-o eroare la compilare
Liniile de cod / sursa / script-ul:[pawn]public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_CGAMESADMINMENU)
{
if(response) {
switch(listitem)
{
case 0:
{
ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSELECTPOKER);
}
case 2:
{
ShowCasinoGamesMenu(playerid, DIALOG_CGAMESCREDITS);
}
}
}
}
if(dialogid == DIALOG_CGAMESSELECTPOKER)
{
if(response) {
SetPVarInt(playerid, "tmpEditPokerTableID", listitem+1);
ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPOKER);
} else {
ShowCasinoGamesMenu(playerid, DIALOG_CGAMESADMINMENU);
}
}
if(dialogid == DIALOG_CGAMESSETUPPOKER)
{
if(response) {
new tableid = GetPVarInt(playerid, "tmpEditPokerTableID")-1;

if(PokerTable[tableid][pkrPlaced] == 0) {
switch(listitem)
{
case 0: // Place Poker Table
{
new szString[128];
format(szString, sizeof(szString), "Press '{3399FF}~k~~PED_SPRINT~{FFFFFF}' to place poker table.");
SendClientMessage(playerid, COLOR_WHITE, szString);

SetPVarInt(playerid, "tmpPlacePokerTable", 1);
}
}
} else {
switch(listitem)
{
case 0: // Edit Poker Table
{
SetPVarFloat(playerid, "tmpPkrX", PokerTable[tableid][pkrX]);
SetPVarFloat(playerid, "tmpPkrY", PokerTable[tableid][pkrY]);
SetPVarFloat(playerid, "tmpPkrZ", PokerTable[tableid][pkrZ]);
SetPVarFloat(playerid, "tmpPkrRX", PokerTable[tableid][pkrRX]);
SetPVarFloat(playerid, "tmpPkrRY", PokerTable[tableid][pkrRY]);
SetPVarFloat(playerid, "tmpPkrRZ", PokerTable[tableid][pkrRZ]);

EditObject(playerid, PokerTable[tableid][pkrObjectID]);

new szString[128];
format(szString, sizeof(szString), "You have selected Poker Table %d, You may now customize it's position/rotation.", tableid);
SendClientMessage(playerid, COLOR_WHITE, szString);
}
case 1: // Destroy Poker Table
{
DestroyPokerTable(tableid);

new szString[64];
format(szString, sizeof(szString), "You have deleted Poker Table %d.", tableid);
SendClientMessage(playerid, COLOR_WHITE, szString);

ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSELECTPOKER);
}
}
}
} else {
ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSELECTPOKER);
}
}
if(dialogid == DIALOG_CGAMESCREDITS)
{
ShowCasinoGamesMenu(playerid, DIALOG_CGAMESADMINMENU);
}
if(dialogid == DIALOG_CGAMESSETUPPGAME)
{
if(response) {
switch(listitem)
{
case 0: // Buy-In Max
{
ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME2);
}
case 1: // Buy-In Min
{
ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME3);
}
case 2: // Blind
{
ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME4);
}
case 3: // Limit
{
ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME5);
}
case 4: // Password
{
ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME6);
}
case 5: // Round Delay
{
ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME7);
}
case 6: // Start Game
{
ShowCasinoGamesMenu(playerid, DIALOG_CGAMESBUYINPOKER);
}
}
} else {
LeavePokerTable(playerid);
}
}
if(dialogid == DIALOG_CGAMESSETUPPGAME2)
{
if(response) {
if(strval(inputtext) < 1 || strval(inputtext) > 1000000000) {
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME2);
}

if(strval(inputtext) <= PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrBuyInMin]) {
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME2);
}

PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrBuyInMax] = strval(inputtext);
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
} else {
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
}
}
if(dialogid == DIALOG_CGAMESSETUPPGAME3)
{
if(response) {
if(strval(inputtext) < 1 || strval(inputtext) > 1000000000) {
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME3);
}

if(strval(inputtext) >= PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrBuyInMax]) {
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME3);
}

PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrBuyInMin] = strval(inputtext);
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
} else {
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
}
}
if(dialogid == DIALOG_CGAMESSETUPPGAME4)
{
if(response) {
if(strval(inputtext) < 1 || strval(inputtext) > 1000000000) {
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME4);
}

PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrBlind] = strval(inputtext);
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
} else {
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
}
}
if(dialogid == DIALOG_CGAMESSETUPPGAME5)
{
if(response) {
if(strval(inputtext) < 2 || strval(inputtext) > 6) {
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME5);
}

PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrLimit] = strval(inputtext);
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
} else {
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
}
}
if(dialogid == DIALOG_CGAMESSETUPPGAME6)
{
if(response) {
new tableid = GetPVarInt(playerid, "pkrTableID")-1;
strmid(PokerTable[tableid][pkrPass], inputtext, 0, strlen(inputtext), 32);
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
} else {
ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
}
}
if(dialogid == DIALOG_CGAMESSETUPPGAME7)
{
if(response) {
if(strval(inputtext) < 15 || strval(inputtext) > 120) {
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME7);
}

PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrSetDelay] = strval(inputtext);
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
} else {
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSETUPPGAME);
}
}
if(dialogid == DIALOG_CGAMESBUYINPOKER)
{
if(response) {
if(strval(inputtext) < PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrBuyInMin] || strval(inputtext) > PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrBuyInMax] || strval(inputtext) > GetPVarInt(playerid, "cgChips")) {
return ShowCasinoGamesMenu(playerid, DIALOG_CGAMESBUYINPOKER);
}

PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrActivePlayers]++;
SetPVarInt(playerid, "pkrChips", GetPVarInt(playerid, "pkrChips")+strval(inputtext));
SetPVarInt(playerid, "cgChips", GetPVarInt(playerid, "cgChips")-strval(inputtext));


if(PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrActive] == 3 && PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrRound] == 0 && PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrDelay] >= 6) {
SetPVarInt(playerid, "pkrStatus", 1);
}
else if(PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrActive] < 3) {
SetPVarInt(playerid, "pkrStatus", 1);
}

if(PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrActive] == 1 && GetPVarInt(playerid, "pkrRoomLeader")) {
PokerTable[GetPVarInt(playerid, "pkrTableID")-1][pkrActive] = 2;
SelectTextDraw(playerid, COLOR_GOLD);
}
} else {
return LeavePokerTable(playerid);
}
}
if(dialogid == DIALOG_CGAMESCALLPOKER)
{
if(response) {
new tableid = GetPVarInt(playerid, "pkrTableID")-1;

new actualBet = PokerTable[tableid][pkrActiveBet]-GetPVarInt(playerid, "pkrCurrentBet");

if(actualBet > GetPVarInt(playerid, "pkrChips")) {
PokerTable[tableid][pkrPot] += GetPVarInt(playerid, "pkrChips");
SetPVarInt(playerid, "pkrChips", 0);
SetPVarInt(playerid, "pkrCurrentBet", PokerTable[tableid][pkrActiveBet]);
} else {
PokerTable[tableid][pkrPot] += actualBet;
SetPVarInt(playerid, "pkrChips", GetPVarInt(playerid, "pkrChips")-actualBet);
SetPVarInt(playerid, "pkrCurrentBet", PokerTable[tableid][pkrActiveBet]);
}

SetPVarString(playerid, "pkrStatusString", "Call");
PokerRotateActivePlayer(tableid);

ApplyAnimation(playerid, "CASINO", "cards_raise", 4.1, 0, 1, 1, 1, 1, 1);
}

DeletePVar(playerid, "pkrActionChoice");
}
if(dialogid == DIALOG_CGAMESRAISEPOKER)
{
if(response) {
new tableid = GetPVarInt(playerid, "pkrTableID")-1;

new actualRaise = strval(inputtext)-GetPVarInt(playerid, "pkrCurrentBet");

if(strval(inputtext) >= PokerTable[tableid][pkrActiveBet]+PokerTable[tableid][pkrBlind]/2 && strval(inputtext) <= GetPVarInt(playerid, "pkrCurrentBet")+GetPVarInt(playerid, "pkrChips")) {
PokerTable[tableid][pkrPot] += actualRaise;
PokerTable[tableid][pkrActiveBet] = strval(inputtext);
SetPVarInt(playerid, "pkrChips", GetPVarInt(playerid, "pkrChips")-actualRaise);
SetPVarInt(playerid, "pkrCurrentBet", PokerTable[tableid][pkrActiveBet]);

SetPVarString(playerid, "pkrStatusString", "Raise");

PokerTable[tableid][pkrRotations] = 0;
PokerRotateActivePlayer(tableid);

ApplyAnimation(playerid, "CASINO", "cards_raise", 4.1, 0, 1, 1, 1, 1, 1);
} else {
ShowCasinoGamesMenu(playerid, DIALOG_CGAMESRAISEPOKER);
}
}

DeletePVar(playerid, "pkrActionChoice");
}
return 0;
}[/pawn]
Imagini / Video (optional): -
Aţi încercat să rezolvaţi singur?: Da.

4 answers to this question

Recommended Posts

  • Administrator
Posted

Folosesti prea multe resurse, optimizeaza codul. Redu marimea variabilelor locale.

Posted

ar trebui sa fac mai mica chestia aia , nu ?

Trebuie gandita treaba, nu modifici aia pur si simplu.. Trebuie sa ai in vedere mai multe lucruri, marimea fiecarui replacement, etc

Nevermind , am facut-o singur. Multumesc , WopSS.

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.