cmd:goto stuffed
#1

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)