exit command help REP+
#1

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

Use SetVehiclePos. I wonder why is this not working.
Reply
#3

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

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);
                }
            }
Reply
#5

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

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

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

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.
Reply
#9

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 +
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)