SA-MP Forums Archive
GetPlayerVehicleID help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: GetPlayerVehicleID help (/showthread.php?tid=260155)



GetPlayerVehicleID help - PCheriyan007 - 07.06.2011

Right now I'm working on a script where if a user crashes into this building with an andromada the building will go down. I used CreateDynamicCube to make an area for it but how do I make it so that it will check the players vehicle ID after he dies?


Re: GetPlayerVehicleID help - sleepysnowflake - 07.06.2011

Make a timer that will check : Player Vehicle ID, If is player in that specific zone and to check player health ^^. Run it every secounds or so.


Re: GetPlayerVehicleID help - *IsBack - 07.06.2011

it's impossible to check it AFTER player dies, because player gets removed from vehicle..


Re: GetPlayerVehicleID help - Ash. - 07.06.2011

Mm...

Use GetPlayerVehicleID in the OnPlayerDeath callback?

pawn Код:
pubilc OnPlayerDeath(playerid, killerid)
{
     return 1;
}
Store what is a returned in a global variable so that AFTER he dies the vehicle id will still be available in that variable.


Re: GetPlayerVehicleID help - PCheriyan007 - 07.06.2011

I'm really not sure how. Could someone give an example?


Re: GetPlayerVehicleID help - DRIFT_HUNTER - 07.06.2011

Create that building
Create gang zone a bit bigger than a building (about 5 meters bigger)
If player enter that gang zone get player vehicle id


Re: GetPlayerVehicleID help - sleepysnowflake - 07.06.2011

OnPlayerStreamIn maybe ?


Re: GetPlayerVehicleID help - PCheriyan007 - 07.06.2011

here's my code...
pawn Код:
public OnPlayerEnterDynamicArea(playerid, areaid)
{
    if(areaid == CommercialBuildingArea && GetPlayerVehicleID(playerid) == 592 && gTeam[playerid] == TEAM_TERRORIST)
    {
        AbleToBlowCommercialBuilding[playerid] = 1;
    }
}
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(AbleToBlowCommercialBuilding[playerid] == 1)
    {
        MoveDynamicObject(CommercialBuilding,1024.31127930,3727.24169922,-119.52521515,15);
        SendClientMessage(playerid, 0x00C7FFAA, "You have crashed your Andromada into the Commercial Building");
        AbleToBlowCommercialBuilding[playerid] = 0;
    }



Re: GetPlayerVehicleID help - Laronic - 07.06.2011

pawn Код:
public OnPlayerEnterDynamicArea(playerid, areaid)
{
    if(areaid == CommercialBuildingArea && GetPlayerVehicleID(GetPlayerVehicleID(playerid)) == 592 && gTeam[playerid] == TEAM_TERRORIST)
    {
        AbleToBlowCommercialBuilding[playerid] = 1;
    }
}
Or you can just use:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsInRangeOfPoint(...)
    {
        if(GetPlayerVehicleID(GetPlayerVehicleID(playerid)) ==  592 && gTeam[playerid] == TEAM_TERRORIST)
        {
            MoveObject(...);
        }
    }
    return 1;
}



Re: GetPlayerVehicleID help - PCheriyan007 - 07.06.2011

I could use that but as *IsBack pointed out, you can't get a player's vehicle id after he dies because it removes him from the vehicle.