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;
}
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;
}
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; }
Код:
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; } |
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
Could you add a comment( // ) on each of the lines. What the following does, et cetra?
|
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;
}