SA-MP Forums Archive
My command wount work... - 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: My command wount work... (/showthread.php?tid=388444)



My command wount work... - Hade. - 28.10.2012

Hey i made my command that restores player's health i compile and stuff, no errors but ingame it says SERVER:Unknown command :S:S:S Please help, heres the code..

PHP код:
{
    if (
strcmp("/elud"cmdtexttrue10) == 0)
    {
        
SetPlayerHealth(playerid,100);
        
SendClientMessage(playerid,COLOR_GREEN,"Su elud tдitusid");
        return 
1;
    }
    return 
0;

And thats under OnPlayerCommandText


Re: My command wount work... - Hade. - 28.10.2012

Anyone?


Re: My command wount work... - HyDrAtIc - 28.10.2012

pawn Код:
if (strcmp("/elud", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid,100);
        SendClientMessage(playerid,COLOR_GREEN,"Su elud tдitusid");
        return 1;
    }
And please use [pawn] tags php tags sucks.


Re : My command wount work... - yusei - 28.10.2012

Or try this


PHP код:
if(strcmp(cmd"/elud"true) == 0)
    {
       
SetPlayerHealth(playerid,100); 
              
SendClientMessage(playerid,COLOR_GREEN,"Su elud tдitusid");
        return 
1;
    } 



Re: My command wount work... - adithegman - 28.10.2012

The problem is with that "return 0;". I explain it to you: that return is to return a specific value for ex putting 0 it's like saying to the server to send a message to that player that it is an invalid Cmd, otherwise putting 1 it's like saying to the server to process the info that you typed earlier, other people do this "return SendClientMessage..." ex:
Код:
if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_WHITE,"You are an Admin"); // if you are admin it will send you a message that will say that you are an admin, if you are not, it will not send anything
So try to change that 0 to 1 or delete that return 0.
Hope it helps!


Re: My command wount work... - gtakillerIV - 28.10.2012

Inside the callback OnPlayerCommandText you have to return 0, but inside your command you have to return 1 if you want it to work


Re: My command wount work... - Hade. - 28.10.2012

It still doesnt work...


Re: My command wount work... - tuuler - 29.10.2012

Nдe proovi kas tццtab zcmd iga

pawn Код:
CMD:elud(playerid, params[])
{
    SetPlayerHealth(playerid,100);
    SendClientMessage(playerid,COLOR_GREEN,"Su elud tдitusid");
    return 1;
}



Re: My command wount work... - Hade. - 30.10.2012

Jep, tдnud, got it fixed.