22.07.2012, 12:47
Hello!
In don't know what is the problem what this dialog and the compiler is not giving any errors but when I go ig the dilog opens but does not work like it does not reduces the money and it does not give the thing we clicked to buy! My friend was also having the same problem! Here are the code
In don't know what is the problem what this dialog and the compiler is not giving any errors but when I go ig the dilog opens but does not work like it does not reduces the money and it does not give the thing we clicked to buy! My friend was also having the same problem! Here are the code
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/buyaccessories", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid,3300,DIALOG_STYLE_LIST,"What is that you want","Motorcycle Helmet green($50)\nMotorcycle Helmet black($50)\nMotorcycle Helmet blue($50)\nMotorcycle Helmet purple($50)\nTopHat green($50)\nTopHat black($50)\nTopHat purple($50)\nTopHat yellow($50)","Purchase","Cancel");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)// They pressed the first button.
{
switch(dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
{
case 3300:// Our dialog!
{
switch(listitem)// Checking which listitem was selected
{
case 0:// The first item listed
{
if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -50);
SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0xFF00FF00);
}
case 1: // The second item listed
{
if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -50);
SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0x000000);
}
case 2: // The third item listed
{
if(GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -3);
SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0x0039F5);
}
case 3: // The forth item listed
{
if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -50);
SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0xF500ED);
}
case 4: // The forth item listed
{
if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -50);SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0xF500ED);
SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0xFF00FF00);
}
case 5: // The forth item listed
{
if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -50);
SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0x000000);
}
case 6: // The forth item listed
{
if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -50);
SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0xE105FA);
}
case 7: // The forth item listed
{
if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -50);
SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0xFAFA05);
}
}
}
}
}
return 1;
}