15.08.2012, 12:46
Hello,
I made a command that uses dialog but when I enter a certain amount nothing happens and the dialog closes.
here are the codes:
I made a command that uses dialog but when I enter a certain amount nothing happens and the dialog closes.
here are the codes:
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/charity", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid,100,DIALOG_STYLE_INPUT, "Charity", "How much would you like to charity", "Charity", "Close");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case 100:
{
new string[256];
if(response)
{
new type = strval(inputtext);
if(type == 0)
if(GetPlayerMoney(playerid)< type)
{
GivePlayerMoney(playerid,-type);
format(string, sizeof(string), "INFO: You have successfully charitied $%d", type);
SendClientMessage(playerid, 0xFFFFFF, string);
}
else SendClientMessage(playerid, 0xFFFFFF, "SERVER: You do not have that much amount in your hand");
}
}
}
return 1;
}