Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Confused about command return

$
0
0
Hey everyone!

Just adding some basic commands and debugging when all of a sudden I notice something weird.
I have a custom message in OnPlayerCommandPerformed and that's ok, but why is it being called when I don't want to?

Example: I just took a little portion of code

Code:

CMD:gethere(playerid,params[])
{
        new id;
        // codes...
        if(sscanf(params, "r",id)) return SendClientMessage(playerid,COLOR,"Use: {FFFFFF}/gethere [ID / Name]");
        else
        {
            if(PlayerInfo[id][LoggedOn] == false) return SCM(playerid, COLOR,"That dude is offline!");
                if(id == INVALID_PLAYER_ID)return SCM(playerid,COLOR,"Wrong ID!");
                if(id == playerid)return SCM(playerid,COLOR,"Wrong ID!");
                // codes...

if(id == playerid) WILL BE called, but other checks before won't, resulting in !success OnPlayerCommandPerformed.

Checks are actually in one line but I did this to debug.

This seems strange to me. Maybe I forgot how sscanf works with input arguments but I would really want someone to explain me the reason behind it.

Thanks

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>