CMD:goto(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] >=1 || IsPlayerAdmin(playerid))
{
new ID;
new Float:X;
new Float:Y;
new Float:Z;
new Float:A;
if(sscanf(params,"i", ID)) return SendClientMessage(playerid,-1,"{40FF00}INFO:{FFFFFF}Foloseste /goto [Name/id]");
GetPlayerPos(ID, X,Y,Z);
GetPlayerFacingAngle(ID, A);
SetPlayerPos(playerid, X,Y,Z);
SetPlayerFacingAngle(playerid, A);
return 1;
}
else return SendClientMessage(playerid,-1,"You do not have permission to use this command!");
}
CMD:goto(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] >=1 || IsPlayerAdmin(playerid))
{
new ID, IDName[MAX_PLAYERS_NAME + 1], string[128];
new Float:X;
new Float:Y;
new Float:Z;
new Float:A;
if(sscanf(params,"i", ID)) return SendClientMessage(playerid,-1,"{40FF00}INFO:{FFFFFF}Foloseste /goto [Name/id]");
GetPlayerName(ID, IDName, MAX_PLAYER_NAME + 1);
GetPlayerPos(ID, X,Y,Z);
GetPlayerFacingAngle(ID, A);
SetPlayerPos(playerid, X,Y,Z);
SetPlayerFacingAngle(playerid, A);
format(string, sizeof string, "You teleported to %s(%d)", IDName, ID);
SendClientMessage(playerid, -1, string);
return 1;
}
else return SendClientMessage(playerid,-1,"You do not have permission to use this command!");
}
if(sscanf(params,"u", ID)) return SendClientMessage(playerid,-1,"{40FF00}INFO:{FFFFFF}Foloseste /goto [Name/id]");
Rookie mistake. Always check if the player id is valid or not. use IsPlayerConnected or if you have your server sided variable to check player is valid or not.
|