anti drive by thing
#4

Okey, I made the code for you. Was easier that I thought.

pawn Код:
new PlayerWeaponDetails[MAX_PLAYERS][13][2];
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER /*|| newstate == PLAYER_STATE_PASSENGER*/) //Just remove the ''/*'' ''*/'' and it works for Passenger too.
    {
        for (new i = 0; i < 13; i++) PlayerWeaponDetails[playerid][i][0]=0, PlayerWeaponDetails[playerid][i][1]=0;
        for (new i = 0; i < 13; i++) GetPlayerWeaponData(playerid, i, PlayerWeaponDetails[playerid][i][0], PlayerWeaponDetails[playerid][i][1]);
        ResetPlayerWeapons(playerid);
    }
    if(oldstate == PLAYER_STATE_DRIVER /*|| newstate == PLAYER_STATE_PASSENGER*/) //Same here.
    {
        if(newstate == PLAYER_STATE_ONFOOT)
        {
            for (new i = 0; i < 13; i++) GivePlayerWeapon(playerid, PlayerWeaponDetails[playerid][i][0], PlayerWeaponDetails[playerid][i][1]);
        }
    }
    return 1;
}
Note: I've tested the code, and the weapon ammo is not always correct. I think that there is a mistake in the function "GetPlayerWeaponData".

Just test the code yourself, and give me your opinion.

Greetz.
Reply


Messages In This Thread
anti drive by thing - by nejc001 - 08.10.2010, 15:28
Re: anti drive by thing - by Jeffry - 08.10.2010, 15:32
Re: anti drive by thing - by nejc001 - 09.10.2010, 11:21
Re: anti drive by thing - by Jeffry - 09.10.2010, 14:15
Re: anti drive by thing - by nejc001 - 10.10.2010, 17:37
Re: anti drive by thing - by Jeffry - 11.10.2010, 11:29

Forum Jump:


Users browsing this thread: 1 Guest(s)