[Tutorial] How to make a Simple "/Goto" command !
#1

Introduction:


- Hello, today I'm gonna show you today how to make a simple /Goto Command .
- After start, you need to have SSCANF and ZCMD.



Let's start:


- After downloaded and put includes in "pawno/include" folder, we can start scripting. So we need to add that includes, at the top of script:

pawn Code:
#include <a_samp>
#include <zcmd>
#include <sscanf>

- Then, after adding includes, we scroll down, down, and we there we will made /goto command !

pawn Code:
CMD:goto(playerid,params[]) // This it's /Goto command. You can change in your wanted command !
{ // We open brackelet
    new ID; // This it's player's ID wich we will teleport !
    new Float:X; // This it's position X position of that player !
    new Float:Y; // This it's position Y position of that player !
    new Float:Z;  // This it's position z position of that player !
    new Float:A;  // This the Facing Angle position of that player !
    if(sscanf(params,"i", ID)) return SendClientMessage(playerid,-1,"{FF0000}AdmUsage: {15FF00}/Goto [PlayerID]"); // He will saw this on screen, if he write just /Goto . Will show to him Correct Usage !
    GetPlayerPos(ID, X,Y,Z); // Will get that player Position X,Y,Z !
    GetPlayerFacingAngle(ID, A); // Will get that player Facing Angle position !
    SetPlayerPos(playerid, X,Y,Z); // Will set the player who type /Goto [ID] to specified player !
    SetPlayerFacingAngle(playerid, A); // Will set exactlly that Facing Angle of specified player !
    SendClientMessage(playerid, -1, "{FF0000}Cmd: {15FF00}You teleported to specified player !"); // He will saw a message. "You teleported to specified player"
    return 1; // Return value !
} // Close brackelet to show we finished command !
All Code:


pawn Code:
#include <a_samp>
#include <zcmd>
#include <sscanf>

CMD:goto(playerid,params[])
{
    new ID;
    new Float:X;
    new Float:Y;
    new Float:Z;
    new Float:A;
    if(sscanf(params,"i", ID)) return SendClientMessage(playerid,-1,"{FF0000}AdmUsage: {15FF00}/Goto [PlayerID]");
    GetPlayerPos(ID, X,Y,Z);
    GetPlayerFacingAngle(ID, A);
    SetPlayerPos(playerid, X,Y,Z);
    SetPlayerFacingAngle(playerid, A);
    SendClientMessage(playerid, -1, "{FF0000}Cmd: {15FF00}You teleported to specified player !");
    return 1;
}
Reply


Messages In This Thread
How to make a Simple "/Goto" command ! - by HY - 01.11.2014, 12:36
Re: How to make a Simple "/Goto" command ! - by Glossy42O - 01.11.2014, 12:37
Re: How to make a Simple "/Goto" command ! - by JuanStone - 24.12.2014, 06:23
Re: How to make a Simple "/Goto" command ! - by TheRaGeLord - 24.01.2015, 06:23

Forum Jump:


Users browsing this thread: 1 Guest(s)