Full filter script to enter RC-s, also includes the thingy where you can tow vehicles and shoot with RC tiger, just copy this, paste in pawno and save in Filterscripts folder, later add it to server.cfg:
Код:
#include <a_samp>
#define COLOR_RED 0xFF0000FF
new Float:X,Float:Y,Float:Z;
new PlayerIsInShamal[MAX_PLAYERS],ShamalID[MAX_PLAYERS];
public OnFilterScriptInit()
{
print("\n----------------------------------------");
print(" Vehicles Utilities by zofa LOADED");
print("----------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
print("\n-----------------------------------------");
print(" Vehicles Utilities by zofa UNLOADED");
print("-----------------------------------------\n");
return 1;
}
stock IsRCVehicle(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 501,464,441,465,564: return 1;
}
return 0;
}
stock Float:GetXYInFrontOfPlayer(playerid, &Float:xx, &Float:yy, Float:distance)
{
new Float:a;
GetPlayerPos(playerid, xx, yy, a);
if (IsPlayerInAnyVehicle(playerid))
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
else
GetPlayerFacingAngle(playerid, a);
xx += (distance * floatsin(-a, degrees));
yy += (distance * floatcos(-a, degrees));
return a;
}
stock IsVehicleInRangeOfPoint(vehicleid, Float:range, Float:x, Float:y, Float:z)
{
new Float:px,Float:py,Float:pz;
GetVehiclePos(vehicleid,px,py,pz);
px -= x;
py -= y;
pz -= z;
return ((px * px) + (py * py) + (pz * pz)) < (range * range);
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
for(new v=0;v<MAX_VEHICLES; v++)
{
GetPlayerPos(playerid,X,Y,Z);
if (newkeys == KEY_FIRE && oldkeys != KEY_FIRE && GetPlayerState(playerid)==PLAYER_STATE_DRIVER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 525 && IsVehicleInRangeOfPoint(v, 7, X, Y, Z))
{
if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
{
AttachTrailerToVehicle(v,GetPlayerVehicleID(playerid));
}
else
{
DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
}
}
if (newkeys == KEY_FIRE && oldkeys != KEY_FIRE && GetPlayerState(playerid)==PLAYER_STATE_DRIVER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 564)
{
GetXYInFrontOfPlayer(playerid, X, Y, 15);
CreateExplosion(X,Y,Z,12,3);
}
if (newkeys == KEY_SECONDARY_ATTACK && oldkeys != KEY_SECONDARY_ATTACK && IsVehicleInRangeOfPoint(v, 2, X, Y, Z) && IsRCVehicle(v))
{
if(!IsPlayerInAnyVehicle(playerid))
{
PutPlayerInVehicle(playerid,v,0);
}
else
{
RemovePlayerFromVehicle(playerid);
SetPlayerPos(playerid,X,Y,Z+0.5);
}
}
if (newkeys == KEY_SECONDARY_ATTACK && oldkeys != KEY_SECONDARY_ATTACK && PlayerIsInShamal[playerid] == 1)
{
GetVehiclePos(ShamalID[playerid], X, Y, Z);
RemovePlayerFromVehicle(playerid);
SetPlayerPos(playerid,X+5,Y+5,Z+1);
SetPlayerInterior(playerid,0);
GivePlayerWeapon(playerid,46,1);
PlayerIsInShamal[playerid] = 0;
}
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if (ispassenger && GetVehicleModel(vehicleid) == 519)
{
SetPlayerPos(playerid,2.384830,33.103397,1199.849976);
SetPlayerInterior(playerid,1);
PlayerIsInShamal[playerid] = 1;
ShamalID[playerid] = vehicleid;
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerIsInShamal[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
PlayerIsInShamal[playerid] = 0;
return 1;
}
public OnVehicleDeath(vehicleid)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(GetVehicleModel(vehicleid) == 519 && PlayerIsInShamal[i] == 1)
{
SetPlayerHealth(i, 0);
SendClientMessage(i, COLOR_RED, ">>> The plane has been destroyed.");
PlayerIsInShamal[i] = 0;
}
}
return 1;
}
//End Of File