[Include] New CallBack!! [OnGBugAbuse(playerid,vehicleid)]
#1

OnGBugAbuse CallBack
Current Version: v1.0

Introduction
So you all must have seen often players press G and thne press H while in passenger state in a vehicle which
has no driver so if we try to shot that player he doesnt get killed and kills many player so prevent this; this
call back has been made by me. This is called when a player fires 3 shots in slow firing guns like Shot guns and
after four shots in fast guns like ak-47.
The purpose of calling it after 3 shots in slow firing guns and 4 shot in fast firing guns is that sometimes
driver gets killed while passenger is still in and was firing so if we call this calllback at first shot it
can be a false call too so it is called after some shots.

Using In A FS
This is an example code that can be used in FS--
pawn Code:
#include <OnGBugAbuse>
public OnGBugAbuse(playerid,vehicleID)
  {
     RemovePlayerFromVehicle(playerid);
     SendClientMessage(playerid,-1,"{ff0000}No G-Bug[Passenger Seat] Abuses.");
     return 1;
  }
Downlaod
Script can be foudn here -- pastebin.com/zKBGfhDS

Credits
SAMP Team -- For SAMP and PAWNO Compiler
****** -- For froeach.inc
BroZeus -- [Thats me!!] For scripting
Reply
#2

nice work
Reply
#3

Quote:
Originally Posted by Ralfie
View Post
Interesting, got a question why are you using a timer and not calling it automatically here?

Code:
SetTimerEx("OnGBugAbuse",1,false,"ii",playerid,vid);
as such?

Code:
CallLocalFunction("OnGBugAbuse", "ii", playerid, vid);
oops i forgot to change it there was something else i was testing with it forgot to change thanks for notice
Reply
#4

been silly to use timer, that was more advantageous to use.

pawn Code:
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;
}
change

pawn Code:
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;
}
include good outside and simple, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)