Dialog script issue. -
Sleek - 29.04.2012
Ok so i had this script working perfectly already edited it, changed it back to how it was, and now
i guess it doesnt work for some reason.
heres the code
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, 0xFF0000FF, "Use Again");
return 1; // We processed it
}
switch(listitem) // This is far more efficient than using an if-elseif-else structure
{
case 0:
{
if (GetPlayerMoney(playerid) >= 50)
{
GivePlayerWeapon(playerid,22,50);
GivePlayerMoney(playerid,-50);
GameTextForPlayer(playerid,"~r~-$50",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 1:
{
if (GetPlayerMoney(playerid) >= 3000)
{
GivePlayerWeapon(playerid,24,50);
GivePlayerMoney(playerid,-3000);
GameTextForPlayer(playerid,"~r~-$3000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 2:
{
if (GetPlayerMoney(playerid) >= 750)
{
GivePlayerWeapon(playerid,25,50);
GivePlayerMoney(playerid,-750);
GameTextForPlayer(playerid,"~r~-$750",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 3:
{
if (GetPlayerMoney(playerid) >= 3500)
{
GivePlayerWeapon(playerid,26,50);
GivePlayerMoney(playerid,-3500);
GameTextForPlayer(playerid,"~r~-$3500",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 4:
{
if (GetPlayerMoney(playerid) >= 10000)
{
GivePlayerWeapon(playerid,27,100);
GivePlayerMoney(playerid,-10000);
GameTextForPlayer(playerid,"~r~-$10000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 5:
{
if (GetPlayerMoney(playerid) >= 2000)
{
GivePlayerWeapon(playerid,29,150);
GivePlayerMoney(playerid,-2000);
GameTextForPlayer(playerid,"~r~-$2000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 6:
{
if (GetPlayerMoney(playerid) >= 5000)
{
GivePlayerWeapon(playerid,16,5);
GivePlayerMoney(playerid,-5000);
GameTextForPlayer(playerid,"~r~-$5000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 7:
{
if (GetPlayerMoney(playerid) >= 15000)
{
GivePlayerWeapon(playerid,30,300);
GivePlayerMoney(playerid,-15000);
GameTextForPlayer(playerid,"~r~-$15000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 8:
{
if (GetPlayerMoney(playerid) >= 25000)
{
GivePlayerWeapon(playerid,31,300);
GivePlayerMoney(playerid,-25000);
GameTextForPlayer(playerid,"~r~-$25000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
}
}
}
And then i get
Код:
C:\Users\Sleek\Desktop\GTASanAndreas\gamemodes\hmbg.pwn(1171) : warning 217: loose indentation
C:\Users\Sleek\Desktop\GTASanAndreas\gamemodes\hmbg.pwn(1171) : error 029: invalid expression, assumed zero
C:\Users\Sleek\Desktop\GTASanAndreas\gamemodes\hmbg.pwn(1171) : error 004: function "OnPlayerClickPlayer" is not implemented
C:\Users\Sleek\Desktop\GTASanAndreas\gamemodes\hmbg.pwn(1178) : error 030: compound statement not closed at the end of file (started at line 1027)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
3 Errors.
Re: Dialog script issue. -
warcodes_ - 29.04.2012
I think you missed a bracket along with not returning the callback, try this:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, 0xFF0000FF, "Use Again");
return 1; // We processed it
}
switch(listitem) // This is far more efficient than using an if-elseif-else structure
{
case 0:
{
if (GetPlayerMoney(playerid) >= 50)
{
GivePlayerWeapon(playerid,22,50);
GivePlayerMoney(playerid,-50);
GameTextForPlayer(playerid,"~r~-$50",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 1:
{
if (GetPlayerMoney(playerid) >= 3000)
{
GivePlayerWeapon(playerid,24,50);
GivePlayerMoney(playerid,-3000);
GameTextForPlayer(playerid,"~r~-$3000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 2:
{
if (GetPlayerMoney(playerid) >= 750)
{
GivePlayerWeapon(playerid,25,50);
GivePlayerMoney(playerid,-750);
GameTextForPlayer(playerid,"~r~-$750",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 3:
{
if (GetPlayerMoney(playerid) >= 3500)
{
GivePlayerWeapon(playerid,26,50);
GivePlayerMoney(playerid,-3500);
GameTextForPlayer(playerid,"~r~-$3500",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 4:
{
if (GetPlayerMoney(playerid) >= 10000)
{
GivePlayerWeapon(playerid,27,100);
GivePlayerMoney(playerid,-10000);
GameTextForPlayer(playerid,"~r~-$10000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 5:
{
if (GetPlayerMoney(playerid) >= 2000)
{
GivePlayerWeapon(playerid,29,150);
GivePlayerMoney(playerid,-2000);
GameTextForPlayer(playerid,"~r~-$2000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 6:
{
if (GetPlayerMoney(playerid) >= 5000)
{
GivePlayerWeapon(playerid,16,5);
GivePlayerMoney(playerid,-5000);
GameTextForPlayer(playerid,"~r~-$5000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 7:
{
if (GetPlayerMoney(playerid) >= 15000)
{
GivePlayerWeapon(playerid,30,300);
GivePlayerMoney(playerid,-15000);
GameTextForPlayer(playerid,"~r~-$15000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 8:
{
if (GetPlayerMoney(playerid) >= 25000)
{
GivePlayerWeapon(playerid,31,300);
GivePlayerMoney(playerid,-25000);
GameTextForPlayer(playerid,"~r~-$25000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
}
}
}
return 0;
}
Re: Dialog script issue. -
$$inSane - 29.04.2012
u didn't put return 1; at last
Re: Dialog script issue. -
warcodes_ - 29.04.2012
Quote:
Originally Posted by $$inSane
u didn't put return 1; at last
|
Returning 1 prevents the callback being called in other scripts. You should return 0; for OnDialogResponse.
Re: Dialog script issue. -
$$inSane - 29.04.2012
use this:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, 0xFF0000FF, "Use Again");
return 1; // We processed it
}
switch(listitem) // This is far more efficient than using an if-elseif-else structure
{
case 0:
{
if (GetPlayerMoney(playerid) >= 50)
{
GivePlayerWeapon(playerid,22,50);
GivePlayerMoney(playerid,-50);
GameTextForPlayer(playerid,"~r~-$50",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 1:
{
if (GetPlayerMoney(playerid) >= 3000)
{
GivePlayerWeapon(playerid,24,50);
GivePlayerMoney(playerid,-3000);
GameTextForPlayer(playerid,"~r~-$3000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 2:
{
if (GetPlayerMoney(playerid) >= 750)
{
GivePlayerWeapon(playerid,25,50);
GivePlayerMoney(playerid,-750);
GameTextForPlayer(playerid,"~r~-$750",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 3:
{
if (GetPlayerMoney(playerid) >= 3500)
{
GivePlayerWeapon(playerid,26,50);
GivePlayerMoney(playerid,-3500);
GameTextForPlayer(playerid,"~r~-$3500",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 4:
{
if (GetPlayerMoney(playerid) >= 10000)
{
GivePlayerWeapon(playerid,27,100);
GivePlayerMoney(playerid,-10000);
GameTextForPlayer(playerid,"~r~-$10000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 5:
{
if (GetPlayerMoney(playerid) >= 2000)
{
GivePlayerWeapon(playerid,29,150);
GivePlayerMoney(playerid,-2000);
GameTextForPlayer(playerid,"~r~-$2000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 6:
{
if (GetPlayerMoney(playerid) >= 5000)
{
GivePlayerWeapon(playerid,16,5);
GivePlayerMoney(playerid,-5000);
GameTextForPlayer(playerid,"~r~-$5000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 7:
{
if (GetPlayerMoney(playerid) >= 15000)
{
GivePlayerWeapon(playerid,30,300);
GivePlayerMoney(playerid,-15000);
GameTextForPlayer(playerid,"~r~-$15000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
case 8:
{
if (GetPlayerMoney(playerid) >= 25000)
{
GivePlayerWeapon(playerid,31,300);
GivePlayerMoney(playerid,-25000);
GameTextForPlayer(playerid,"~r~-$25000",3000,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
}
else
{
SendClientMessage(playerid,red,"You do not have the cash.");
}
}
}
}
}
return 0;
}