SA-MP Forums Archive
GetPlayerInterior - 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: GetPlayerInterior (/showthread.php?tid=514918)



GetPlayerInterior - Ananisiki - 24.05.2014

This no work, i goto a bot in interior but i just fall down in map, no work

pawn Код:
new Float:x, Float:y, Float:z;
    GetPlayerPos(pID, x, y, z);
    if(IsPlayerInAnyVehicle(pID)) SetPlayerPos(playerid, x, y, z+1.6);
    else
    {
        switch(random(3))
        {
            case 0: SetPlayerPos(playerid, x + 1.5, y, z);
            case 1: SetPlayerPos(playerid, x, y + 1.5, z);
            case 2: SetPlayerPos(playerid, x+0.7, y+0.7, z+1);
        }
    }
    SetPlayerInterior(playerid, GetPlayerInterior(pID));
    SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(pID));



Re: GetPlayerInterior - zPain - 24.05.2014

You must set the interior before the position.


Re: GetPlayerInterior - Ananisiki - 26.05.2014

It the same....


Re: GetPlayerInterior - Ananisiki - 27.05.2014

Bump


Re: GetPlayerInterior - kamiliuxliuxliux - 27.05.2014

Why do you set player's interior to the same and world to the same?


Re: GetPlayerInterior - Ananisiki - 28.05.2014

Quote:
Originally Posted by kamiliuxliuxliux
Посмотреть сообщение
Why do you set player's interior to the same and world to the same?
What

pID = target and playerid is the admin


Re: GetPlayerInterior - kamiliuxliuxliux - 28.05.2014

Oww, now I understand


Re: GetPlayerInterior - Threshold - 28.05.2014

That should work...
pawn Код:
new Float:x, Float:y, Float:z;
    SetPlayerInterior(playerid, GetPlayerInterior(pID));
    SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(pID));
    GetPlayerPos(pID, x, y, z);
    if(IsPlayerInAnyVehicle(pID)) SetPlayerPos(playerid, x, y, z+1.6);
    else switch(random(3))
    {
        case 0: SetPlayerPos(playerid, x + 1.5, y, z);
        case 1: SetPlayerPos(playerid, x, y + 1.5, z);
        case 2: SetPlayerPos(playerid, x+0.7, y+0.7, z+1);
    }
Otherwise, if you really want to make it foolproof:
pawn Код:
new Float:x, Float:y, Float:z;
    TogglePlayerControllable(playerid, false);
    SetPlayerInterior(playerid, GetPlayerInterior(pID));
    SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(pID));
    GetPlayerPos(pID, x, y, z);
    if(IsPlayerInAnyVehicle(pID)) SetPlayerPos(playerid, x, y, z+1.6);
    else switch(random(3))
    {
        case 0: SetPlayerPos(playerid, x + 1.5, y, z);
        case 1: SetPlayerPos(playerid, x, y + 1.5, z);
        case 2: SetPlayerPos(playerid, x+0.7, y+0.7, z+1);
    }
    SetTimerEx("UnfreezePlayer", 1000, false, "i", playerid);
At the bottom of your script:
pawn Код:
forward UnfreezePlayer(playerid);
public UnfreezePlayer(playerid) return TogglePlayerControllable(playerid, true);
--

If that doesn't work, the problem is with WHERE you are teleporting the player in terms of the bot, you could be teleporting outside the interior's walls etc, or the interior itself might not be solid. (For whatever reason that might be...)