Detecting if a player is in their owned vehicle REP+
#18

Quote:
Originally Posted by Fj0rtizFredde
Посмотреть сообщение
Because PlayerInfo[playerid][Vehicle] stores the model of the vehicle and not the id.
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == PlayerInfo[playerid][Vehicle])
{
    //code
}
my fault, thought vehilce was the id

My way of doing this:

pawn Код:
CMD:park(playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][Vehkey] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][Vehkey2] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][Vehkey3]))
        {
            new videoid = GetPlayerVehicleID(playerid)
            new Float:ux, Float:uy, Float:uz, Float:angle;
            new string[128], vehicle[24];
            GetVehicleName(videoid, vehicle, sizeof(vehicle));
            GetPlayerFacingAngle(playerid, angle);
            GetPlayerPos(playerid, ux, uy, uz);
            format(file4, sizeof(file4), "realityrp/vehicles/%d.ini", videoid);
            dini_FloatSet(file4, "vehx", ux);
            dini_FloatSet(file4, "vehy", uy);
            dini_FloatSet(file4, "vehz", uz);
            dini_FloatSet(file4, "rot", angle);
            format(string, sizeof(string), "You parked your %s here! ((It will respawn here on death))", vehicle);
            SendClientMessage(playerid, COLOR_GREEN, string);
            return 1;
        }
        else return SendClientMessage(playerid, COLOR_GREY, "This is not your vehicle!");
    }
    else return SendClientMessage(playerid, COLOR_GREY, "You are not in your vehicle!");
}
Reply


Messages In This Thread
Detecting if a player is in their owned vehicle REP+ - by Azzeto - 30.01.2012, 10:38
Re: Detecting if a player is in their owned vehicle REP+ - by milanosie - 30.01.2012, 10:39
Re: Detecting if a player is in their owned vehicle REP+ - by Azzeto - 30.01.2012, 10:40
Re: Detecting if a player is in their owned vehicle REP+ - by milanosie - 30.01.2012, 10:43
Re: Detecting if a player is in their owned vehicle REP+ - by milanosie - 30.01.2012, 10:46
Re: Detecting if a player is in their owned vehicle REP+ - by Azzeto - 30.01.2012, 10:48
Re: Detecting if a player is in their owned vehicle REP+ - by milanosie - 30.01.2012, 10:55
Re: Detecting if a player is in their owned vehicle REP+ - by Azzeto - 30.01.2012, 10:56
Re: Detecting if a player is in their owned vehicle REP+ - by Unte99 - 30.01.2012, 11:12
Re: Detecting if a player is in their owned vehicle REP+ - by DRIFT_HUNTER - 30.01.2012, 11:35
Re: Detecting if a player is in their owned vehicle REP+ - by Azzeto - 30.01.2012, 20:55
Re: Detecting if a player is in their owned vehicle REP+ - by Azzeto - 01.02.2012, 04:01
Re: Detecting if a player is in their owned vehicle REP+ - by Azzeto - 02.02.2012, 19:08
Re: Detecting if a player is in their owned vehicle REP+ - by milanosie - 02.02.2012, 19:18
Re: Detecting if a player is in their owned vehicle REP+ - by Azzeto - 02.02.2012, 19:32
Re: Detecting if a player is in their owned vehicle REP+ - by milanosie - 02.02.2012, 19:37
Re: Detecting if a player is in their owned vehicle REP+ - by Fj0rtizFredde - 02.02.2012, 19:38
Re: Detecting if a player is in their owned vehicle REP+ - by milanosie - 02.02.2012, 19:39
Re: Detecting if a player is in their owned vehicle REP+ - by Azzeto - 02.02.2012, 19:42

Forum Jump:


Users browsing this thread: 1 Guest(s)