01.05.2012, 18:26
Look at this code, please
pawn Код:
public OnDialogResponse ( playerid, dialogid, response, listitem, inputtext [] )
{
switch ( dialogid )
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, 0xFF0000FF, "Sa ei ostnud midagi.");
return 1; // ...
}
switch(listitem)
{
case 0: // Items
{
if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-10);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Tere piima, mis maksis 10 LSUD'd. ");
}
case 1:
{
if(GetPlayerMoney(playerid) < 5) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-5);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Sддstu makarone, mis maksis 5 LSUD'd. ");
}
case 2:
{
if(GetPlayerMoney(playerid) < 25) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-25);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 kьlmutatud Maamehe pizza, mis maksis 25 LSUD'd. ");
}
case 3:
{
if(GetPlayerMoney(playerid) < 33) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-33);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Vinku viinereid, mis maksis 33 LSUD'd. ");
}
case 4:
{
if(GetPlayerMoney(playerid) < 22) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-22);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 kilo Los Santose хuna, mis maksis 22 LSUD'd. ");
}
case 5:
{
if(GetPlayerMoney(playerid) < 6) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-6);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 kilo Maamehe kartulit, mis maksis 6 LSUD'd. ");
}
case 6:
{
if(GetPlayerMoney(playerid) < 21) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-21);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki komme nimega Pilveke, mis maksis 21 LSUD'd. ");
}
case 7:
{
if(GetPlayerMoney(playerid) < 12) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-12);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 Lays krхpse, mis maksis 12 LSUD'd. ");
SendClientMessage(playerid,0xAA3333AA, " Krхpsud on vдga kahjulikud sinu tervisele! ");
}
case 8:
{
if(GetPlayerMoney(playerid) < 42) return SendClientMessage(playerid, 0xAFAFAFAA, "Sul pole piisavalt raha taskus ning kahjuks kaardiga tasuda ei saa!");
GivePlayerMoney(playerid,-42);
SendClientMessage(playerid,0xAFAFAFAA, " Sa ostsid endale 1 paki Maamehe kotlete, mis maksis 42 LSUD'd. ");
}
// Add the rest of your listitems for dialog 1 here
}
}
// ADD HERE THE NEW DIALOG
/*case 2:
case 3:
etc...*/
}
return 0; // If you put return 1 here the callback will not continue to be called in other scripts (filterscripts, etc.).
}