HELP!?!?! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: HELP!?!?! (
/showthread.php?tid=191951)
HELP!?!?! -
BigAl - 21.11.2010
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, COLOR_RED, "You cancelled!");
return 1;
}
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) > 5000) return SendClientMessage(playerid, COLOR_RED, "You cannot afford an UZI yet, you need $5,000");
GivePlayerWeapon(playerid, 28, 50);
SendClientMessage(playerid, COLOR_PINK, "You have just baught a mini uzi with 50 ammunition for $5000!");
GivePlayerMoney(playerid, -5000);
}
case 1:
{
if(GetPlayerMoney(playerid) > 7000) return SendClientMessage(playerid, COLOR_RED, "You cannot afford an AK47 yet, You need $7,000");
GivePlayerWeapon(playerid, 30, 50);
SendClientMessage(playerid, COLOR_PINK, "You have just baught an AK47 with 50 ammunition!");
GivePlayerMoney(playerid, -7000);
}
case 2:
{
if(GetPlayerMoney(playerid) > 10000) return SendClientMessage(playerid, COLOR_RED, "You cannot afford an M4, it costs $10,000");
GivePlayerWeapon(playerid, 31, 50);
SendClientMessage(playerid, COLOR_PINK, "You have just baught an M4 carbine with 50 ammunition!");
GivePlayerMoney(playerid, -10000);
}
}
}
}
return 1;
}
How could i add another dialog response to that, for a second dialog.
For example, I have /buy which that ^^ is the script to Respond to that!
but i also want on the onplayerrequestclass another dialog (Listitem) to choose where to spawn. Can anyone tell me how i could have a response added to that ^^ for the OnPlayerRequestClass please?
Re: HELP!?!?! -
iggy1 - 21.11.2010
When your using switches use case 0: read some tutorials on the wiki and tutorial boards.
Re: HELP!?!?! -
Grim_ - 21.11.2010
In other words, dialog IDs start at 0.
And next time, please use the [ pawn ][ /pawn ] tags (without the spaces) to display code.
Re: HELP!?!?! -
iggy1 - 21.11.2010
I'll try my best to fix your code, and edit this post but definatly listen to grim use [pawn] tags.
Re: HELP!?!?! -
BigAl - 21.11.2010
ok thanks, i still dont know how to make it, please can u give me an example?
Re: HELP!?!?! -
Grim_ - 21.11.2010
This is where your error occurs:
pawn Код:
switch(dialogid)
{
case 1:
You check if the dialog ID is equal to 1, not 0. Change the 1 to 0 and your problem will be fixed.
Re: HELP!?!?! -
iggy1 - 21.11.2010
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 0://this could be any dialog you sure you want it id 0?
{
if(response)//player clicked ok or double clicked a selection
{
switch(listitem)//switch the listitems
{
case 0:// 0 is the first item in the list
{
if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, COLOR_RED, "You cannot afford an UZI yet, you need $5,000");
GivePlayerWeapon(playerid, 28, 50);
SendClientMessage(playerid, COLOR_PINK, "You have just baught a mini uzi with 50 ammunition for $5000!");
GivePlayerMoney(playerid, -5000);
}
case 1:
{
if(GetPlayerMoney(playerid) > 7000) return SendClientMessage(playerid, COLOR_RED, "You cannot afford an AK47 yet, You need $7,000");
GivePlayerWeapon(playerid, 30, 50);
SendClientMessage(playerid, COLOR_PINK, "You have just baught an AK47 with 50 ammunition!");
GivePlayerMoney(playerid, -7000);
}
case 2:
{
if(GetPlayerMoney(playerid) > 10000) return SendClientMessage(playerid, COLOR_RED, "You cannot afford an M4, it costs $10,000");
GivePlayerWeapon(playerid, 31, 50);
SendClientMessage(playerid, COLOR_PINK, "You have just baught an M4 carbine with 50 ammunition!");
GivePlayerMoney(playerid, -10000);
}
}
else SendClientMessage(playerid, 0x00ff0000FF, "Cancelled");
}
case NEXT_DIALOGID:
{
}
}
return 1;
}