02.08.2015, 20:00
Please help me with command /gethere.
dcmd_gethere(playerid,params[])
{
new string[128];
new ID;
if(sscanf(params,"u",ID))
{
SendClientMessage(playerid,-1,"{CACA00}[INFO]{FFFFFF}: /bring (Player Name/ID)");
return 1;
}
if(ID == INVALID_PLAYER_ID)
{
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot bring them.",ID);
SendClientMessage(playerid,-1,string);
return 1;
}
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
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,-1,string);
format(string,sizeof(string),"You have teleported %s(%d) to you.",PlayerName(ID),ID);
SendClientMessage(playerid,-1,string);
return 1;
}
|
So you want a cmd that teleports the desired player to your location?
Код:
dcmd_gethere(playerid,params[])
{
new string[128];
new ID;
if(sscanf(params,"u",ID))
{
SendClientMessage(playerid,-1,"{CACA00}[INFO]{FFFFFF}: /bring (Player Name/ID)");
return 1;
}
if(ID == INVALID_PLAYER_ID)
{
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot bring them.",ID);
SendClientMessage(playerid,-1,string);
return 1;
}
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
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,-1,string);
format(string,sizeof(string),"You have teleported %s(%d) to you.",PlayerName(ID),ID);
SendClientMessage(playerid,-1,string);
return 1;
}
|
#include <zcmd>
CMD:gethere(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, 0xFF0606FF, "[ERROR] You are not an admin!");
new Float:x,Float:y,Float:z,playerb,str[128];
if(sscanf(params,"u",playerb)) return SendClientMessage(playerid, 0x33AA33FF, "[USAGE]: /get [id]");
if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, 0xFF0606FF, "[ERROR] Invalid player id!");
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(playerb,x,y,z);
SetPlayerInterior(playerb, GetPlayerInterior(playerid));
SetPlayerVirtualWorld(playerb, GetPlayerVirtualWorld(playerid));
format(str,sizeof(str), "Admin %s has teleported you.", Name(playerid));
SendClientMessage(playerb, 0xFFFF00FF, str);
format(str,sizeof(str), " Successfully teleported %s to you.", Name(playerb));
SendClientMessage(playerid, 0xFF00AEFF, str);
return 1;
}