17.03.2017, 02:46
Hello need a dialog but I do not know how to make command / fuel
display DIALOG_STYLE_LIST and when typing the liters in DIALOG_STYLE_INPUT
display DIALOG_STYLE_LIST and when typing the liters in DIALOG_STYLE_INPUT
PHP код:
if(strcmp(cmd, "/fuel", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COR_ERRO, "Valid use: /fuel Gasoline [Liters]");
return 1;
}
new amount;
amount = strval(tmp);
if(amount > 100 || amount < 1) return SendClientMessage(playerid, COR_ERRO, "Invalid quantity!");
if(pInfo[playerid][GasG] >= 100) return SendClientMessage(playerid, COR_ERRO, "Your tank is already full!");
if(GetPlayerCash(playerid) < amount*5) return SendClientMessage(playerid, COR_ERRO, "You do not have the amount you need!");
if(pInfo[playerid][GasG]+amount <= 100)
{
new preco = amount*5;
TogglePlayerControllable(playerid, true);
new AgoraV = pInfo[playerid][GasG] + amount;
pInfo[playerid][GasG] = AgoraV;
sGivePlayerCash(playerid, -preco);
format(gStr, sizeof(gStr), "fuel %d Liters Gasoline", amount);
SendClientMessage(playerid, AZUL_BMO, gStr);
}
else
{
new precofull = 100-pInfo[playerid][GasG];
TogglePlayerControllable(playerid, true);
pInfo[playerid][GasG] = 100;
sGivePlayerCash(playerid, -precofull*5);
format(gStr, sizeof(gStr), "fuel %d Liters Gasoline.", precofull);
SendClientMessage(playerid, AZUL_BMO, gStr);
}
SetTimerEx("To Fuel", 3000, false, "i", playerid);
TogglePlayerControllable(playerid, false);
return 1;
}