SA-MP Forums Archive
cmd /eat pizza - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: cmd /eat pizza (/showthread.php?tid=658523)



cmd /eat pizza - severance - 05.09.2018

PHP код:
CMD:eat(playeridparams[])
{
    new 
value;
    
value strval(params);
    if(
value == 1)
    {
        new 
str[159], Floathealthpkquery[259];
         
GetPlayerHealth(playeridhealthpk);
        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, -"{39ac73}Can't eat it.");
        
SetPlayerHealth(playeridhealthpk+5);
        
pInfo[playerid][Pizza] -= 1;
         
mysql_format(g_SQLquerysizeof query"UPDATE `players` SET `pizza` = %d WHERE `id` = %d LIMIT 1"pInfo[playerid][Pizza], pInfo[playerid][ID]);
        
mysql_tquery(g_SQLquery);
        
format(strsizeof(str), "{39ac73}(pizza) You ate a pizza. %d left"pInfo[playerid][Pizza]);
        
beerlimited[playerid] = SetTimerEx("CanDrinkBeer"1000001"i"playerid); // 350000 = 5 minutes
        
IsLimited[playerid] = true;
        
SendClientMessage(playerid, -1str);}else{
        
format(strsizeof(str), "{39ac73}Hello %s, you don't have any pizza's left in your inventory."PlayerName[playerid]);
        
SendClientMessage(playerid, -1str);
        }
    }
    return 
1;

How can i make instea /eat 1 (1 = pizza) to /eat pizza ?


Re: cmd /eat pizza - solstice_ - 05.09.2018

Use strcmp.

PHP код:
if(isnull(params)) return SendClientMessage(playerid, -1"USAGE: /eat [pizza/other]");
if(
strcmp(params"pizza"true) == 0)
{
    
//Code




Re: cmd /eat pizza - severance - 05.09.2018

thanks