How to check did we enter our id ?
#1

Hello, here is my /goto command :
pawn Код:
CMD:goto(playerid,params[])
{
    new id,Float:x,Float:y,Float:z,name[MAX_PLAYER_NAME],msg[128];
    if(PlayerInfo[playerid][pAdmin] == 5) return SendClientMessage(playerid,COLOR_RED,"[SERVER]:You must be and Admin level 6 or higher to use this command!");
    else if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid,COLOR_RED,"[SERVER]:You must be and Admin to use this command!");
    else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"[SERVER]:Player is not connected anymore!");
    else if(id == playerid) return SendClientMessage(playerid,COLOR_RED,"[SERVER]:You cant teleport to yourself!");
    else if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_RED,"[SERVER]:Usage:/goto [name/id]");
    else
    {
        GetPlayerPos(id,x,y,z);
        SetPlayerPos(playerid,x+1,y+1,z);
        GetPlayerName(id,name,sizeof(name));
        format(msg,sizeof(msg),"[SERVER]:You've been teleported to %s(%d)!",name,id);
        SendClientMessage(playerid,COLOR_GREEN,msg);
    }
    return 1;
}
But this dont work well.. sometimes it work for me,sometimes it just send me "[SERVER]:You cant teleport to yourself!" .. so i guess something isnt well with :
pawn Код:
else if(id == playerid)
I tested this ten times with my friend, he sometimes can goto me,but also sometimes he just get that Error msg..
Any ideas how to fix this ?
Reply


Messages In This Thread
How to check did we enter our id ? - by Djumza - 06.04.2014, 16:54
Re: How to check did we enter our id ? - by Corekt - 06.04.2014, 16:58
Re: How to check did we enter our id ? - by Djumza - 06.04.2014, 17:01

Forum Jump:


Users browsing this thread: 1 Guest(s)