AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_user_aiming, set view, maximum value (https://forums.alliedmods.net/showthread.php?t=12064)

LynX 04-04-2005 10:16

get_user_aiming, set view, maximum value
 
1. I made a script that would get what are you looking on. So, I made this:
Code:
public get_aiming(id) { new player, bodypart get_user_aiming(id, player, bodypart, 5) return PLUGIN_HANDLED }

Now, how can I check data of player on your looking on?
I mean, on player thing. This is first time I'm using it, so can you show me, how to, let's say, check the health of player looking at ( check health only if he's looking on valid player ).

2. How can I set view to another player using only AMXX?
I tried looking at Jedi Mind Control from Twilight Suzuka, but I couldn't figure it out....

3. How can I set maximum value for something? Let's say, restrict that users can't get over 50 health, or something... Can any1 show this?

Thanks.

Ced 04-04-2005 12:20

1.
Code:
public get_aiming(id)  {      new player, bodypart, health      get_user_aiming(id, player, bodypart)      if(player) {         health  = get_user_health(player)      }else {         client_print(id, print_chat, "No Target found")      } return PLUGIN_HANDLED }

2.
Code:
engfunc(EngFunc_SetView, id, targetid)

3. make a infinite looping task that checks all players health and if any go above 50, change it to 50

Twilight Suzuka 04-04-2005 12:40

First off, fun module? Whats with you people and using fun module?

second:
from engine:
Code:
 attach_view(id,tid)

LynX 04-04-2005 13:44

Can you show me that kinda task loop?
Also, how could I disable that limit that's not integrated in mine plugin, its integrated in other?
Or, is there another way to set limit for that? Thanks.
And, 1 more thing, how can I make that if other player approaches to player which is using some function, on let's say 5 meters, it pushes him away 20 meters? So, that's basically push-away if closes on specified distance.

Ced 04-04-2005 14:05

um, first I think this will work but not sure since i did not test
Code:
public plugin_init() {     set_task(0.1,"check_health",0,_ _,"b") } public check_health() {      new players[32],pNum,health      get_players(players,pNum,"a")      for(new i=0;i<pNum;i++) {           health = get_user_health(players[i])           if(health > 50)                set_user_health(players[i],50)      }      return PLUGIN_HANDLED }
And for second question, u would have to set their velocity and count how many meters they went, but i'm not experienced really with moving entities so i'll let somebody else post on that. Or u could keep setting their origin but that might b weird.

I remember runemod had a rune(kinetics) that pushed away the person if u want to look at that. And there was a jedi grab plugin with pushing in it.

LynX 04-04-2005 14:24

Okay, I'll try it right now :)

Anybody for pushaway?

LynX 04-04-2005 15:50

Well, it doesn't work. I think set_task shouldn't be used in plugin_init() :lol:
Anyway, what I'm trying to do is remove cvar. Is there any way to remove a cvar or to block it?

Still no pony or pushaway.

Ced 04-04-2005 16:03

it works, just tested but i left out a comma by accident, here.
Code:
public plugin_init() {     set_task(0.1,"check_health",0,_,_,"b") } public check_health() {      new players[32],pNum,health      get_players(players,pNum,"a")      for(new i=0;i<pNum;i++) {           health = get_user_health(players[i])           if(health > 50)                set_user_health(players[i],50)      }      return PLUGIN_HANDLED }

LynX 04-05-2005 04:05

Well, this works. But is there a way to set a limit on integer based thing?
Pushaway?
Remove cvar?
Thanks.


All times are GMT -4. The time now is 10:02.

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