AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Pushable block? (https://forums.alliedmods.net/showthread.php?t=62715)

fxfighter 11-03-2007 13:41

Pushable block?
 
Is thare enyway i can spawn a block infront of a user that can be pushed by the user? like in hl1 when you can use E to move the block.

Alka 11-03-2007 14:09

Re: Pushable block?
 
Check if the user is touching the ent , then check the buttons, then move the ent by incrase origin. :)

E.g: User touching the ent -> If button & IN_FORWARD -> Move ent in front by Origin[0] += 5.0 //units.

fxfighter 11-04-2007 05:33

Re: Pushable block?
 
Buttons
think i get it but how can i compare 2 buttons?
show me an example plz.
Relly want to use use button and foreward.

Move Block
But if a player tuch the block and move to the left whit
it.
it will always go the same way.
how can i do so it goes to the players left all time
and not the block left side.

Another problem
Will happen,players can move the block on to people and walls and if they move the block on people .
The event will be triggered again.

Alka 11-04-2007 06:20

Re: Pushable block?
 
Hmm, i've maked something, but is not working as i espect! Buttons check and touch works but the direction is the problem because i must push the block in the direction of player :s...dunno. Maybe someone else know how to do this... ? Fatalis have a "carpet block" on his bcm4...and you can fly with that block, and is moving with player in his direction.

ConnorMcLeod 11-04-2007 06:52

Re: Pushable block?
 
May be you could check existing pushable entities properties to find the one that make them pushable.

Alka 11-04-2007 07:17

Re: Pushable block?
 
Quote:

Originally Posted by connorr (Post 549265)
May be you could check existing pushable entities...

Like ? :s

ConnorMcLeod 11-04-2007 08:22

Re: Pushable block?
 
There's somme maps with pushable boxes ( i remember a quite dark rats maps with a micro waves, and with a box like that ).
Also there's a ball you can push with +use in cs_rio .

P34nut 11-04-2007 08:33

Re: Pushable block?
 
Alka: You can use velocity_by_aim() to move the box in the direction the player is aiming at

Alka 11-04-2007 10:11

Re: Pushable block?
 
Hmmm, yeah lol , you'r right :)...I've maked this but is not working :|, should work but nothing...

Code:

#include <amxmodx>
#include <fakemeta>
 
#define PLUGIN "Pushable Block"
#define VERSION "1.0"
#define AUTHOR "Alka"
 
public plugin_init() {
 
 register_plugin(PLUGIN, VERSION, AUTHOR);
 
 register_forward(FM_Touch, "Fwd_Touch");
}
 
public Fwd_Touch(Ent, id)
{
 if(!is_user_connected(id) || !pev_valid(Ent))
  return FMRES_IGNORED;
 
 static ClassName[32];
 pev(Ent, pev_classname, ClassName, sizeof ClassName - 1);
 
 if(equal(ClassName, "bm_block"))
 {
  static Button;
  Button = pev(id, pev_button);
 
  if(Button & IN_USE)
  {
  client_print(id, print_chat, "debug: Mooving..."); //Debug. :P
 
  static Float:AimVec[3];
  //velocity_by_aim(id, 1, AimVec); //1 - Want to move the ent with player spped.
  engfunc(EngFunc_GetAimVector, id, 1.0, AimVec); //Fakemeta style. :D
 
  //Both not working. :S
 
  set_pev(Ent, pev_velocity, AimVec);
  }
 }
 return FMRES_IGNORED;
}

Btw, debug works ;)

P34nut 11-04-2007 10:30

Re: Pushable block?
 
The speed is 1 .. Try to make 100 or something

Code:
public Fwd_Touch(Ent, id) {  if(!is_user_connected(id) || !pev_valid(Ent))   return FMRES_IGNORED;    static szClassName[32];  pev(Ent, pev_classname, szClassName, maxchars(szClassName))    if(equal(szClassName, "bm_block"))  {   static iButton;   iButton = pev(id, pev_button)     if(iButton & IN_USE)   {    client_print(id, print_chat, "DEBUG Moving")      static Float:fAimVec[3];    velocity_by_aim(id, 100, fAimVec); //1 - Want to move the ent with player spped.    set_pev(Ent, pev_velocity, fAimVec);   }  }  return FMRES_IGNORED; }

Untested


All times are GMT -4. The time now is 01:15.

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