SA-MP Forums Archive
How to return 0; on Command using stock? - 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: How to return 0; on Command using stock? (/showthread.php?tid=432353)



How to return 0; on Command using stock? - JaKe Elite - 22.04.2013

I've wondering if this is possible through stock function.

I've tried this one but it still executes the command. But there is message

"ERROR: You must be logged in to use this command!"

pawn Код:
stock CL(playerid)
{
    if(pInfo[playerid][LogIn] == 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: You must be logged in to use this command!");
    return 0;
}
I've more than 225 commands!

Any idea?


Re: How to return 0; on Command using stock? - KiNG3 - 22.04.2013

I was thinking stupidity and doing this

pawn Код:
stock CL(playerid)
{
    return 0;
    if(pInfo[playerid][LogIn] == 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: You must be logged in to use this command!");
}
But I am just a newbie, but it would be interesting to see if it's actually possible


Re: How to return 0; on Command using stock? - JaKe Elite - 22.04.2013

No that one is wrong.
Please don't post if you're newbie. Not being rude but please don't post if you don't know how to do it.


Re: How to return 0; on Command using stock? - KiNG3 - 22.04.2013

I knew it was wrong,

And what's wrong with posting as a newbie..... It was just a joke, I said I was thinking of stupidly.....

It was just having fun?? No fun here?

Besides, it'd make sense in my own head if you put return 0; before it.

pawn Код:
public On_Jake_Comment
{
    SendClientMessage(playerid, COLOR_RED,"[ERROR]{FFFFFF} You need to lighten up sir and allow us NOOBS to speak..");
    return Mute(_Jake_);
}



Re: How to return 0; on Command using stock? - JaKe Elite - 22.04.2013

There is fun here. But when it comes to scripting help i am serious guy.
So i'm sorry about that.


Re: How to return 0; on Command using stock? - KiNG3 - 22.04.2013

I saw showing an example that makes sense in my own mind...


Re: How to return 0; on Command using stock? - Isolated - 22.04.2013

@KiNG3 Could you explain why you are
pawn Код:
return 0;
before you are adding the code? That just means it'll ignore everything else.


Re: How to return 0; on Command using stock? - Knappen - 22.04.2013

Okay, if you are going to use it in commands to check if they are logged in, do it like this.

pawn Код:
stock CL(playerid)
{
    if(pInfo[playerid][LogIn] > 0) return 1;
    else SendClientMessage(playerid, COLOR_RED, "ERROR: You must be logged in to use this command!");
    return 0;
}
That should work.

EDIT:
KING3, I don't think it will even compile if you do it like that! :O


Re: How to return 0; on Command using stock? - Knappen - 22.04.2013

Was that meant for me or for KING3?

Yeah, you could just a macro for it as well, something like

pawn Код:
#define IsLoggedIn
            if(pInfo[playerid][LogIn] > 0) return 1;
            else return SendClientMessage(playerid, COLOR_RED, "ERROR: You must be logged in to use this command!");
#endif
/* Not that used to macros, but I guess this should be here? */



Re: How to return 0; on Command using stock? - Djole1337 - 22.04.2013

pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if (notlogged[playerid])
        return SendClientMessage(playerid, -1, "blabla"), 0;
    return 1;
}
This is what you looking for ?