SA-MP Forums Archive
can someone help me with this? - 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: can someone help me with this? (/showthread.php?tid=129752)



can someone help me with this? - TheChaoz - 23.02.2010

hi, i have a andti drive-by that had a bug.
this are the lines that i think that have te problem:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  new vehicleid=GetPlayerVehicleID(playerid);
    if(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0 && IsDDBVehicle(vehicleid)){
phe problem is that if u get in the car normaly using enter/f the anti DB, works perfectly, but if u use the carspawner it dont work.
can someone help me please?

PD: Sorry for my bad english


Re: can someone help me with this? - Rizard - 23.02.2010

Try instead of

pawn Код:
IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0
pawn Код:
new state = GetPlayerState(playerid);
if(state == PLAYER_STATE_DRIVER ... )



Re: can someone help me with this? - TheChaoz - 23.02.2010

Quote:
Originally Posted by Rizard
Try instead of

pawn Код:
IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0
pawn Код:
new state = GetPlayerState(playerid);
if(state == PLAYER_STATE_DRIVER ... )
same problem


Re: can someone help me with this? - wafffllesss - 23.02.2010

Quote:
Originally Posted by the_chaoz
Quote:
Originally Posted by Rizard
Try instead of

pawn Код:
IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0
pawn Код:
new state = GetPlayerState(playerid);
if(state == PLAYER_STATE_DRIVER ... )
same problem
Use: OnPlayerStateChange.
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate){
  if(newstate == PLAYER_STATE_DRIVER && IsDDBVehicle(vehicleid)){
     ... do your things.
  }
}



Re: can someone help me with this? - BlackFoX - 23.02.2010

Another Method...

Код:
new playa_ammo[MAX_PLAYERS][13];
new playa_weapon[MAX_PLAYERS][13];
>> OnPlayerEnterVehicle

Код:
for(new i = 0;i<13;i++)GetPlayerWeaponData(playerid, i, playa_weapon[playerid][i], playa_ammo[playerid][i]);
ResetPlayerWeapons(playerid);
>> OnPlayerExitVehicle
Код:
for(new i = 0;i<13;i++)GivePlayerWeapon(playerid,playa_weapon[playerid][i],playa_ammo[playerid][i]);



Re: can someone help me with this? - TheChaoz - 23.02.2010

No, i need the event to be OnPlayerKeyStateChange