Help me with the C4 Function
#1

I want to add blow bank system, when you be at the right coordinates or near them, you explode but i dont know how, what function should I use or could you post me a fixed code.
Here is my function:
Код:
public ExplodeC4(playerid)
{
  new Float:x, Float:y, Float:z;
  GetObjectPos(C4T, x, y, z);
  DestroyObject(C4T);
  CreateExplosion(x, y, z, 7, 10.0);
  C4T= 0;
  return 1;
}
Thanks in advance.
Reply
#2

Код:
public ExplodeC4()
{
	 new Float:x, Float:y, Float:z;
	 GetObjectPos(C4T, x, y, z);
	 CreateExplosion(x, y, z, 7, 10.0);
	 DestroyObject(C4T);
	 C4T= 0;
	return 1;
}
Try this, im not sure on what you want, If you said you have a bug with the code. I placed the object after the explosion, you might be trying to get the cords of the object after it gets destroyed.

Also what is the (playerid) for? are you doing the explosion for a player or for everyone?
Reply
#3

I think he means to get the right function to use it in the system.
@Sojo You mean a function that allows you to detect the object's coordinates or position and when you blow it, it explodes the specified place like the bank when you are in the right cords or near them.

Am I right?
Reply
#4

Yea you're right
Reply
#5

pawn Код:
public ExplodeC4(playerid)
{
   if(IsPlayerInRangeOfPoint(playerid, x, y, z, range)) // fill the X, Y, Z Cordinates, and Range
   {
      new Float:x, Float:y, Float:z;
      GetObjectPos(C4T, x, y, z);
      DestroyObject(C4T);
      CreateExplosion(x, y, z, 7, 10.0);
      C4T= 0;
   }
   return 1;
}
you mean this?, if anything else tell me
Reply
#6

Код:
public ExplodeC4(playerid)
{
	new Float:x, Float:y, Float:z;
	GetObjectPos(C4T, x, y, z);
	if(IsPlayerInRangeOfPoint(playerid, x, y, z, 4.0))
       {
		DestroyObject(C4T);
		CreateExplosion(x, y, z, 7, 10.0);
		C4T= 0;
	}
        return 1;
}
He wants it like this, So It detects the objects location and If a player is near it.

@Black your one wouldnt ahve worked, he wanted it to detect it like this.


Hopefully this helps you
Reply
#7

Im sorry guys, nothing worked for me
I think you didn't understand me well.
What I meant is, when you blow a C4 near a bank vault, the bank vault blows and it sends a message to everyone. The problem is I didn't know what function to use to detect if is the C4 in the vault position to blow it.
If the C4 isn't near the position then don't blow the bank vault.
'IsPlayerInRangeOfPoint' didn't work. I don't want to detect if is the player near the C4 in order to blow it. I want to detect if the C4 in the cords or near them or/and in the range in order to explode it and explode the bank vault. Even if he's away of the C4 and he detonates it and it's near the bank vault, the bank vault gets blown.

Maybe you will understand me well here:
What I'm trying to do is blow bank vault system. And to do that, I need the right function but didn't find it.


-I hope you understand.
(I really need this, please help me using this code)
Reply
#8

^Bump^
Reply
#9

Why you don't check C4 in the cords or near bank vault when you plant C4 ?
Reply
#10

Because I don't have the right function, what function I'll use in your opinion? I think GetObjectPos is not useful because it only depends on the specified position, not less or more. I mean I can't stand on the right position, it's really hard.

GetPlayerPos doesn't include range, near or anything? Is that correct?
It only requires the specified position only, not less or more? Right?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)