Admin command: /gethere [id] - ZCMD
#1

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;
}
Reply
#2

Are you getting errors, or what,
Reply
#3

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)
Reply
#4

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.
Reply
#5

And please post the errors..
Reply
#6

Код:
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
Reply
#7

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?
Reply
#8

I already did that for you MrBorsh..
Reply
#9

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?
Reply
#10

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)