AttachObjectToVehicle Never works..
#1

Well.. I've tried it with different ways.. With Neons / Sirens.. etc - But still , it don't work..


I am using a Streamer.. Here is some of my CMD's..

PHP код:
        if(strcmp(cmd"/addsiren"true) == 0)
        {
              new 
VID GetPlayerVehicleID(playerid);
            if(
IsACop(playerid) || IsAAgent(playerid))
            {
                
BigSiren[VID] = CreateDynamicObject(1941910.010.010.0000);
                  
AttachObjectToVehicle(BigSiren[VID], VID, -0.039999, -0.4699990.6699990.0000000.0000000.000000);
                  
format(stringsizeof(string), "* %s puts the siren on the vehicle's roof."sendername);
                 
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                  }
                    else
                {
                
SendClientMessage(playeridCOLOR_WHITE,"You are not a cop");
                    }
        return 
1;
    } 
PHP код:

            
//blue
            
SetPVarInt(playerid"Status"1);
            
SetPVarInt(playerid"neon"CreateDynamicObject(18648,0,0,0,0,0,0));
            
SetPVarInt(playerid"neon1"CreateDynamicObject(18648,0,0,0,0,0,0));
            
AttachObjectToVehicle(GetPVarInt(playerid"neon"), GetPlayerVehicleID(playerid), -0.80.0, -0.700.00.00.0);
            
AttachObjectToVehicle(GetPVarInt(playerid"neon1"), GetPlayerVehicleID(playerid), 0.80.0, -0.700.00.00.0);
                }
            if(
listitem == 1)
            {
             
//red
                
SetPVarInt(playerid"Status"1);
                
SetPVarInt(playerid"neon2"CreateDynamicObject(18647,0,0,0,0,0,0));
                
SetPVarInt(playerid"neon3"CreateDynamicObject(18647,0,0,0,0,0,0));
                
AttachObjectToVehicle(GetPVarInt(playerid"neon2"), GetPlayerVehicleID(playerid), -0.80.0, -0.700.00.00.0);
                
AttachObjectToVehicle(GetPVarInt(playerid"neon3"), GetPlayerVehicleID(playerid), 0.80.0, -0.700.00.00.0);
                
SendClientMessage(playerid0xFFFFFFAA"neon installed");
}
            if(
listitem == 2)
            {
            
//green
                  
SetPVarInt(playerid"Status"1);
                
SetPVarInt(playerid"neon4"CreateDynamicObject(18649,0,0,0,0,0,0));
                
SetPVarInt(playerid"neon5"CreateDynamicObject(18649,0,0,0,0,0,0));
                
AttachObjectToVehicle(GetPVarInt(playerid"neon4"), GetPlayerVehicleID(playerid), -0.80.0, -0.700.00.00.0);
                
AttachObjectToVehicle(GetPVarInt(playerid"neon5"), GetPlayerVehicleID(playerid), 0.80.0, -0.700.00.00.0);
                
SendClientMessage(playerid0xFFFFFFAA"neon installed");
                } 
none of them works.. I have other CMD's like that.. but - Everything in the CMD works except the Object - it never get attached -.-.. Hope someone can help
Reply
#2

AttachObjectToVehicle only works with objects created with CreateObject - Unless streamer.inc has a function like AttachObjectToVehicle though for dynamic objects then that can be used (AttachDynamicObjectToVehicle)
Reply
#3

That was a really hard way to script. And please only use [php] for php codes. At the siren command you're using a not nessesary variable. You can use VID on GetPlayerVehicleID but not the object just create a new siren; something. AttachObjectToVehicle should be used with the most common way of scripting couse it might not understand everything. Also it try CreateObject instead.
Pawno is wierd i know that.
Reply
#4

if(IsACop(playerid)

can player be a cop car? :P
Reply
#5

Quote:

AttachObjectToVehicle only works with objects created with CreateObject - Unless streamer.inc has a function like AttachObjectToVehicle though for dynamic objects then that can be used (AttachDynamicObjectToVehicle)

- Thanks , you the best - Worked xD [Repped +]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)