[0.3e] Not sure what's going on
#1

Ok, so I have made a simple command to attach the new 0.3e police light bar to a vehicle.

pawn Код:
if(strcmp(cmd, "/siren", true) == 0)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        AttachObjectToVehicle(19420, vehicleid, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
        return 1;
    }
When I go in game, it doesn't attach it to the vehicle.

I am using both 0.3e Server and Client.

Also, I don't get any warnings nor errors when I compile.

+Rep
Reply
#2

Maybe this works
pawn Код:
if (strcmp(cmd, "/siren", true) == 0)//also try to put a space between "if" and (strcmp(====== it might work  sometimes
    {
        AttachObjectToVehicle(19420,(GetPlayerVehicleID(playerid)), 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
        return 1;
    }
Reply
#3

Nope, didn't work.
Reply
#4

You need to create the object before attaching it, ex:

pawn Код:
if(strcmp(cmd, "/siren", true) == 0)
    {
        new vehicleid = GetPlayerVehicleID(playerid), object = CreateObject(19420, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(object, vehicleid, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
        return 1;
    }
Reply
#5

this works
pawn Код:
if (strcmp(cmd,"/siren",true) == 0)//also try to put a space between "if" and (strcmp(====== it might work  sometimes
    {
        AttachObjectToVehicle((CreateObject(19420, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)),(GetPlayerVehicleID(playerid)), 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
        return 1;
    }
Reply
#6

Alright, that worked. Totally forgot about creating the object.

Although the siren doesn't align were I'd like it, but I'll figure it out, you both gave me two codes that work, thanks for that. +rep
Reply
#7

All you gotta do now is play around with the coords.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)