Wrong thread man, check sticky threads.
Код:
CMD:sb(playerid, params[]) return cmd_seatbelt(playerid, params);
CMD:seatbelt(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid) == 0)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in a vehicle!");
return 1;
}
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.", GetPlayerNameEx(playerid));
SendClientMessageEx(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));
SendClientMessageEx(playerid, COLOR_WHITE, "You have put on your seatbelt.");
}
}
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.", GetPlayerNameEx(playerid));
SendClientMessageEx(playerid, COLOR_WHITE, "You have taken off your helmet.");
}
else
{
format(string, sizeof(string), "* %s reaches for their seatbelt, and unbuckles it.", GetPlayerNameEx(playerid));
SendClientMessageEx(playerid, COLOR_WHITE, "You have taken off your seatbelt.");
}
}
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
CMD:cb(playerid, params[]) return cmd_checkbelt(playerid, params);
CMD:checkbelt(playerid, params[])
{
new giveplayerid;
if(sscanf(params, "u", 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(giveplayerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,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(giveplayerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
else { SendClientMessageEx(playerid, COLOR_GREY, "You are not around that player!"); }
return 1;
}