[Include] OnPlayerShotTeamVeh - Detects if player shoots team mate's vehicle
#1

OnPlayerShotTeamVeh
Introduction
This include can check if a player is shooting his team mate's vehicle. Easy and simple but will be useful in RP servers.

Functions
Код:
forward OnPlayerShotTeamVeh(playerid, targetid, weaponid, vehid);
Where to use it
On many RP servers, you don't want a player to shoot his team player's tire/vehicle. On that case you can return 0 to apply no effect.

Example code
pawn Код:
public OnPlayerShotTeamVeh(playerid, targetid, weaponid, vehid)
{
     new String[400];
     new name[MAX_PLAYER_NAME];
     new tname[MAX_PLAYER_NAME];
       
     GetPlayerName(playerid, name, sizeof(name));
     GetPlayerName(playerid, tname, sizeof(tname));

     format(String, sizeof( String ), "%s has shoted %s who is in vehicleid %i with weaponid %i", name, tname, vehid, weaponid);
     SendClientMessageToAll(0xFF0000FF, String);
}
pawn Код:
public OnPlayerShotTeamVeh(playerid, targetid, weaponid, vehid)
{
     new vehicle;
     new Float:health;
   
     vehicle = GetPlayerVehicleID(targetid);
     GetVehicleHealth(vehicle, health);
     SetVehicleHealth(vehicle, health);
}
Download
Maximus
MediaFire
PasteBin
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)