Admin system
#1

PHP код:
C(adgoto)
{
    new 
giveididname2[MAX_PLAYER_NAME];
    if(
PData[playerid][Level] < 1) return SCM(playeridred"Unknown Command, Use /cmds To See All Valid Commands.");
     else if(
sscanf(params"r"giveid)) return SCM(playeridADMIN"USAGE: /adgoto <Name/Id>");
     else if(!
IsPlayerConnected(id)) return SendClientMessage(playeridred" This Player Is Not Connected.");
     else
     {
         
GetPlayerName(giveidname2sizeof(name2));
         new 
Float:xFloat:yFloat:z;
         
GetPlayerPos(giveidxyz);
         
SetPlayerPos(playeridx+1y+1z);
         
format(str2sizeof(str2), "You Have Teleported To %s."name2);
          
SCM(playeridADMINstr2);
    }
    return 
1;

SCM = SendClientMessage
PHP код:
#define SCM                SendClientMessage 
This cmd works and all, but when player id is 3> you cant go to him it says "This Player Is Not Connected"

please help
Reply
#2

Nvm.
Reply
#3

You passed the variable "giveid" with sscanf but you check if variable "id" is connected.

pawn Код:
else if ( !IsPlayerConnected( giveid ) )
Reply
#4

@Da' J': Don't post if you don't know what you're talking about, because it's not helpful.

pawn Код:
C(adgoto)
{
    new id, name2[MAX_PLAYER_NAME];
    if(PData[playerid][Level] < 1) return SCM(playerid, red, "Unknown Command, Use /cmds To See All Valid Commands.");
    if(sscanf(params, "r", id)) return SCM(playerid, ADMIN, "USAGE: /adgoto <Name/Id>");
    if(!IsPlayerConnected(id)) return SCM(playerid, red, " This Player Is Not Connected.");
    GetPlayerName(id, name2, sizeof(name2));
    new Float:x, Float:y, Float:z;
    GetPlayerPos(id, x, y, z);
    SetPlayerPos(playerid, x+1, y+1, z);
    format(str2, sizeof(str2), "You Have Teleported To %s.", name2);
    SCM(playerid, ADMIN, str2);
    return 1;
}
Reply
#5

Try using the 'u' or 'i/d' instead of the 'r' specifier.
Not sure if that would cause the problem.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)