#include <OnGBugAbuse>
public OnGBugAbuse(playerid,vehicleID)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,-1,"{ff0000}No G-Bug[Passenger Seat] Abuses.");
return 1;
}
Interesting, got a question why are you using a timer and not calling it automatically here?
Code:
SetTimerEx("OnGBugAbuse",1,false,"ii",playerid,vid); Code:
CallLocalFunction("OnGBugAbuse", "ii", playerid, vid); |
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(!IsPlayerInAnyVehicle(playerid))return 1;
if(GetPlayerState(playerid)!=PLAYER_STATE_PASSENGER)return 1;
new vid;
vid=GetPlayerVehicleID(playerid);
if(IsVehicleOccupiedByDriver(vid))return 1;
shots[playerid]++;
switch(weaponid)
{
case WEAPON_COLT45,WEAPON_SILENCED,WEAPON_DEAGLE:{if(shots[playerid]>=4)SetTimerEx("OnGBugAbuse",1,false,"ii",playerid,vid);}
case WEAPON_SNIPER,WEAPON_RIFLE,WEAPON_SHOTGUN,WEAPON_SAWEDOFF,WEAPON_SHOTGSPA:{if(shots[playerid]>=3)SetTimerEx("OnGBugAbuse",1,false,"ii",playerid,vid);}
case WEAPON_UZI,WEAPON_MP5,WEAPON_AK47,WEAPON_M4,WEAPON_TEC9,WEAPON_MINIGUN:{if(shots[playerid]>=5)SetTimerEx("OnGBugAbuse",1,false,"ii",playerid,vid);}
}
return 1;
}
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(!IsPlayerInAnyVehicle(playerid))return 1;
if(GetPlayerState(playerid)!=PLAYER_STATE_PASSENGER)return 1;
new vid;
vid=GetPlayerVehicleID(playerid);
if(IsVehicleOccupiedByDriver(vid))return 1;
shots[playerid]++;
switch(weaponid)
{
case WEAPON_COLT45,WEAPON_SILENCED,WEAPON_DEAGLE:{if(shots[playerid]>=4)OnGBugAbuse(playerid, vid);}
case WEAPON_SNIPER,WEAPON_RIFLE,WEAPON_SHOTGUN,WEAPON_SAWEDOFF,WEAPON_SHOTGSPA:{if(shots[playerid]>=3)OnGBugAbuse(playerid, vid);}
case WEAPON_UZI,WEAPON_MP5,WEAPON_AK47,WEAPON_M4,WEAPON_TEC9,WEAPON_MINIGUN:{if(shots[playerid]>=5)OnGBugAbuse(playerid, vid); }
}
return 1;
}