cmd:goto stuffed -
Socan - 06.11.2012
When ever the admin does /goto it says they've teleported too that player but they acctually havn't.
Heres the code:
Код:
CMD:goto(playerid, params[])
{
new ID;
new pn[MAX_PLAYER_NAME];
new an[MAX_PLAYER_NAME];
new str[128];
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, "{F23A0D}USAGE: {AAAAAA}/goto (playerid)]");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xFF0000AA, "{F23A0D}ERROR: {AAAAAA}This player is not connected");
GetPlayerName(playerid, an, MAX_PLAYER_NAME);
GetPlayerName(ID, pn, MAX_PLAYER_NAME);
new Float:x;
new Float:y;
new Float:z;
if(IsPlayerInAnyVehicle(playerid))
{
GetPlayerPos(ID, x, y, z);
SetVehiclePos(playerid, x+1, y+1, z);
format(str, sizeof(str), "{AAAAAA}You have teleported to %s", pn);
SendClientMessage(playerid, 0x00FF00AA, str);
}
else
{
GetPlayerPos(ID, x, y, z);
SetPlayerPos(playerid, x+1, y+1, z);
format(str, sizeof(str), "{AAAAAA}You have teleported to %s", pn);
SendClientMessage(playerid, 0x00FF00AA, str);
}
return 1;
}
Re: cmd:goto stuffed -
RajatPawar - 06.11.2012
This should work well, I didn't test it though! Forgive me if it doesnt work/It isn't good enough.
Код:
CMD:gotoplayer(playerid,params[])
{
new targetid;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Unknown command.");
if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,-1,"Usage:/gotoplayer [Target player]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,"Non existant player.");
new Float:p[3];
GetPlayerPos(targetid,p[0],p[1],p[2]);
SetPlayerPos(playerid,p[0]+1,p[1]+1,p[2]+1);
return 1;
}
and similarly, the car tele too...
Re: cmd:goto stuffed -
-=Dar[K]Lord=- - 06.11.2012
pawn Код:
CMD:goto(playerid, params[])
{
new ID;
new pn[MAX_PLAYER_NAME];
new an[MAX_PLAYER_NAME];
new str[128];
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, "{F23A0D}USAGE: {AAAAAA}/goto (playerid)]");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xFF0000AA, "{F23A0D}ERROR: {AAAAAA}This player is not connected");
GetPlayerName(playerid, an, MAX_PLAYER_NAME);
GetPlayerName(ID, pn, MAX_PLAYER_NAME);
new Float:x;
new Float:y;
new Float:z;
GetPlayerPos(ID, x, y, z);
if(IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(playerid, x+1, y+1, z);
format(str, sizeof(str), "{AAAAAA}You have teleported to %s", pn);
SendClientMessage(playerid, 0x00FF00AA, str);
}
else
{
SetPlayerPos(playerid, x+1, y+1, z);
format(str, sizeof(str), "{AAAAAA}You have teleported to %s", pn);
SendClientMessage(playerid, 0x00FF00AA, str);
}
return 1;
}
Re: cmd:goto stuffed -
RedJohn - 06.11.2012
pawn Код:
CMD:goto(playerid, params[])
{
new ID;
new pn[MAX_PLAYER_NAME];
new an[MAX_PLAYER_NAME];
new str[128];
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, "{F23A0D}USAGE: {AAAAAA}/goto (playerid)]");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xFF0000AA, "{F23A0D}ERROR: {AAAAAA}This player is not connected");
GetPlayerName(playerid, an, MAX_PLAYER_NAME);
GetPlayerName(ID, pn, MAX_PLAYER_NAME);
new Float:x, Float:y, Float:z;
if(IsPlayerInAnyVehicle(playerid))
{
GetPlayerPos(ID, x, y, z);
SetVehiclePos(playerid, x+1, y+1, z);
format(str, sizeof(str), "{AAAAAA}You have teleported to %s", pn);
SendClientMessage(playerid, 0x00FF00AA, str);
return 1;
}
GetPlayerPos(ID, x, y, z);
SetPlayerPos(playerid, x+1, y+1, z);
format(str, sizeof(str), "{AAAAAA}You have teleported to %s", pn);
SendClientMessage(playerid, 0x00FF00AA, str);
return 1;
}