Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - #define FILTERSCRIPT
 - #include <a_samp>
 - #include <zcmd>
 - #define COLOR_WHITE 0xFFFFFFAA
 - new SeatbeltStatus[MAX_PLAYERS];
 - public OnPlayerConnect(playerid) {
 - SeatbeltStatus[playerid] = 0;
 - return 1;
 - }
 - public OnFilterScriptInit()
 - {
 - print("\n---------------------------------------------------------");
 - print(" Seatbelt System for Roleplay. Dafuq's second Fs. ");
 - print("---------------------------------------------------------\n");
 - return 1;
 - }
 - public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
 - {
 - SeatbeltStatus[playerid] = 0;
 - }
 - public OnPlayerExitVehicle(playerid, vehicleid)
 - {
 - new string[50 + MAX_PLAYER_NAME];
 - if(SeatbeltStatus[playerid] == 1)
 - {
 - format(string, sizeof(string), "* %s reaches for their seatbelt, and unbuckles it.", GetPlayerNameEx(playerid));
 - SCBubble(playerid,string,true,0xFFFF00AA,10,5000);
 - SendClientMessage(playerid, COLOR_WHITE, "You have taken off your seatbelt.");
 - }
 - return 1;
 - }
 - CMD:seatbelt(playerid, params[])
 - {
 - if(IsPlayerInAnyVehicle(playerid) == 0)
 - {
 - SendClientMessage(playerid, COLOR_WHITE, "You are not in a vehicle!");
 - return 1;
 - }
 - new string[50 + MAX_PLAYER_NAME];
 - if(IsPlayerInAnyVehicle(playerid) == 1 && SeatbeltStatus[playerid] == 0)
 - {
 - SeatbeltStatus[playerid] = 1;
 - if(IsAMotorBike(GetPlayerVehicleID(playerid)))
 - {
 - format(string, sizeof(string), "* %s reaches for their helmet, and puts it on.", GetPlayerNameEx(playerid));
 - SCBubble(playerid,string,true,0xFFFF00AA,10,5000);
 - SendClientMessage(playerid, COLOR_WHITE, "You have put on your helmet.");
 - }
 - else
 - {
 - format(string, sizeof(string), "* %s reaches for their seatbelt, and buckles it up.", GetPlayerNameEx(playerid));
 - SCBubble(playerid,string,true,0xFFFF00AA,10,5000);
 - SendClientMessage(playerid, COLOR_WHITE, "You have put on your seatbelt.");
 - }
 - }
 - else if(IsPlayerInAnyVehicle(playerid) == 1 && SeatbeltStatus[playerid] == 1)
 - {
 - SeatbeltStatus[playerid] = 0;
 - if(IsAMotorBike(GetPlayerVehicleID(playerid)))
 - {
 - format(string, sizeof(string), "* %s reaches for their helmet, and takes it off.", GetPlayerNameEx(playerid));
 - SCBubble(playerid,string,true,0xFFFF00AA,10,5000);
 - SendClientMessage(playerid, COLOR_WHITE, "You have taken off your helmet.");
 - }
 - else
 - {
 - format(string, sizeof(string), "* %s reaches for their seatbelt, and unbuckles it.", GetPlayerNameEx(playerid));
 - SCBubble(playerid,string,true,0xFFFF00AA,10,5000);
 - SendClientMessage(playerid, COLOR_WHITE, "You have taken off your seatbelt.");
 - }
 - }
 - return 1;
 - }
 - CMD:checkseatbelt(playerid, params[])
 - {
 - if(SeatbeltStatus[playerid] == 1)
 - {
 - format(string, sizeof(string), "* %s check's his seatbelt.", GetPlayerNameEx(playerid));
 - SendClientMessage(playerid, 0xFFFF00AA, "You have your seatbelt on.");
 - SendClientMessage(playerid, 0xFFFF00AA, "Have a safety ride.");
 - }
 - else
 - {
 - format(string, sizeof(string), "* %s check's his seatbelt.", GetPlayerNameEx(playerid));
 - SendClientMessage(playerid, 0xFFFF00AA, "Seems like you don't have your seatbelt on!");
 - SendClientMessage(playerid, 0xFFFF00AA, "Better but your seatbelt on before you crash a car.");
 - }
 - return 1;
 - }
 - stock GetPlayerNameEx(playerid) {
 - new
 - sz_playerName[MAX_PLAYER_NAME],
 - i_pos;
 - GetPlayerName(playerid, sz_playerName, MAX_PLAYER_NAME);
 - while ((i_pos = strfind(sz_playerName, "_", false, i_pos)) != -1) sz_playerName[i_pos] = ' ';
 - return sz_playerName;
 - }
 - stock IsAMotorBike(carid) {
 - switch(GetVehicleModel(carid)) {
 - case 509, 510, 462, 448, 581, 522, 461, 521, 523, 463, 586, 468, 471: return 1;
 - }
 - return 0;
 - }
 - stock SCBubble(playerid,stringtext[],bool:selftext,color,range,time)
 - {
 - SetPlayerChatBubble(playerid,stringtext,color,range,time);
 - if(selftext)
 - {
 - if(strlen(stringtext) > 64)
 - {
 - new strings1[65];
 - strmid(strings1,stringtext,64,128);
 - strdel(stringtext,64,128);
 - format(stringtext,66,"%s-",stringtext);
 - format(strings1,66,"-%s",strings1);
 - SendClientMessage(playerid,color,stringtext);
 - SendClientMessage(playerid,color,strings1);
 - }
 - else SendClientMessage(playerid,color,stringtext);
 - }
 - return 1;
 - }
 - new Float:CarHealth[MAX_PLAYERS];
 - public OnPlayerUpdate(playerid)
 - {
 - if(IsPlayerInAnyVehicle(playerid) == 1 && SeatbeltStatus[playerid] == 0)
 - {
 - new Float:TempCarHealth;
 - GetVehicleHealth(GetPlayerVehicleID(playerid), TempCarHealth);
 - new Float:Difference = floatsub(CarHealth[playerid], TempCarHealth);
 - if((floatcmp(CarHealth[playerid], TempCarHealth) == 1) && (floatcmp(Difference,100.0) == 1))
 - {
 - Difference = floatdiv(Difference, 10.0);
 - new Float:OldHealth;
 - GetPlayerHealth(playerid, OldHealth);
 - SetPlayerHealth(playerid, floatsub(OldHealth, Difference));
 - }
 - CarHealth[playerid] = TempCarHealth;
 - }
 - else
 - {
 - CarHealth[playerid] = 0.0;
 - }
 - return 1;
 - }
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment