CMD:seatbelt(playerid, params[]) { if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) return SendErrorMessage(playerid, "You are not in any vehicle."); new string[50 + MAX_PLAYER_NAME]; if(IsPlayerInAnyVehicle(playerid) == 1 && Seatbelt[playerid] == 0) { Seatbelt[playerid] = 1; if(IsABike(GetPlayerVehicleID(playerid))) { format(string, sizeof(string), "* %s reaches for their helmet, and puts it on.", ReturnName(playerid, 0)); SetPlayerAttachedObject(playerid, 2, 18645, 2, 0.07, 0, 0, 88, 75, 0); } else { format(string, sizeof(string), "* %s reaches for their seatbelt, and buckles it up.", ReturnName(playerid, 0)); //SetPlayerAttachedObject(playerid, 2, 18634, 7,0.000000, 0.100000, 0.350000, -35.224993, 45.215000, 1.500000, 5.000000, 1.500000, 1.500000); } } else if(IsPlayerInAnyVehicle(playerid) == 1 && Seatbelt[playerid] == 1) { Seatbelt[playerid] = 0; if(IsABike(GetPlayerVehicleID(playerid))) { format(string, sizeof(string), "* %s reaches for their helmet, and takes it off.", ReturnName(playerid, 0)); RemovePlayerAttachedObject(playerid, 2); } else { format(string, sizeof(string), "* %s reaches for their seatbelt, and unbuckles it.", ReturnName(playerid, 0)); // RemovePlayerAttachedObject(playerid, 2); } } SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "%s", string); return 1; }
CMD:checkbelt(playerid, params[]) { new giveplayerid; if(sscanf(params, "i", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /checkbelt [playerid]"); if(GetPlayerState(giveplayerid) == PLAYER_STATE_ONFOOT) { SendClientMessageEx(playerid,COLOR_GREY,"That player is not in any vehicle!"); return 1; } if (ProxDetectorS(9.0, playerid, giveplayerid)) { new string[128]; new stext[4]; if(Seatbelt[giveplayerid] == 0) { stext = "off"; } else { stext = "on"; } if(IsABike(GetPlayerVehicleID(playerid))) { format(string, sizeof(string), "%s's helmet is currently %s." , GetPlayerNameEx(giveplayerid) , stext); SendClientMessageEx(playerid,COLOR_WHITE,string); format(string, sizeof(string), "* %s looks at %s, checking to see if they are wearing a helmet.", GetPlayerNameEx(playerid),GetPlayerNameEx(giveplay erid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); } else { format(string, sizeof(string), "%s's seat belt is currently %s." , GetPlayerNameEx(giveplayerid) , stext); SendClientMessageEx(playerid,COLOR_WHITE,string); format(string, sizeof(string), "* %s peers through the window at %s, checking to see if they are wearing a seatbelt.", GetPlayerNameEx(playerid),GetPlayerNameEx(giveplay erid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); } } else { SendClientMessageEx(playerid, COLOR_GREY, "You are not around that player!"); } return 1; } |