SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 24/08/2011, 09:12 AM   #1
Dragony92
Gangsta
 
Dragony92's Avatar
 
Join Date: Feb 2011
Location: Belgrade, Serbia
Posts: 571
Reputation: 57
Default AttachObjectToVehicle

GameMod Using: Ravens RP (Fully edited by me)

This command dont want to attach object on vehicle....just send message and nothing else....

This is part of this FS http://forum.sa-mp.com/showthread.ph...highlight=neon
FS also dont want to work on my server....
I'm running server on 0.3c R5 (Linux) with plugins streamer(last update, by Incognito) and sscanf(last update), FS junkbuster(v10), that's all...

On my home server everything works fine, on windows with same plugins and FS....
Code:
if(strcmp(cmd, "/undercover", true) == 0)
    {
    	if(IsACop(playerid) || IsAFreecop(playerid))
    	{
	    	SetPVarInt(playerid, "undercover", CreateDynamicObject(18646,0,0,0,0,0,0));
	    	SetPVarInt(playerid, "undercover1", CreateDynamicObject(18646,0,0,0,0,0,0));
	    	AttachObjectToVehicle(GetPVarInt(playerid, "undercover"), GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
	    	AttachObjectToVehicle(GetPVarInt(playerid, "undercover1"), GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
	    	SendClientMessage(playerid, 0xFFFFFFAA, "You have Attched Undercover light on your vehicle!");
	    }
	    else
	    {
	        SendClientMessage(playerid, COLOR_GREY, "**You are not a Cop!");
		}
		return 1;
	}
__________________
Dragony92 is offline  
Old 24/08/2011, 09:19 AM   #2
Wesley221
High-roller
 
Wesley221's Avatar
 
Join Date: Apr 2011
Posts: 2,736
Reputation: 714
Default Re: AttachObjectToVehicle

Code:
new UnderCoverobj[3];
UnderCoverobj[0] = CreateDynamicObject(18646,0,0,0,0,0,0);
UnderCoverObj[1] = CreateDynamicObject(18646,0,0,0,0,0,0);
AttachObjectToVehicle(UnderCoverobj[0], GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
AttachObjectToVehicle(UnderCoverobj[1], GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
You have to create the object before you can attach it. And i dont think this can be done through PVars.
__________________
yes
Wesley221 is offline  
Old 24/08/2011, 09:24 AM   #3
Gh0sT_
Gangsta
 
Join Date: Sep 2010
Location: Lithuania, Alytus
Posts: 727
Reputation: 0
Default Re: AttachObjectToVehicle

You can't attach dynamic object, you must use CreateObject
__________________
Includes
Player/Vehicle Control
Entrances system
Gh0sT_ is offline  
Old 24/08/2011, 09:35 AM   #4
Dragony92
Gangsta
 
Dragony92's Avatar
 
Join Date: Feb 2011
Location: Belgrade, Serbia
Posts: 571
Reputation: 57
Default Re: AttachObjectToVehicle

Nothing...i tryed with normal objects (CreateObject)....
__________________
Dragony92 is offline  
Old 24/08/2011, 09:36 AM   #5
Wesley221
High-roller
 
Wesley221's Avatar
 
Join Date: Apr 2011
Posts: 2,736
Reputation: 714
Default Re: AttachObjectToVehicle

Try it the way like i said b4. Just add the pieces to your code, and remove the createobjects in the pvars
__________________
yes
Wesley221 is offline  
Old 24/08/2011, 09:39 AM   #6
Dragony92
Gangsta
 
Dragony92's Avatar
 
Join Date: Feb 2011
Location: Belgrade, Serbia
Posts: 571
Reputation: 57
Default Re: AttachObjectToVehicle

Same...
Code:
if(strcmp(cmd, "/undercover", true) == 0)
    {
        if(IsACop(playerid) || IsAFreecop(playerid))
        {
            new UnderCoverobj[3];
			UnderCoverobj[0] = CreateObject(18646,0,0,0,0,0,0);
			UnderCoverobj[1] = CreateObject(18646,0,0,0,0,0,0);
			AttachObjectToVehicle(UnderCoverobj[0], GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
			AttachObjectToVehicle(UnderCoverobj[1], GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
            SendClientMessage(playerid, 0xFFFFFFAA, "You have Attched Undercover light on your vehicle!");
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "**You are not a Cop!");
        }
        return 1;
    }

Edit; Object is creted on coordinates 0 0 0 but not attached...
__________________
Dragony92 is offline  
Old 24/08/2011, 09:40 AM   #7
Wesley221
High-roller
 
Wesley221's Avatar
 
Join Date: Apr 2011
Posts: 2,736
Reputation: 714
Default Re: AttachObjectToVehicle

Are you sure you got the right co÷rds of the neon?
__________________
yes
Wesley221 is offline  
Old 24/08/2011, 09:41 AM   #8
Dragony92
Gangsta
 
Dragony92's Avatar
 
Join Date: Feb 2011
Location: Belgrade, Serbia
Posts: 571
Reputation: 57
Default Re: AttachObjectToVehicle

Object is creted on coordinates 0 0 0 but not attached to vehicle...
Yeah because i paste it from working FS http://forum.sa-mp.com/showthread.ph...highlight=neon
Edit: It works on windows server but not on Linux...
__________________
Dragony92 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[HELP] AttachObjectToVehicle Alvin007 Scripting Help 10 15/10/2011 04:26 PM
AttachObjectToVehicle HELP PLS DevoLpeR Help Archive 14 27/04/2011 07:53 PM
AttachObjectToVehicle help?? :( thimo Help Archive 5 01/01/2011 06:42 PM


All times are GMT. The time now is 04:28 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.