Setloc and gotoloc - 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: Setloc and gotoloc (
/showthread.php?tid=475219)
Setloc and gotoloc -
Ananisiki - 11.11.2013
^^^^^^^^
Re: Setloc and gotoloc -
Elie1996 - 11.11.2013
Quote:
Originally Posted by Ananisiki
I'm doing a setloc and gotoloc CMD but I'm not so sure if I'm doing it right..
What I got right now,
pawn Код:
CMD:adsetloc(playerid, params[]) { #pragma unused params if(!IsCnRAdmin(playerid)) return UnknownCMD(playerid); if(Dead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead."); if(IsSpecing[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Spectating."); if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command From A Vehicle.");
new Float:X, Float:Y, Float:Z, Float:A, Interior, World; GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, A); Interior = GetPlayerInterior(playerid); World = GetPlayerVirtualWorld(playerid); return 1; }
|
The Player hasn't gone anywhere with this command.
If you want them to go somewhere else, keep everything the same, but change from this line:
pawn Код:
new Float:X, Float:Y, Float:Z, Float:A, Interior, World;
To:
pawn Код:
new Float:X,
Float:Y,
Float:Z;
if(sscanf
(params,
"fff", X, Y, Z
)) return SendClientMessage
(playerid, COLOR,
"Usage: /adsetloc [Coor:X] [Coor:Y] [Coor:Z]");
// Check the parameters here's a guide for sscanf --> https://sampwiki.blast.hk/wiki/Fast_Commands// You can check if he's an adminstrator if you'd like to limit this command to adminsSendClientMessage
(playerid, COLOR,
"You have been teleported");
// Send him a message of successful teleportationSetPlayerPos
(playerid, X,Y,Z
);
// Put the player POS in X,Y,Z the coordinates the user enteredreturn 1;
// So it doesn't Return Unknown Command} // By Elie1996
And Remove this line:
pawn Код:
#pragma unused params
// That line is only used when you DONT have any parameters to check, but here you have the X,Y,Z coordinates.
It would be nice if you kept the By Elie1996
Hope That Helps.