Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //this filterscript is made by EzeeCube, I don't care for credits if you need any help add me on skype peroplazar.
- //you are free to give me some reputation in samp forum xD
- #include <a_samp>
- #include <foreach>
- #define MODEL_ERROR 0
- #define MODEL_CAR 1
- #define MODEL_BIKE 2
- #define MODEL_MBIKE 3
- #define MODEL_BOAT 4
- #define MODEL_PLANE 5
- #define ATTACH_PLAYER_SEATBELT 19314
- #define ATTACH_PLAYER_HELMET1 18978
- #define ATTACH_PLAYER_HELMET2 19102
- #define COLOR_PURPLE 0xC2A2DAAA
- new VehicleSafety[MAX_PLAYERS];
- forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
- stock GetName(playerid)
- {
- new name[24]; GetPlayerName(playerid, name, 24); return name;
- }
- stock IsVehicleModel(modelid)//0 - error, 1 - car, 2 - bike, 3 - boat, 4 - plane/heli
- {
- //hidroplane
- switch(modelid)
- {
- case 0: return MODEL_ERROR;
- case 481,509,510: return MODEL_BIKE;
- case 448,461,462,463,468,471,521,522,523,581,586: return MODEL_MBIKE;
- case 430,446,452,453,454,472,473,484,493,595: return MODEL_BOAT;
- case 417,425,447,460,469,476,487,488,497,511,512,513,519,520,548,553,563,577,592,593: return MODEL_PLANE;
- default: return MODEL_CAR;
- }
- return 0;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- if(newstate == PLAYER_STATE_ONFOOT)
- {
- if(VehicleSafety[playerid] != 0)
- {
- new string[128];
- if(VehicleSafety[playerid] == 1) format(string, sizeof(string), "* %s reaches for their seatbelt, and unbuckles it.", GetName(playerid)), RemovePlayerAttachedObject(playerid,9);
- else if(VehicleSafety[playerid] == 2) format(string, sizeof(string), "* %s reaches for their helmet, and takes it off.", GetName(playerid)), RemovePlayerAttachedObject(playerid,9);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
- VehicleSafety[playerid] = 0;
- RemovePlayerAttachedObject(playerid,9);
- }
- }
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- if(VehicleSafety[playerid] != 0)
- {
- new string[128];
- if(VehicleSafety[playerid] == 1) format(string, sizeof(string), "* %s reaches for their seatbelt, and unbuckles it.", GetName(playerid)), RemovePlayerAttachedObject(playerid,9);
- else if(VehicleSafety[playerid] == 2) format(string, sizeof(string), "* %s reaches for their helmet, and takes it off.", GetName(playerid)), RemovePlayerAttachedObject(playerid,9);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
- VehicleSafety[playerid] = 0;
- RemovePlayerAttachedObject(playerid,9);
- }
- return 1;
- }
- public OnVehicleDamageStatusUpdate(vehicleid, playerid)
- {
- new Float: v_HP;
- GetVehicleHealth(vehicleid, v_HP);
- new Float: p_HP;
- GetPlayerHealth(playerid, p_HP);
- if(VehicleSafety[playerid] == 1) SetPlayerHealth(playerid, p_HP - 1);
- else SetPlayerHealth(playerid, p_HP - 10);
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- new string[128];
- if(newkeys & KEY_YES)
- {
- if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT)
- {
- new vehid = GetPlayerVehicleID(playerid);
- new model = GetVehicleModel(vehid);
- new vehicletype = IsVehicleModel(model);
- if(IsVehicleModel(model) == MODEL_CAR || vehicletype == MODEL_BIKE || vehicletype == MODEL_MBIKE)
- {
- if(VehicleSafety[playerid] == 0)
- {
- if(vehicletype == MODEL_BIKE) SetPlayerAttachedObject(playerid,9,ATTACH_PLAYER_HELMET2,2,0.15,0.00,0.00,0.0,0.0,0.0,1.14,1.10,1.11), format(string, sizeof(string), "* %s reaches for their helmet, and takes it on.", GetName(playerid)), VehicleSafety[playerid] = 2;
- else if(vehicletype == MODEL_MBIKE) SetPlayerAttachedObject(playerid,9,ATTACH_PLAYER_HELMET1,2,0.06,0.02,0.00,0.0,89.0,89.0,1.10,0.89,1.00), format(string, sizeof(string), "* %s reaches for their helmet, and takes it on.", GetName(playerid)), VehicleSafety[playerid] = 2;
- else if(vehicletype == MODEL_CAR) SetPlayerAttachedObject(playerid,9,ATTACH_PLAYER_SEATBELT,1,0.07,0.21,-0.00,-21.0,-54.0,183.0,0.39,0.40,0.31), format(string, sizeof(string), "* %s reaches for their seatbelt, and buckles it.", GetName(playerid)), VehicleSafety[playerid] = 1;
- }
- else if(VehicleSafety[playerid] == 1 || VehicleSafety[playerid] == 2)
- {
- VehicleSafety[playerid] = 0;
- RemovePlayerAttachedObject(playerid,9);
- if(vehicletype == MODEL_BIKE) format(string, sizeof(string), "* %s reaches for their helmet, and takes it off.", GetName(playerid));
- else if (vehicletype == MODEL_MBIKE) format(string, sizeof(string), "* %s reaches for their helmet, and takes it off.", GetName(playerid));
- else if(vehicletype == MODEL_CAR) format(string, sizeof(string), "* %s reaches for their seatbelt, and unbuckles it.", GetName(playerid));
- }
- ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
- return 1;
- }
- }
- }
- return 1;
- }
- public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:posx, Float:posy, Float:posz;
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- foreach(new i:Player)
- {
- if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
- {
- GetPlayerPos(i, posx, posy, posz);
- tempposx = (oldposx -posx);
- tempposy = (oldposy -posy);
- tempposz = (oldposz -posz);
- if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
- {
- SendClientMessage(i, col1, string);
- }
- else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
- {
- SendClientMessage(i, col2, string);
- }
- else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
- {
- SendClientMessage(i, col3, string);
- }
- else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
- {
- SendClientMessage(i, col4, string);
- }
- else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- SendClientMessage(i, col5, string);
- }
- }
- }
- }//not connected
- return 1;
- }
Add Comment
Please, Sign In to add comment