SA-MP Forums Archive
/gethere Command Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /gethere Command Problem (/showthread.php?tid=652299)



/gethere Command Problem - Lixyde - 07.04.2018

So, as the title says, i created the command /gethere, everything work but the teleportation not..

It says the message everything work, but the teleportation not.
Please help, i dont know why it happens like this

Code:
Код:
CMD:gethere(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,COLOR_GREY, "Трябва да сте поне 2 левел Админ!");
    new target;
    new Float:x, Float:y, Float:z;
    new name[MAX_PLAYER_NAME];
    new name2[MAX_PLAYER_NAME];
    new string[128];
    new string2[128];
    if(sscanf(params, "r", target)) return SendClientMessage(playerid, COLOR_WHITE, "Използвай: {FF1E00}/gethere {FFFFFF}[ID]");
    if(IsPlayerInAnyVehicle(playerid))
    {
          GetPlayerName(playerid, name, sizeof(name));
          GetPlayerName(target, name2, sizeof(name2));
	      GetPlayerPos(target, x, y, z);
	      SetVehiclePos(GetPlayerVehicleID(target), x+1, y+1, z+1);
	      format(string, sizeof(string), "Вие телепортирахте до вас {23FF00}%s{FFFFFF}!", name2);
          SendClientMessage(playerid, COLOR_WHITE, string);
          format(string2, sizeof(string2), "Вие бяхте телепортиран до {23FF00}%s{FFFFFF}!", name);
          SendClientMessage(target, COLOR_WHITE, string2);
    }
    else
    {
          GetPlayerName(playerid, name, sizeof(name));
          GetPlayerName(target, name2, sizeof(name2));
          GetPlayerPos(playerid, x, y, z);
          SetPlayerPos(target, x, y+1, z+1);
          format(string, sizeof(string), "Вие телепортирахте до вас {23FF00}%s{FFFFFF}!", name2);
          SendClientMessage(playerid, COLOR_WHITE, string);
          format(string2, sizeof(string2), "Вие бяхте телепортиран до {23FF00}%s{FFFFFF}!", name);
          SendClientMessage(target, COLOR_WHITE, string2);
	}
    return 1;
}
(Ignore bugged text, it is in bulgarian)


Re: /gethere Command Problem - ForCop - 07.04.2018

Quote:
Originally Posted by Lixyde
Посмотреть сообщение
So, as the title says, i created the command /gethere, everything work but the teleportation not..

It says the message everything work, but the teleportation not.
Please help, i dont know why it happens like this

Code:
Код:
CMD:gethere(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,COLOR_GREY, "Трябва да сте поне 2 левел Админ!");
    new target;
    new Float:x, Float:y, Float:z;
    new name[MAX_PLAYER_NAME];
    new name2[MAX_PLAYER_NAME];
    new string[128];
    new string2[128];
    if(sscanf(params, "r", target)) return SendClientMessage(playerid, COLOR_WHITE, "Използвай: {FF1E00}/gethere {FFFFFF}[ID]");
    if(IsPlayerInAnyVehicle(playerid))
    {
          GetPlayerName(playerid, name, sizeof(name));
          GetPlayerName(target, name2, sizeof(name2));
	      GetPlayerPos(target, x, y, z);
	      SetVehiclePos(GetPlayerVehicleID(target), x+1, y+1, z+1);
	      format(string, sizeof(string), "Вие телепортирахте до вас {23FF00}%s{FFFFFF}!", name2);
          SendClientMessage(playerid, COLOR_WHITE, string);
          format(string2, sizeof(string2), "Вие бяхте телепортиран до {23FF00}%s{FFFFFF}!", name);
          SendClientMessage(target, COLOR_WHITE, string2);
    }
    else
    {
          GetPlayerName(playerid, name, sizeof(name));
          GetPlayerName(target, name2, sizeof(name2));
          GetPlayerPos(playerid, x, y, z);
          SetPlayerPos(target, x, y+1, z+1);
          format(string, sizeof(string), "Вие телепортирахте до вас {23FF00}%s{FFFFFF}!", name2);
          SendClientMessage(playerid, COLOR_WHITE, string);
          format(string2, sizeof(string2), "Вие бяхте телепортиран до {23FF00}%s{FFFFFF}!", name);
          SendClientMessage(target, COLOR_WHITE, string2);
	}
    return 1;
}
(Ignore bugged text, it is in bulgarian)
Код:
change if(sscanf(params, "r", target)) on if(sscanf(params, "i", target))



Re: /gethere Command Problem - Mugala - 07.04.2018

if you're using different interiors and worlds, I suggest to get player's current virtual world and interior.


Re: /gethere Command Problem - Logic_ - 07.04.2018

"u" instead of "r" in sscanf line. Not "i" as suggested above.