My mistake?
#1

hello , when i complile this i don't get any msg.. but when i run and type /w , it shows Unknown Command

Quote:

CMD:w(playerid,params[])
{
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "Desert Eagle ", "Select", "Close");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_WEAPONS)
{
if(response) // If they clicked 'Select' or double-clicked a weapon
{
// Give them the weapon
switch(listitem)
{
case 0: GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14); // Give them a desert eagle
GivePlayerMoney(playerid , -5);

}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}

return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
My mistake is? I have used the Indenstation don't worry it's just not comming here..
Reply
#2

You can't do this like that OP.
pawn Код:
switch(listitem)
    {
case 0: GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14); // Give them a desert eagle
GivePlayerMoney(playerid , -5);

    }
So, use comma to chain statements, or use block style:
pawn Код:
if(response)
{
    switch(listitem)
    {
        case 0: {
            GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14);
            GivePlayerMoney(playerid , -5);
        }
    }
}
Though weird, it shouldn't show any errors inside command as it is different dialog altogether
Reply
#3

Dude Like i asked you .. thanks for the Help .. But i get 1 error again .. If player is not having Enough money he still gets the Gun .. can you say me some thing that can avoid this?
Reply
#4

pawn Код:
if (GetPlayerMoney(playerid) < 5) return SendClientMessage(playerid, 0xBADA55FF, "Sorry, you can't afford that gun");
GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14);
GivePlayerMoney(playerid , -5);
Reply
#5

Thanks , it's working
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)