17.11.2011, 16:38
hey guys i wonder how i can make a goto command(not only for admins)with zcmd include :
can you help me?
In Advance,
Blacklisted_Bboy
can you help me?
In Advance,
Blacklisted_Bboy
CMD:goto(playerid, params[]) {
new
iTarget; // Create a temporary variable for the command
if(sscanf(params, "u", iTarget)) // get the player ID and load it in to 'iTarget'
return SendClientMessage(playerid, 0, "Syntax: /goto [playerid]");
if(iTarget == INVALID_PLAYER_ID) // INVALID_PLAYER_ID is the value of 'iTarget' if the player isn't connected
return SendClientMessage(playerid, 0, "Player isn't connected.");
new
Float: fPlayerPos[3]; // Create a temporary array to store the floats in
GetPlayerPos(iTarget, fPlayerPos[0], fPlayerPos[1], fPlayerPos[2]); // Get the target player's position
SetPlayerPos(playerid, fPlayerPos[0], fPlayerPos[1], fPlayerPos[2]); // Set the current player's position
return 1;
}
CMD:goto(playerid, params[])
{
new targetid, Float:X, Float:Y, Float:Z;
if(sscanf(params,"i", targetid)) return SCM(playerid, COLOR_RED,"[ERROR]: Usage: /goto [playerid]");
if(targetid == playerid ) return SCM(playerid, COLOR_RED, "[ERROR]: You cannot teleport to yourself!");
if(IsPlayerConnected(targetid) == 0) return SCM(playerid, COLOR_RED, "[ERROR]: Player is not connected!");
GetPlayerPos(targetid, X, Y, Z );
if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)SetVehiclePos( GetPlayerVehicleID(playerid), X+2, Y+2, Z );
else SetPlayerPos( playerid, X+2, Y+2, Z );
return 1;
}