[HELP]Command says I am also not connected!!!
#1

pawn Код:
COMMAND:goto(playerid,params[])
{
  if(GetPVarInt(playerid,"Adminlevel") < 1) return SendClientMessage(playerid,COLOR_RED,"This command is only for admin level 1");
  if(GetPVarInt(playerid,"Adminlevel") >=1)
  {
    new ID;
    if(sscanf(params,"u",ID)) return SendClientMessage(playerid,COLOR_RED,"USAGE:/goto [ID]");
    else if(ID == playerid) return SendClientMessage(playerid,COLOR_RED,"You can't teleport to yourself");
    else if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"The player is not connected");
    {
       new Float:x,Float:y,Float:z;
       GetPlayerPos(ID,x,y,z);
       SetPlayerPos(playerid,x,y+1,z);
    }
  }
 return true;
}
Lol,please help,when I type in my ID(0) says that The Player is not connected instead of telling that "You can't tele to yourself" and I can't spot mistake.
Reply
#2

if(IsPlayerConnected(ID)) you need no else ..
Reply
#3

pawn Код:
COMMAND:goto(playerid,params[])
{
  if(GetPVarInt(playerid,"Adminlevel") < 1) return SendClientMessage(playerid,COLOR_RED,"This command is only for admin level 1");
  if(GetPVarInt(playerid,"Adminlevel") >=1)
  {
    new ID;
    if(sscanf(params,"u",ID)) return SendClientMessage(playerid,COLOR_RED,"USAGE:/goto [ID]");
    if(ID == playerid) return SendClientMessage(playerid,COLOR_RED,"You can't teleport to yourself");
    if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,COLOR_RED,"The player is not connected");
    {
       new Float:x,Float:y,Float:z;
       GetPlayerPos(ID,x,y,z);
       SetPlayerPos(playerid,x,y+1,z);
    }
  }
 return true;
}
You mean like that?Still same error -.-
Reply
#4

how i can make the code example i mean to show it on pawno here to the forum?
Reply
#5

pawn Код:
OMMAND:goto(playerid,params[])
{
    if(GetPVarInt(playerid,"Adminlevel") < 1) return SendClientMessage(playerid,COLOR_RED,"This command is only for admin level 1");
    new ID;
    if(sscanf(params,"u",ID)) return SendClientMessage(playerid,COLOR_RED,"USAGE:/goto [ID]");
    if(ID == playerid) return SendClientMessage(playerid,COLOR_RED,"You can't teleport to yourself");
    if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,COLOR_RED,"The player is not connected");
    new Float:x,Float:y,Float:z;
    GetPlayerPos(ID,x,y,z);
    SetPlayerPos(playerid,x,y+1,z);
    return true;
}
vassilis [ PAWN ] [/ PAWN]
Reply
#6

ok thank you man
Reply
#7

you may say i am making fool of you jumbo,and I AM ALSO AMAZED,but the command still says when /goto 0 (me) that i am not connected(I AM NOT JOKING)
Reply
#8

MMmh

still the same if you do
if(!IsPlayerConnected(ID) || ID== playerid) return message.. player not connected or its you


maybe you have some npc?
Reply
#9

weel,what a philosophy for a command now it's working LOL and when u said "is not connected or is yourself" I remembered something :before I decided to make my own admin system,I used Lethal Admin and the error message was the same u said,in conclusion maybe it's a bug so it can't send different error messages like "is yourself" is not connected" or I JUST DON'T KNOW WHY wasn't working.anyway I have no NPC(I can't make up my minds if I should use some or no :P)
Reply
#10

pawn Код:
COMMAND:goto(playerid,params[])
{
    if(GetPVarInt(playerid,"Adminlevel") < 1) return SendClientMessage(playerid,COLOR_RED,"This command is only for admin level 1");
    new ID;
    if( !sscanf(params,"u",ID) )
    {
        if(ID == playerid) return SendClientMessage(playerid,COLOR_RED,"You can't teleport to yourself");
        if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"The player is not connected");
        new Float:x,Float:y,Float:z;
        GetPlayerPos(ID,x,y,z);
        SetPlayerPos(playerid,x,y+1,z);
    } else return SendClientMessage(playerid,COLOR_RED,"USAGE:/goto [ID]");
    return true;
}
Try this
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)