22.12.2013, 15:06
https://sampwiki.blast.hk/wiki/ShowPlayerDialog Showing dialog , search for styles if you want.
https://sampwiki.blast.hk/wiki/OnDialogResponse
https://sampwiki.blast.hk/wiki/GetPlayerMoney Checking the player money.
https://sampwiki.blast.hk/wiki/GivePlayerWeapon Giving weapon.
Example :
EDIT:If you want to make this command only can be used on some places , you need to use https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
https://sampwiki.blast.hk/wiki/OnDialogResponse
https://sampwiki.blast.hk/wiki/GetPlayerMoney Checking the player money.
https://sampwiki.blast.hk/wiki/GivePlayerWeapon Giving weapon.
Example :
pawn Код:
#define DIALOG_WEAPONS 33 //at the top to ignore undifened error.
CMD:buygun(playerid , params[])
{
ShowPlayerDialog(playerid,DIALOG_WEAPONS,DIALOG_STYLE_LIST,"Weapon shop","Ak-47\nM4","ok","cancel");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])//on dialog responding
{
if(dialogid == DIALOG_WEAPONS)//checking if the dialog is the weapons one
{
if(response) //if responding 'pressed ok'
{
//if he choosed list item 0 means ak-47.
if(listitem == 0)
{
if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid,-1,"You don't have enoght money to afford this weapon.'$3000'");//checking the player money.
GivePlayerWeapon(playerid, 30); //giving him the weapon
}
if(listitem == 1) // if the player select list item 2 'm4'
{
if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid,-1,"You don't have enoght money to afford this weapon.'$3000'");//checking the player money.
GivePlayerWeapon(playerid, 31); // Give them a m4
}
}
return 1;
}
return 0;
}