Код:
CMD:fdl(playerid, params[])
{
if(PlayerInfo[playerid][pLeader] == 4 || PlayerInfo[playerid][pMember] == 4)
{
new string[128], type;
new VID = GetPlayerVehicleID(playerid);
if(sscanf(params, "d", type))
{
SendClientMessageEx(playerid, COLOR_WHITE, "Usage: /fdl [type]");
SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 - Dashboard, 2 - Off.");
return 1;
}
switch(type)
{
case 1:
{
if(Siren[VID] == 1)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "This Vehicles Already Has a Police Light.");
return 1;
}
new sendername[MAX_PLAYER_NAME];
Siren[VID] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
SetObjectMaterial(SirenObject, 0, 18646, "matcolours", "matcolours01", 3)
AttachObjectToVehicle(SirenObject[VID], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
format(string, sizeof(string), "* %s Puts a Police Light On The Dashboard.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
case 2:
{
if(Siren[VID] == 0)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "This Vehicle Doesn't Have a Police Light On It.");
return 1;
}
Siren[VID] = 0;
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
DestroyObject(SirenObject[VID]);
format(string, sizeof(string), "* %s Takes Down The Police Light.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
default:
{
SendClientMessageEx(playerid, COLOR_WHITE, "Invalid Type. Usage: /pdl [type]");
SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 - Dashboard, 2 - Off");
}
}
}
else SendClientMessageEx(playerid, COLOR_GREY, "You're not authorised to use this command.");
return 1;
}