02.01.2013, 03:35
Try this:
pawn Code:
new Neon1[MAX_VEHICLES]; //Used for the neon object
new Neon2[MAX_VEHICLES]; //Used for the second neon object
new NeonAttached[MAX_VEHICLES]; //Used to set whether a car has neon attached or not
public OnVehicleSpawn(vehicleid)
{
if(NeonAttached[vehicleid] == 1) //If the vehicle has neon attached
{
AttachObjectToVehicle(Neon1[vehicleid], vehicleid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(Neon2[vehicleid], vehicleid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
}
return 1;
}
CMD:addneon(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessageEx(playerid, COLOR_RED, "You do not have permission to use this cmd.");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You are not in a vehicle as a driver.");
if(NeonAttached[GetPlayerVehicleID(playerid)] == 1) return SendClientMessage(playerid, COLOR_GREY, "This vehicle already has neon attached, use /removeneon to remove it.");
new vehicleid = GetPlayerVehicleID(playerid);
Neon1[vehicleid] = CreateObject(18648,0,0,0,0,0,0,100.0); //Create the first neon object
Neon2[vehicleid] = CreateObject(18648,0,0,0,0,0,0,100.0); //Create the second neon object
AttachObjectToVehicle(Neon1[vehicleid], vehicleid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(Neon2[vehicleid], vehicleid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
SendClientMessage(playerid, 0xFFFFFFFF, "Neon lights have been installed on this vehicle..");
NeonAttached[vehicleid] = 1; //This vehicle has neon attached
return 1;
}
CMD:removeneon(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessageEx(playerid, COLOR_RED, "You do not have permission to use this cmd.");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You are not in a vehicle as a driver.");
if(NeonAttached[GetPlayerVehicleID(playerid)] == 0) return SendClientMessage(playerid, COLOR_GREY, "This vehicle doesn't have neon attached, use /addneon to add it.");
new vehicleid = GetPlayerVehicleID(playerid);
DestroyObject(Neon1[vehicleid]);
DestroyObject(Neon2[vehicleid]);
SendClientMessage(playerid, 0xFFFFFFFF, "Neon lights have been removed from this vehicle..");
NeonAttached[vehicleid] = 0; //This vehicle no longer has neon attached
return 1;
}