SA-MP Forums Archive
exit command help REP+ - 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: exit command help REP+ (/showthread.php?tid=365837)



exit command help REP+ - Dare Devil..... - 04.08.2012

I wanted that when player exits the garage his car also exits it but when I did it Player exits the place and vehicles stays in
MY code

pawn Код:
else if(IsPlayerInRangeOfPoint(playerid, 3.0,-1615.0665,745.6644,-5.2422))
        {
            if(PlayerInfo[playerid][SFCMS] == 0) return 1;
            if(PlayerInfo[playerid][SFCS] == 0) return 1;
            SetPlayerPos(playerid,-2655.5515,398.4762,4.3359);//Enter SD EMS GARAGE
            new vehicleid = GetPlayerVehicleID(playerid);
            SetVehiclePos(vehicleid, -1615.0665,745.6644,-5.2422);
        }
Help please I need help fast


Re: exit command help REP+ - TaLhA XIV - 04.08.2012

Use SetVehiclePos. I wonder why is this not working.


Re: exit command help REP+ - Syntax - 04.08.2012

Do you have any variables that will define if the vehicle is inside the garage or not..?


Re: exit command help REP+ - Dragony92 - 04.08.2012

pawn Код:
else if(IsPlayerInRangeOfPoint(playerid, 3.0,-1615.0665,745.6644,-5.2422))
            {
                if(PlayerInfo[playerid][SFCMS] == 0) return 1;
                if(PlayerInfo[playerid][SFCS] == 0) return 1;
                if(GetPlayerState(playerid) == 2)
                {
                    new tmpcar = GetPlayerVehicleID(playerid);
                    SetVehiclePos(tmpcar, -1615.0665,745.6644,-5.2422);
                }
                else
                {
                    SetPlayerPos(playerid, -2655.5515,398.4762,4.3359);
                    SetPlayerVirtualWorld(playerid, 0);
                }
            }



Re: exit command help REP+ - Dare Devil..... - 04.08.2012

No I dont have any variables the cmd I showed you is all what I have


Re: exit command help REP+ - Ranama - 04.08.2012

you set the players pos before you are getting the carid of the player, with means that you are teleporting the player out of the car and then tries to check what car he is in, with will return 0 and you won't tp any car out.

Dragony92's code should work


Re: exit command help REP+ - Devilxz97 - 04.08.2012

pawn Код:
CMD:exit(playerid, params[])
{
    new pstate = GetPlayerState(playerid);
    new vehicleid = GetPlayerVehicleID(playerid);
    if(IsPlayerInRangeOfPoint(playerid, 3.0,-1615.0665,745.6644,-5.2422))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(PlayerInfo[playerid][SFCMS] == 0) return 1;
            if(PlayerInfo[playerid][SFCS] == 0) return 1;
            if(pstate == PLAYER_STATE_DRIVER)
            {
                SetVehiclePos(vehicleid, -1615.0665,745.6644,-5.2422);
                PutPlayerInVehicle(playerid, vehicleid, 0);
            }
            else
            {
                SetPlayerPos(playerid, -2655.5515,398.4762,4.3359);
                SetPlayerVirtualWorld(playerid, 0);
                SetPlayerInterior(playerid, 0);
            }
        }
    }
    return 1;
}
try this


Re: exit command help REP+ - Ranama - 04.08.2012

Quote:
Originally Posted by Devilxz97
Посмотреть сообщение
pawn Код:
CMD:exitgarage(playerid, params[])
{
    new pstate = GetPlayerState(playerid);
    new vehicleid = GetPlayerVehicleID(playerid);
    if(IsPlayerInRangeOfPoint(playerid, 3.0,-1615.0665,745.6644,-5.2422))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(pstate == PLAYER_STATE_DRIVER)
            {
                if(PlayerInfo[playerid][SFCMS] == 0) return 1;
                if(PlayerInfo[playerid][SFCS] == 0) return 1;
                SetVehiclePos(vehicleid, -1615.0665,745.6644,-5.2422);
                PutPlayerInVehicle(playerid, vehicleid, 0);
            }
        }
    }
    return 1;
}
If you use that code you won't be able to exit the garage if you aren't in a car, better use Dragony92's code I think.


Re: exit command help REP+ - Dare Devil..... - 04.08.2012

Quote:
Originally Posted by Dragony92
Посмотреть сообщение
pawn Код:
else if(IsPlayerInRangeOfPoint(playerid, 3.0,-1615.0665,745.6644,-5.2422))
            {
                if(PlayerInfo[playerid][SFCMS] == 0) return 1;
                if(PlayerInfo[playerid][SFCS] == 0) return 1;
                if(GetPlayerState(playerid) == 2)
                {
                    new tmpcar = GetPlayerVehicleID(playerid);
                    SetVehiclePos(tmpcar, -1615.0665,745.6644,-5.2422);
                }
                else
                {
                    SetPlayerPos(playerid, -2655.5515,398.4762,4.3359);
                    SetPlayerVirtualWorld(playerid, 0);
                }
            }
REP +