07.04.2017, 21:01
I think you want something like that:
PHP код:
public OnPlayerText(playerid, text[])
{
if(FirstWeaponText[playerid] == 1)
{
if(!isNumeric(text))
{
SendClientMessage(playerid,-1, "[Enter only digits]");// amount he wants.
return 0;
}
if(strval(text) < 1 || strval(text) > 10000)
{
SendClientMessage(playerid,-1,"You can only buy from 1 - 10000 bullets");// check if player has writen more than required
return 0;
}
GivePlayerMoney(playerid,-strval(text)*100); // this makes 1 bullet for 100$
GivePlayerWeapon(playerid, WEAPON_M4, strval(text));
FirstWeaponText[playerid] = 0;
return 0;
}
else
{
if(!strcmp(text, "1"))
{
FirstWeaponText[playerid] = 1;
SendClientMessage(playerid, -1, "Enter the amount of ammo:");
return 0;
}
}
return 1;
}