Need help with vehicle scripting please
#2

You could create a per-player global variable for this:

pawn Код:
new Entered_AT400_ID[MAX_PLAYERS];

// When he enters a AT400 successfully
Entered_AT400_ID[playerid] = vehicleid; // the AT400 ID
// And this is an example of getting the position of a player's AT400
new Float:vPos[3];
GetVehiclePos(Entered_AT400_ID[playerid], vPos[0], vPos[1], vPos[2]);

Somethings you may need to take care of:

- If you have a vehicle locking system, then check if a vehicle is unlocked on /enter.
- When a player exits a AT400, check if their Z position is high enough and then give them a parachute.
- When a AT400 explodes, you may want to kill the players inside it. Example:

pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
    // loop through all players once a vehicle dies
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if(!IsPlayerConnected(i) || IsPlayerNPC(i))
            continue; // will skip if they are not connected or are NPCs

        if(Entered_AT400_ID[i] == vehicleid) // if the dead vehicle is a player's AT400
        {
            SetPlayerHealth(i, 0.0); // Kill them?
        }
    }
    return 1;
}
Reply


Messages In This Thread
Need help with vehicle scripting please - by iSkull - 29.01.2013, 09:10
Re: Need help with vehicle scripting please - by [KHK]Khalid - 29.01.2013, 09:44
Re: Need help with vehicle scripting please - by iSkull - 29.01.2013, 09:50
Re: Need help with vehicle scripting please - by [KHK]Khalid - 29.01.2013, 10:24
Re: Need help with vehicle scripting please - by iSkull - 29.01.2013, 11:39

Forum Jump:


Users browsing this thread: 1 Guest(s)