A few commands work on ID 0 only.
#5

pawn Код:
CMD:get(playerid, params[])
{
    if(!PlayerInfo[playerid][pAdmin]) return NOACCESS;
    new id;
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "{00FFFF}*{EEEEEE}Usage: /gethere [Playername/ID]");
    if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Player is not connected.");
    new string[75], name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME], Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    SetPlayerInterior(id, GetPlayerInterior(playerid));
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerName(id, PlayerName, sizeof(PlayerName));
    format(string, sizeof(string), "{00FFFF}*{EEEEEE}Administrator %s has teleported you to him", name);
    SendClientMessage(id, COLOR_WHITE, string);
    format(string, sizeof(string), "{00FFFF}*{EEEEEE}You have teleported %s to you", PlayerName);
    SendClientMessage(playerid, COLOR_WHITE, string);
    SetPlayerVirtualWorld(id, GetPlayerVirtualWorld(playerid));
    SetPlayerPos(id, x + 2, y, z);
    return 1;
}
As mentioned above, a variable has a default value of '0' or 'false' when created, so IsPlayerConnected(id) would be IsPlayerConnected(0).
Reply


Messages In This Thread
A few commands work on ID 0 only. - by Johnson_Brooks - 12.06.2014, 14:14
AW: A few commands work on ID 0 only. - by BiosMarcel - 12.06.2014, 14:18
Re: A few commands work on ID 0 only. - by Amrev - 12.06.2014, 14:21
Re: A few commands work on ID 0 only. - by DavidBilla - 12.06.2014, 14:25
Re: A few commands work on ID 0 only. - by Threshold - 12.06.2014, 14:37

Forum Jump:


Users browsing this thread: 6 Guest(s)