SA-MP Forums Archive
Error - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Error (/showthread.php?tid=117519)



Error - JoeDaDude - 31.12.2009

Simple problem but im not all that used to dcmd so i dont know what to do exactly

pawn Код:
dcmd_goto(playerid, params[])
{
    if (strlen(params))
    {
        id = strval(params);
        if (IsPlayerConnected(id))
        {
        if(IsPlayerAdmin(playerid))
        {
            SendClientMessage(playerid, COLOR_WHITE, "Command working Ok?");
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Player not found");
        }
        }
        else
        {
          SendClientMessage(playerid, 0xFF0000AA, "You are not an Administrator");
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/heal <playerid>\"");
    }
    return 1;
}
If the isplayeradmin or whatever wrong dont fix it for me, I wanna do that myself xd,
I just want to get rid of these errors first,

Код:
C:\Users\Torran\Documents\Server\gamemodes\sftdm.pwn(380) : error 017: undefined symbol "id"
C:\Users\Torran\Documents\Server\gamemodes\sftdm.pwn(381) : error 017: undefined symbol "id"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.



Re: Error - Marcel - 31.12.2009

pawn Код:
dcmd_goto(playerid, params[])
{
    if (strlen(params))
    {
        new id = strval(params);
        if (IsPlayerConnected(id))
        {
            if(IsPlayerAdmin(playerid))
            {
                SendClientMessage(playerid, COLOR_WHITE, "Command working Ok?");
            }
            else
            {
                SendClientMessage(playerid, 0xFF0000AA, "Player not found");
            }
        }
        else
        {
          SendClientMessage(playerid, 0xFF0000AA, "You are not an Administrator");
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/heal <playerid>\"");
    }
    return 1;
}
There is something else wrong with your code too, if the player is not connected it will show you the "You are not an Administrator" message.


Re: Error - Correlli - 31.12.2009

Quote:
Originally Posted by JoeDaDude
Simple problem but im not all that used to dcmd so i dont know what to do exactly
This error has nothing to do with dcmd knowledge.

Quote:
Originally Posted by JoeDaDude
Код:
C:\Users\Torran\Documents\Server\gamemodes\sftdm.pwn(380) : error 017: undefined symbol "id"
C:\Users\Torran\Documents\Server\gamemodes\sftdm.pwn(381) : error 017: undefined symbol "id"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
It's obvious that id variable isn't defined.


Re: Error - Nameless303 - 31.12.2009

Try to add new id; under dcmd_goto(playerid, params[]){


Re: Error - JoeDaDude - 31.12.2009

My command is not working,
I go ingame and type /goto,
Nothing happens

pawn Код:
dcmd_goto(playerid, params[])
{
    new id;
    if (strlen(params))
    {
        id = strval(params);
        if (IsPlayerConnected(id))
        {
        if(IsPlayerAdmin(playerid))
        {
            SendClientMessage(playerid, COLOR_WHITE, "Command working Ok?");
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Player not found");
        }
        }
        else
        {
          SendClientMessage(playerid, 0xFF0000AA, "You are not an Administrator");
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/heal <playerid>\"");
    }
    return 1;
}



Re: Error - Marcel - 31.12.2009

pawn Код:
dcmd_goto(playerid, params[])
{
    if (strlen(params))
    {
        new id = strval(params);
        if (IsPlayerConnected(id))
        {
            if(IsPlayerAdmin(playerid))
            {
                new
                    Float:pPos[ 3 ];
                GetPlayerPos(id, pPos[ 0 ], pPos[ 1 ], pPos[ 2 ] );
                SetPlayerPos( playerid, pPos[ 0 ], pPos[ 1 ], pPos[ 2 ] );
                SetPlayerInterior(playerid, GetPlayerInterior(id));
                SendClientMessage(playerid, COLOR_WHITE, "You've been teleported to the player!");
            }
            else
            {
                SendClientMessage(playerid, 0xFF0000AA, "You are not an Administrator");
            }
        }
        else
        {
          SendClientMessage(playerid, 0xFF0000AA, "Player not found!");
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/goto <playerid>\"");
    }
    return 1;
}



Re: Error - JoeDaDude - 31.12.2009

Command still not Working??


Re: Error - JoeDaDude - 31.12.2009

Do anyone know whats wrong? This is my first time using dcmd


Re: Error - KnooL - 31.12.2009

pawn Код:
dcmd_goto(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
if (sscanf(params,"u",id))
{
SendClientMessage(playerid,COLOR,"[USAGE] /goto [ID]");
}
else if(!IsPlayerConnected(id))
{
SendClientMessage(playerid,COLOR,"[ERROR] Player is not connected");
}
else if(playerid == id) {
SendClientMessage(playerid,COLOR,"[ERROR] You can't teleport yourself.");
}
else
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(id,X,Y,Z);
SetPlayerPos(playerid,X,Y,Z);
}
}
else
{
SendClientMessage(playerid,COLOR,"[ERROR] You are not logged in at rcon.");
}
return 1;
}
Just made it as I don't have it yet, here you go! (untested)


Re: Error - JoeDaDude - 31.12.2009

Still dont work ingame,
Why dont the command work ingame?
Am i doing somet wrong on the OnPlayerCommandText callback