Raised This Month: $ Target: $400
 0% 

BlockMaker All Sides


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BigMac
Member
Join Date: Jul 2009
Old 07-31-2009 , 21:11   BlockMaker All Sides
Reply With Quote #1

Hi, was trying to make it so my blockmaker is not just ontop only, i want to make it so that ALL the sides of the block work. Could anyone help me out with this? I've tried

Here is a part of the code i think i have to add to

//trace directly down to see if there is a block beneath player
new Float:pOrigin[3];
new Float:pSize[3];
new Float:pMaxs[3];
new Float:vTrace[3];
new Float:vReturn[3];
entity_get_vector(id, EV_VEC_origin, pOrigin);
entity_get_vector(id, EV_VEC_size, pSize);
entity_get_vector(id, EV_VEC_maxs, pMaxs);

//calculate position of players feet
pOrigin[2] = pOrigin[2] - ((pSize[2] - 36.0) - (pMaxs[2] - 36.0));

//make the trace small for some blocks
vTrace[2] = pOrigin[2] - 1.0;

//do 4 traces for each corner of the player
for (new i = 0; i < 4; ++i)
{
switch (i)
{
case 0: { vTrace[0] = pOrigin[0] - 16; vTrace[1] = pOrigin[1] + 16; }
case 1: { vTrace[0] = pOrigin[0] + 16; vTrace[1] = pOrigin[1] + 16; }
case 2: { vTrace[0] = pOrigin[0] + 16; vTrace[1] = pOrigin[1] - 16; }
case 3: { vTrace[0] = pOrigin[0] - 16; vTrace[1] = pOrigin[1] - 16; }
}

ent = trace_line(id, pOrigin, vTrace, vReturn);

//if entity found is a block
if (isBlock(ent))
{

Thank You
__________________
BigMac is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 08-01-2009 , 06:42   Re: BlockMaker All Sides
Reply With Quote #2

Remove the checking part of if the block is underneath the player and move the code after the checking to a callback for register_touch(blockclassname, "player", "callback")
Jon is offline
BigMac
Member
Join Date: Jul 2009
Old 08-01-2009 , 09:51   Re: BlockMaker All Sides
Reply With Quote #3

"Remove the checking part of if the block is underneath the player"
Did that and it works

"move the code after the checking to a callback for"
No idea where to move the code or even what part of the code to move so it checks for public fwdTouch

"register_touch(gszBlockClassname, "player", "callback")"
Did that works

I was looking at the BCM code but thats totally different he uses public fwdTouch

Could you or anyone who knows show me an example of one block and i'll take it form there.
Or help me out by explaining it a bit more

Thank You
__________________

Last edited by BigMac; 08-01-2009 at 10:01. Reason: errors
BigMac is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 18:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode