goto - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: goto (
/showthread.php?tid=297753)
goto -
vassilis - 17.11.2011
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
Re: goto -
Calgon - 17.11.2011
Using sscanf to parse the player id, it's very simple.
pawn Код:
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;
}
Re: goto -
Kostas' - 17.11.2011
pawn Код:
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;
}
Re: goto -
vassilis - 17.11.2011
re malaka gt den m eipes oti exeis katevasei to xtreamgaming...oute credits den tou exeis dwsei ki olas...
Re: goto -
Kostas' - 17.11.2011
Den exo kanei kana release gia na doso credits. To eixa katevasei, alla itan adio kai to gemisa
AW: goto -
Meta - 17.11.2011
greek isn't english D:
Re: goto -
vassilis - 17.11.2011
den ennow auto re...ennow oti gt den m to pes :P
Re: goto -
Kostas' - 17.11.2011
Meta is correct, we should talk English here