06.10.2013, 11:58
When i write /goto [id] it dosen't go to the player it goes to blueberry and then i lag and then i crash.
CODE:
CODE:
pawn Код:
CMD:goto(playerid, params[])
{
new playerb, string[128];
new Float:Pos[3];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pHelper] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
// if(!aDuty[playerid] && PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /goto [playerid]");
if(!IsPlayerLoggedIn(playerb) && !IsPlayerNPC(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
if(PlayerInfo[playerid][pHelper] && !PlayerInfo[playerid][pAdmin])
{
if(!HelpTime[playerb]) return SendClientMessage(playerid, COLOR_GREY, "This player hasn't requested any help.");
if(hPos[playerid][0] == 0 && hPos[playerid][1] == 0 && hPos[playerid][2] == 0 && hPOS[playerid][0] == 0 && hPOS[playerid][0] == 0)
{
GetPlayerPos(playerid, hPos[playerid][0], hPos[playerid][1], hPos[playerid][2]);
hPOS[playerid][0] = GetPlayerInterior(playerid);
hPOS[playerid][1] = GetPlayerVirtualWorld(playerid);
GetPlayerPos(playerb, Pos[0], Pos[1], Pos[2]);
SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
SetPlayerInterior(playerid, GetPlayerInterior(playerb));
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerb));
format(string, sizeof(string), " You have teleported to %s.", NORPN(playerb));
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), " %s %s has teleported to you.", RPHLN(playerid), NORPN(playerid));
SendClientMessage(playerb, COLOR_WHITE, string);
format(string, sizeof(string), "{FF0000}[Helper Warn]{FF6347} %s has teleported to %s.", NORPN(playerid), NORPN(playerb));
SendHelperMessage(COLOR_LIGHTRED, 1, string);
}
else SendClientMessage(playerid, COLOR_GREY, "You must /goback before teleporting to another player.");
}
else
{
if(Spec[playerb]) return SendClientMessage(playerid, COLOR_GREY, "Player is spectating someone.");
GetPlayerPos(playerb, Pos[0], Pos[1], Pos[2]);
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SetVehiclePos(GetPlayerVehicleID(playerid), Pos[0]+2, Pos[1]+2, Pos[2]);
}
else
{
SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
}
SetPlayerInterior(playerid, GetPlayerInterior(playerb));
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerb));
format(string, sizeof(string), " You have teleported to %s.", NORPN(playerb));
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), " Administrator %s has teleported to you.", NORPN(playerid));
SendClientMessage(playerb, COLOR_WHITE, string);
}
return 1;
}