How to return 0; on Command using stock?
#1

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?
Reply
#2

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
Reply
#3

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.
Reply
#4

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_);
}
Reply
#5

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

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

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

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
Reply
#9

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? */
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)