Setloc and gotoloc
#1

^^^^^^^^
Reply
#2

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 admins
SendClientMessage(playerid, COLOR, "You have been teleported"); // Send him a message of successful teleportation
SetPlayerPos(playerid, X,Y,Z); // Put the player POS in X,Y,Z the coordinates the user entered
return 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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)