SA-MP Forums Archive
Two roadblock objects spawned into eachother - 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: Two roadblock objects spawned into eachother (/showthread.php?tid=306243)



Two roadblock objects spawned into eachother - Danny - 25.12.2011

Hi,

I need help with this code. I am trying to spawn two roadblocks into eachother, so the big holes will disappear. I did some tests and calculated they need to have an X-coord gap of 3.800 ... Now i made this code, but the problem is it's only working properly when the Z-rotation is 0.0. When that isn't the case, the two roadblocks will stand between eachother. Can someone help me edit this to make it work?

Код:
stock CreateRoadblock(Float:x, Float:y, Float:z, Float:a)
{
	CreateDynamicObject(981, x, y, z, 0.0, 0.0, a+180.0);
	return CreateDynamicObject(981, x-3.8000493752, y, z, 0.0, 0.0, a+180.0);
}
Greetz,
Danny


Re: Two roadblock objects spawned into eachother - skaTim - 25.12.2011

If you want 2 roadblocks into eachother you can simply do this:

pawn Код:
stock CreateRoadblock(Float:x, Float:y, Float:z, Float:a)
{
    CreateDynamicObject(981, x, y, z, 0.0, 0.0, a+180.0);
    CreateDynamicObject(981, x, y, z, 0.0, 0.0, a+180.0);
}



Re: Two roadblock objects spawned into eachother - Danny - 25.12.2011

Quote:
Originally Posted by skaTim
Посмотреть сообщение
If you want 2 roadblocks into eachother you can simply do this:

pawn Код:
stock CreateRoadblock(Float:x, Float:y, Float:z, Float:a)
{
    CreateDynamicObject(981, x, y, z, 0.0, 0.0, a+180.0);
    CreateDynamicObject(981, x, y, z, 0.0, 0.0, a+180.0);
}
I'm sorry for my weird way of explaining this, but I want to spawn in in such a way the one roadblock is covering the holes of the other one.


Re: Two roadblock objects spawned into eachother - skaTim - 25.12.2011

pawn Код:
stock CreateRoadblock(Float:x, Float:y, Float:z, Float:a)
{
    CreateDynamicObject(981, x, y, z, 0.0, 0.0, a+180.0);
    CreateDynamicObject(981, x-3.8000493752, y, z, 0.0, 0.0, a+180.0);
}
Maybe this?


Re: Two roadblock objects spawned into eachother - Danny - 25.12.2011

Quote:
Originally Posted by skaTim
Посмотреть сообщение
pawn Код:
stock CreateRoadblock(Float:x, Float:y, Float:z, Float:a)
{
    CreateDynamicObject(981, x, y, z, 0.0, 0.0, a+180.0);
    CreateDynamicObject(981, x-3.8000493752, y, z, 0.0, 0.0, a+180.0);
}
Maybe this?
How does the value you're returning changes the way of spawning?
This will give me a warning if i'm right.


Re: Two roadblock objects spawned into eachother - Danny - 26.12.2011

Bump, i need help with this, please.


Re: Two roadblock objects spawned into eachother - Thresholdold - 26.12.2011

What's the warning you get when you try skaTim's code?


Re: Two roadblock objects spawned into eachother - Danny - 26.12.2011

Код:
C:\Users\Tol\Desktop\Maxlife International V3 9-12-11 [0.3d]\pawno\include\homemadeincludes/copsystem.inc(262) : warning 209: function "CreateRoadblock" should return a value
This one, because the function isn't returning any value.


Re: Two roadblock objects spawned into eachother - Thresholdold - 26.12.2011

just add
pawn Код:
return 1;
under it?

pawn Код:
stock CreateRoadblock(Float:x, Float:y, Float:z, Float:a)
{
    CreateDynamicObject(981, x, y, z, 0.0, 0.0, a+180.0);
    CreateDynamicObject(981, x-3.8000493752, y, z, 0.0, 0.0, a+180.0);
    return 1;
}



Re: Two roadblock objects spawned into eachother - Danny - 26.12.2011

Quote:
Originally Posted by Threshold
Посмотреть сообщение
just add
pawn Код:
return 1;
under it?
Yes i know that, but it won't solve the actual problem, the roadblocks are still not spawned correctly.