05.09.2018, 21:01
PHP код:
CMD:eat(playerid, params[])
{
new value;
value = strval(params);
if(value == 1)
{
new str[159], Float: healthpk, query[259];
GetPlayerHealth(playerid, healthpk);
if(IsLimited[playerid] == true) return SendClientMessage(playerid, -1, "{990000}You are not allowed to spawn with this command. Please wait few minutes.");
if(pInfo[playerid][Pizza] != 0){
if(healthpk == 100.0) return SendClientMessage(playerid, -1 , "{39ac73}Can't eat it.");
SetPlayerHealth(playerid, healthpk+5);
pInfo[playerid][Pizza] -= 1;
mysql_format(g_SQL, query, sizeof query, "UPDATE `players` SET `pizza` = %d WHERE `id` = %d LIMIT 1", pInfo[playerid][Pizza], pInfo[playerid][ID]);
mysql_tquery(g_SQL, query);
format(str, sizeof(str), "{39ac73}(pizza) You ate a pizza. %d left", pInfo[playerid][Pizza]);
beerlimited[playerid] = SetTimerEx("CanDrinkBeer", 100000, 1, "i", playerid); // 350000 = 5 minutes
IsLimited[playerid] = true;
SendClientMessage(playerid, -1, str);}else{
format(str, sizeof(str), "{39ac73}Hello %s, you don't have any pizza's left in your inventory.", PlayerName[playerid]);
SendClientMessage(playerid, -1, str);
}
}
return 1;
}