SA-MP Forums Archive
Admin command: /gethere [id] - ZCMD - 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: Admin command: /gethere [id] - ZCMD (/showthread.php?tid=357598)



Admin command: /gethere [id] - ZCMD - MrBorsh - 07.07.2012

Hey, I am so lost in this one. If anyone could help me to create a admin command named /gethere [ID].

This is what I mixed myself but not working and I do not know how to create it. Please explain me what I should do to create it successfully.


This is what I created:
pawn Код:
COMMAND:gethere(playerid, params[])
{
  if(!IsPlayerAdmin(playerid)) return 0;
  if(sscanf(params, "ui") return SendClientMessage(playerid, 0x333666, "Correct usage: /gethere [ID]");
  GetPlayerPos(playerid,x,y,z);
  GetPlayerFacingAngle(playerid,angle);
  SetPlayerPos(playerid,x,y,z);
  return 1;
}



Re: Admin command: /gethere [id] - ZCMD - reh_007 - 07.07.2012

Are you getting errors, or what,


Re: Admin command: /gethere [id] - ZCMD - SnG.Scot_MisCuDI - 07.07.2012

pawn Код:
COMMAND:gethere(playerid, params[])
{
  if(!IsPlayerAdmin(playerid)) return 0;

  new target; //the player u are getting
  if(sscanf(params, "u", target)) return Usage(playerid, "/goto [player]");
 
  new Float:Pos[3]; //same as X Y Z
  GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]); //getting the admin's position who used the command
  SetPlayerPos(target, Pos[0]+3, Pos[1], Pos[2]); //setting the player the admin wants to get, position
  GetPlayerFacingAngle(playerid,angle); //getting the admins facing angle
  SetPlayerFacingAngle(target,angle) //setting the players facing angle
  return 1;
}
You cannot get a player if you are using SetPlayerPos(playerid)


Re: Admin command: /gethere [id] - ZCMD - MrBorsh - 07.07.2012

Quote:
Originally Posted by reh_007
Посмотреть сообщение
Are you getting errors, or what,
Yes, I get 4 errors, but I need to see someone creating that command correctly, and explain to me what they did.


Re: Admin command: /gethere [id] - ZCMD - SnG.Scot_MisCuDI - 07.07.2012

And please post the errors..


Re: Admin command: /gethere [id] - ZCMD - shayan122 - 07.07.2012

Код:
COMMAND:gethere(playerid, params[])
{
        if(!IsPlayerAdmin(playerid)) return 0;
        if(sscanf(params, "ui") return SendClientMessage(playerid, 0x333666, "Correct usage: /gethere [ID]");
        SetPlayerPos(ID,x+1,y,z);
	SetPlayerVirtualWorld(ID,GetPlayerVirtualWorld(playerid));
	SetPlayerInterior(ID,GetPlayerInterior(playerid));
	format(string,sizeof(string),"You have been teleported to %s(%d).",PlayerName(playerid),playerid);
	SendClientMessage(ID,0xFF0000AA,string);
	format(string,sizeof(string),"You have teleported %s(%d) to you.",PlayerName(ID),ID);
	SendClientMessage(playerid,0xFF0000AA,string);
	return 1;
}
change with this


Re: Admin command: /gethere [id] - ZCMD - MrBorsh - 07.07.2012

Quote:
Originally Posted by shayan122
Посмотреть сообщение
Код:
COMMAND:gethere(playerid, params[])
{
        if(!IsPlayerAdmin(playerid)) return 0;
        if(sscanf(params, "ui") return SendClientMessage(playerid, 0x333666, "Correct usage: /gethere [ID]");
        SetPlayerPos(ID,x+1,y,z);
	SetPlayerVirtualWorld(ID,GetPlayerVirtualWorld(playerid));
	SetPlayerInterior(ID,GetPlayerInterior(playerid));
	format(string,sizeof(string),"You have been teleported to %s(%d).",PlayerName(playerid),playerid);
	SendClientMessage(ID,0xFF0000AA,string);
	format(string,sizeof(string),"You have teleported %s(%d) to you.",PlayerName(ID),ID);
	SendClientMessage(playerid,0xFF0000AA,string);
	return 1;
}
change with this
Could you add a comment( // ) on each of the lines. What the following does, et cetra?


Re: Admin command: /gethere [id] - ZCMD - SnG.Scot_MisCuDI - 07.07.2012

I already did that for you MrBorsh..


Re: Admin command: /gethere [id] - ZCMD - shayan122 - 07.07.2012

Sure , Here:

Код:
COMMAND:gethere(playerid, params[]) //command
{
        if(!IsPlayerAdmin(playerid)) return 0; // check if player is admin
        if(sscanf(params, "ui") return SendClientMessage(playerid, 0x333666, "Correct usage: /gethere [ID]"); //USAGE
        SetPlayerPos(ID,x+1,y,z); // set player position that you bring
	SetPlayerVirtualWorld(ID,GetPlayerVirtualWorld(playerid)); // set virtual world (0)
	SetPlayerInterior(ID,GetPlayerInterior(playerid)); // if admin is in interior
	format(string,sizeof(string),"You have been teleported to %s(%d).",PlayerName(playerid),playerid); // message
	SendClientMessage(ID,0xFF0000AA,string);
	format(string,sizeof(string),"You have teleported %s(%d) to you.",PlayerName(ID),ID); //message
	SendClientMessage(playerid,0xFF0000AA,string);
	return 1;
}
// DONE :D
btw what is pawn code tag?


Re: Admin command: /gethere [id] - ZCMD - [ABK]Antonio - 07.07.2012

Quote:
Originally Posted by MrBorsh
Посмотреть сообщение
Could you add a comment( // ) on each of the lines. What the following does, et cetra?
pawn Код:
CMD:gethere(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return 0; //Stops the function from continuing if they aren't an admin.
    new target; //a variable to store our target in
    if(sscanf(params, "r", target)) return SendClientMessage(playerid, 0xCC0000AA, "USAGE: /gethere [player]"); //Checks if inside of the parameters string is a players ID or name
    new Float:tPos[3]; //we will store our players position in this array
    GetPlayerPos(playerid, tPos[0], tPos[1], tPos[2]); //here we grab the players position and store it in the array we previously created
    SetPlayerPos(target, tPos[0], tPos[1], tPos[2]); //we set the targets postion to the players position
    return 1;
}