Sirens attach object dosent work
#1

The siren dosent show up when i type the code, and the message dosent show up either. I am inside the water plane vehicle, model id 460 when i type the command.


Above OnFilterScriptInit()
pawn Код:
new obj1;
new obj2;
new obj3;

Inside of OnFilterScriptInit()
pawn Код:
obj1 = CreateObject(18646, 0, 0, 0, 0, 0, 0);
obj2 = CreateObject(18646, 0, 0, 0, 0, 0, 0);
obj3 = CreateObject(18646, 0, 0, 0, 0, 0, 0);

On the bottom of my FS.
pawn Код:
COMMAND:sirenson2(playerid, params[])
{
    new VehModel;
    if(GetVehicleModel(VehModel) == 460)
    {
        new VehID;
        VehID = GetPlayerVehicleID(playerid);
        GetPlayerVehicleID(playerid);
        AttachObjectToVehicle(obj1, VehID, -5.025067, 0.389999, 1.184999, -2.010001, 0.000000, 0.000000);
        AttachObjectToVehicle(obj2, VehID, 4.600057, 0.374999, 1.164999, 0.000000, 0.000000, 0.000000);
        AttachObjectToVehicle(obj3, VehID, 0.000000, 2.365006, 0.559999, 0.000000, 0.000000, 0.000000);
        SendClientMessage(playerid, COLOR_BLUE, "I don't get this message.");
    }
    return 1;
}
I don't see why this dosent work I got no errors.
Reply
#2

pawn Код:
COMMAND:sirenson2(playerid, params[])
{
    new VehModel; //Okay you created a new varialbe to hold the VehModel, but it's not set to anything, so it's 0
    if(GetVehicleModel(VehModel) == 460) //Hold on? We're checking the vehicle model of VehModel which is 0?
    {
        new VehID; //Okay we're making a new variable for the vehicle id
        VehID = GetPlayerVehicleID(playerid); //Storing it
        GetPlayerVehicleID(playerid); //Why are we calling it twice?
        AttachObjectToVehicle(obj1, VehID, -5.025067, 0.389999, 1.184999, -2.010001, 0.000000, 0.000000);
        AttachObjectToVehicle(obj2, VehID, 4.600057, 0.374999, 1.164999, 0.000000, 0.000000, 0.000000);
        AttachObjectToVehicle(obj3, VehID, 0.000000, 2.365006, 0.559999, 0.000000, 0.000000, 0.000000);
        SendClientMessage(playerid, COLOR_BLUE, "I don't get this message.");
    }
    return 1;
}
Fixed:

pawn Код:
COMMAND:sirenson2(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_BLUE, "You need to be in a vehicle to use that command!"); //Send a error message if they're not in a vehicle
    else //Else they are
    {  
        new VehID = GetPlayerVehicleID(playerid); //Get the vehicleid of the vehicle they're driving
        if(GetVehicleModel(VehID) == 460) //If the vehicleid's model is 460
        {
            AttachObjectToVehicle(obj1, VehID, -5.025067, 0.389999, 1.184999, -2.010001, 0.000000, 0.000000);
            AttachObjectToVehicle(obj2, VehID, 4.600057, 0.374999, 1.164999, 0.000000, 0.000000, 0.000000);
            AttachObjectToVehicle(obj3, VehID, 0.000000, 2.365006, 0.559999, 0.000000, 0.000000, 0.000000);
            SendClientMessage(playerid, COLOR_BLUE, "I don't get this message.");          
        }  
    }
    return 1;
}
Reply
#3

You didn't define "VehModel", Use:
pawn Код:
new VehModel = GetPlayerVehicleID(playerid);
Reply
#4

Ahh :P Thanks to both of you

Btw, i now noticed that the light go out when the plane goes a little up and down, is there some lights, that dosent do this? or any way to fix this?
Reply
#5

That's just some weird rotational issue, there's no way around it that I can think of. You just need to make sure you have the correct coordinates for rotation.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)