25.02.2013, 15:50
pawn Код:
CMD:siren(playerid, params[])
{
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
new vehicleid = GetPlayerVehicleID(playerid);
new VID = GetVehicleModel(GetPlayerVehicleID(playerid));
if(Faction[playerid] != 1 && Faction[playerid] != 4) return SendClientMessage(playerid, COLOUR_GREY, "You cannot use this.");
if(VID !=426) return SendClientMessage(playerid, COLOUR_GREY, "This vehicle is not a 'Premier', Currently this is the only vehicle to place this on.");
new string[128], type;
if(sscanf(params, "d", type))return SendClientMessage(playerid, COLOUR_GREY, "USAGE: /siren [position] 1 = Roof, 2 = Inside, 3 = Removed.");
if(type < 1 || type > 3) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /siren [position] (Position must be between 1 and 3)");
switch(type)
{
case 1:
{
if(Siren[vehicleid] == 1) return SendClientMessage(playerid, COLOUR_GREY, "There is already a siren on this vehicle.");
Siren[vehicleid] = 1;
SirenObject[vehicleid] = CreateDynamicObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
AttachObjectToVehicle(SirenObject[vehicleid], vehicleid, -0.756499, 0.095000, 0.889999, 0.000000, 0.000000, 0.000000);
format(string, sizeof(string), "* %s puts the siren on the roof of the vehicle.", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE);
return 1;
}
case 2:
{
if(Siren[vehicleid] == 1) return SendClientMessage(playerid, COLOUR_GREY, "There is already a siren on this vehicle.");
Siren[vehicleid] = 1;
SirenObject[vehicleid] = CreateDynamicObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
AttachObjectToVehicle(SirenObject[vehicleid], vehicleid, 0.013500, 0.744999, 0.404999, 0.000000, 0.000000, 0.000000);
format(string, sizeof(string), "* %s puts the siren on the dashboard of the vehicle .", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE);
return 1;
}
case 3:
{
if(Siren[vehicleid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "There is no siren on this vehicle.");
Siren[vehicleid] = 0;
DestroyDynamicObject(SirenObject[vehicleid]);
format(string, sizeof(string), "* %s takes down the siren.", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE);
return 1;
}
}
return 1;
}
It used to work, but it's strange, It doesn't create the objects and I use DynamicObject because I use a streamer and mixing the two can cause it to not work correctly! But I'm not sure why it won't work.