CMD:cshop(playerid, params[]) { ShowPlayerDialog(playerid, DIALOG_CSHOP, DIALOG_STYLE_LIST,"Credits Shop","Refill Health "orange"[2 Credits]\n"white"Refill Armour "orange"[5 Credits]","Choose","Cancel"); return 1; }
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch(dialogid) { case DIALOG_CSHOP: { if(response) { switch(listitem) { case 0: { if(Data[playerid][pCredits] < 2) return SendClientMessage(playerid, -1, "["blue"SERVER"white"] You don't have enought credits"); SetPlayerHealth(playerid, 100); Data[playerid][pCredits] -= 2; SendClientMessage(playerid, -1, "["blue"SERVER"white"] You have successfully refilled your Health"); } case 1: { if(Data[playerid][pCredits] < 5) return SendClientMessage(playerid, -1, "["blue"SERVER"white"] You don't have enought credits"); SetPlayerArmour(playerid, 100); Data[playerid][pCredits] -= 5; SendClientMessage(playerid, -1, "["blue"SERVER"white"] You have successfully refilled your Armour"); } } } } } return 1; }
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
printf("dialogid: %i",dialogid);
case DIALOG_CSHOP:
{
printf("DIALOG_CSHOP: %i | response: %i",DIALOG_CSHOP,response);
if(response)
{
printf("listitem: %i",listitem);
switch(listitem)
{
case 0:
{
print("listitem 0");
if(Data[playerid][pCredits] < 2) return SendClientMessage(playerid, -1, "["blue"SERVER"white"] You don't have enought credits");
SetPlayerHealth(playerid, 100);
Data[playerid][pCredits] -= 2;
SendClientMessage(playerid, -1, "["blue"SERVER"white"] You have successfully refilled your Health");
}
case 1:
{
print("listitem 1");
if(Data[playerid][pCredits] < 5) return SendClientMessage(playerid, -1, "["blue"SERVER"white"] You don't have enought credits");
SetPlayerArmour(playerid, 100);
Data[playerid][pCredits] -= 5;
SendClientMessage(playerid, -1, "["blue"SERVER"white"] You have successfully refilled your Armour");
}
}
}
}
}
return 1;
}
Hello!
![]() What is printing in the console (server.log) if you choose a listitem of the dialog? PHP код:
|
error 002: only a single statement (or expression) can follow each "case" warning 215: expression has no effect error 014: invalid statement; not in switch warning 215: expression has no effect error 001: expected token: ";", but found ":" error 029: invalid expression, assumed zero fatal error 107: too many error messages on one line
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_CSHOP:
{
printf("dialogid: %i",dialogid);
printf("DIALOG_CSHOP: %i | response: %i",DIALOG_CSHOP,response);
if(response)
{
printf("listitem: %i",listitem);
switch(listitem)
{
case 0:
{
print("listitem 0");
if(Data[playerid][pCredits] < 2) return SendClientMessage(playerid, -1, "["blue"SERVER"white"] You don't have enought credits");
SetPlayerHealth(playerid, 100);
Data[playerid][pCredits] -= 2;
SendClientMessage(playerid, -1, "["blue"SERVER"white"] You have successfully refilled your Health");
}
case 1:
{
print("listitem 1");
if(Data[playerid][pCredits] < 5) return SendClientMessage(playerid, -1, "["blue"SERVER"white"] You don't have enought credits");
SetPlayerArmour(playerid, 100);
Data[playerid][pCredits] -= 5;
SendClientMessage(playerid, -1, "["blue"SERVER"white"] You have successfully refilled your Armour");
}
}
}
}
}
return 1;
}
Oh, sorry.
PHP код:
|
[11:20:55] Number of vehicle models: 0 [11:21:23] [connection] --- requests connection cookie. [11:21:24] Incoming connection: --- id: 0 [11:21:24] [join] blackNred has joined the server (---)
#define DIALOG_CSHOP 14587 // Random Number