#1

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

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

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

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

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;
}
Reply
#6

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

Command still not Working??
Reply
#8

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

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)
Reply
#10

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


Forum Jump:


Users browsing this thread: 3 Guest(s)