26.03.2012, 10:18
I need a command !FOR PLAYER!
that it will teleport player to player
Somebody?
that it will teleport player to player
Somebody?
CMD:tp(playerid, params[]){
new id, id2, Float:x, Float:y, Float:z;
if(sscanf(params,"uu", id, id2)) return SendClientMessage(playerid, -1, "USAGE: tp [id] to [id2]");
GetPlayerPos(id2, x, y, z);
SetPlayerPos(id, x, y, z);
return 1;
}
CMD:goto(playerid, params[])
{
new ID;
if(sscanf(params, "u", ID)) SendClientMessage(playerid, -1, "USAGE: /goto [playerid]");
else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, -1, "Player is not connected!");
else
{
new Float:X, Float:Y, Float:Z, Float:Angle;
if(IsPlayerInAnyVehicle(ID))GetVehiclePos(GetPlayerVehicleID(ID), X, Y, Z), GetVehicleZAngle(GetPlayerVehicleID(ID), Angle);
else GetPlayerPos(ID, X, Y, Z), GetPlayerFacingAngle(playerid, Angle);
if(IsPlayerInAnyVehicle(playerid))SetVehiclePos(GetPlayerVehicleID(playerid), X+1.0, Y+1.0, Z), SetVehicleZAngle(GetPlayerVehicleID(playerid), Angle);
else SetPlayerPos(playerid, X+1.0, Y+1.0, Z), SetPlayerFacingAngle(playerid, Angle);
}
return true;
}
C:\Users\eesti\Desktop\SAMP\gamemodes\Dream.pwn(73) : error 017: undefined symbol "params"
C:\Users\eesti\Desktop\SAMP\gamemodes\Dream.pwn(73) : error 001: expected token: ")", but found "return"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.
CMD:goto(playerid, params[])
{
new targetid, Float:x, Float:y, Float:z;
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /goto [id]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "That player is not connected");
GetPlayerPos(targetid, x, y, z);
SetPlayerPos(playerid, x, y+0.5, z+0.5);
return 1;
}
and if you wonna to tp to player wich your vehicle
PHP код:
|
CMD:goto(playerid,params[]) { if(PlayerInfo[playerid][Level] >= 1 || IsPlayerAdmin(playerid)) { if(isnull(params)) return SendClientMessage(playerid,red,"USAGE: /goto [playerid]"); new player1, string[128]; if(!IsNumeric(params)) player1 = ReturnPlayerID(params); else player1 = strval(params); if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid) { // CMDMessageToAdmins(playerid,"GOTO"); new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z); SetPlayerInterior(playerid,GetPlayerInterior(player1)); SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(player1)); if(GetPlayerState(playerid) == 2) { SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z); LinkVehicleToInterior(GetPlayerVehicleID(playerid),GetPlayerInterior(player1)); SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),GetPlayerVirtualWorld(player1)); } else SetPlayerPos(playerid,x+2,y,z); format(string,sizeof(string),"You have teleported to \"%s\"", pName(player1)); return SendClientMessage(playerid,blue,string); } else return SendClientMessage(playerid, red, "Player is not connected or is yourself"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); }