SA-MP Forums Archive
[0.3e] Not sure what's going on - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [0.3e] Not sure what's going on (/showthread.php?tid=340082)



[0.3e] Not sure what's going on - X3nZ - 05.05.2012

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


Re: [0.3e] Not sure what's going on - HDFord - 05.05.2012

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;
    }



Re: [0.3e] Not sure what's going on - X3nZ - 05.05.2012

Nope, didn't work.


Re: [0.3e] Not sure what's going on - SuperViper - 05.05.2012

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;
    }



Re: [0.3e] Not sure what's going on - HDFord - 05.05.2012

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;
    }



Re: [0.3e] Not sure what's going on - X3nZ - 05.05.2012

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


Re: [0.3e] Not sure what's going on - ReneG - 05.05.2012

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