Interior and exterior cmds
#1

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

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)