SA-MP Forums Archive
Interior and exterior cmds - 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: Interior and exterior cmds (/showthread.php?tid=502205)



Interior and exterior cmds - LilBob - 22.03.2014

Hey guys,

I've a taxi NPC system and I'm scripting two cmds. I mapped interiors for the taxis et I want to the players they can look out with the command /dehors.

It works indeed, here is the cmd:


pawn Код:
if(strcmp("/dehors", cmdtext, true) == 0)
    {
        if(!IsPlayerInRangeOfPoint(playerid, 10, 2021.9390,2241.9487,2103.9536))
        {
            SendClientMessage(playerid, COLOR_RED, "Tu n'es pas dans un taxi.");
            return 1;
        }
        GetPlayerPos(playerid, Playerx[playerid], Playery[playerid], Playerz[playerid]);
        GetPlayerFacingAngle(playerid, Playera[playerid]);
        PlayerSkin[playerid] = GetPlayerSkin(playerid);
        SetPlayerInterior(playerid, 0);
        SetPlayerVirtualWorld(playerid, 0);
        TogglePlayerSpectating(playerid, 1);
        if(TaxiID[playerid] == 1)
        {
            PlayerSpectateVehicle(playerid, Taxi2);
        }
        else
        {
            PlayerSpectateVehicle(playerid, Taxi);
        }
        SetTimerEx("ResetView", 2000, 0, "d", playerid);
        return 1;
    }

And this one is to go back to the view inside the taxi but it doesn't works.

pawn Код:
if(strcmp("/dedans", cmdtext, true) == 0)
    {
        GetPlayerPos(playerid, Playerx[playerid], Playery[playerid], Playerz[playerid]);
        GetPlayerFacingAngle(playerid, Playera[playerid]);
        PlayerSkin[playerid] = GetPlayerSkin(playerid);
        SetPlayerInterior(playerid, 0);
        SetPlayerVirtualWorld(playerid, 0);
        TogglePlayerSpectating(playerid, 0);
        SetTimerEx("ResetView", 2000, 0, "d", playerid);
        return 1;
    }
Can anyone help me ? Thanks a lot


Re: Interior and exterior cmds - Sascha - 22.03.2014

pawn Код:
if(strcmp("/dedans", cmdtext, true) == 0)
    {
        GetPlayerPos(playerid, Playerx[playerid], Playery[playerid], Playerz[playerid]); //senseless
        GetPlayerFacingAngle(playerid, Playera[playerid]); //senseless
        PlayerSkin[playerid] = GetPlayerSkin(playerid);
        SetPlayerInterior(playerid, 0);
        SetPlayerVirtualWorld(playerid, 0);
        TogglePlayerSpectating(playerid, 0);
//and now?... you need to set a position of where player should be then, he "respawns" basicly"
        SetTimerEx("ResetView", 2000, 0, "d", playerid);
        return 1;
    }
after "TogglePlayerSpectating" you need to tell the server where to set this player... Stopping spectating basicly just spawns the player... You need to use a "SetPlayerPos" to get the player back into the interior


Re : Interior and exterior cmds - LilBob - 23.03.2014

Of course but then he could use the command where ever he is :/