Raised This Month: $32 Target: $400
 8% 

Shield Tutorial


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 09-25-2004 , 14:03   Shield Tutorial
Reply With Quote #1

Heres a new way of getting whether a person has shield.
By sequence
Code:
#include <amxmodx> #include <amxmisc> #include <engine> public plugin_init() {     register_plugin("Shield","1.0","default");     register_clcmd("get_shield","shield",ADMIN_LEVEL_A,": name") } public shield(id) {     new arg[32]     read_argv(1,arg,31)         new vid = cmd_target(id,arg,8);         new seq = entity_get_int(vid,EV_INT_sequence);         new name[32]     get_user_name(vid,name,31);         //SEQUENCCE 89 = Shield + Knife     //SEQUENCE 94 = Shield + Pistol     //SEQUENCE 98 = Shield only (right clicked)             if(seq == 89)     {         client_print(0,3,"%s has shield and a knife",name);     }     else if(seq == 94)     {         client_print(0,3,"%s has shield and a pistol",name);     }     else if(seq == 98)     {         client_print(0,3,"%s has shield",name);     }         client_print(0,3,"Sequence: %d",seq);         return PLUGIN_HANDLED }
Freecode is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 09-25-2004 , 14:53  
Reply With Quote #2

Another one. Originaly posted by Ryan on AMX forums.

Code:
#include <amxmodx> #include <engine> new bool:gotShield[33] public pfn_touch(ptr, ptd) {     new entId   = ptr     new id      = ptd     if ( id < 0 || id > 32 || !is_user_alive(id) || gotShield[id] )         return PLUGIN_CONTINUE     new modelName[32]     entity_get_string(entId, EV_SZ_model, modelName, 31)     if ( containi(modelName,"w_shield.mdl") != -1 ) {         new parm[1]         parm[0] = id         remove_task(2200 + id,0)         set_task(0.1,"check_shield",2200 + id,parm,1)     }     return PLUGIN_CONTINUE } public check_shield(parm[1]) {     new id = parm[0]     new modelName[32]     entity_get_string(id, EV_SZ_viewmodel, modelName, 31)     if ( containi(modelName,"v_shield_") != -1 ) {         // Do some stuff in here. It's found!     }             return PLUGIN_HANDLED }
Freecode is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 09-26-2004 , 13:48  
Reply With Quote #3

Hmm the shield Offset in CS is 494. Only a few bugs with it though. (engine problem of-course)
Im gonna do a few more tests and let you now about it
Freecode is offline
Ryan
Senior Member
Join Date: May 2004
Location: NH, USA
Old 09-26-2004 , 18:58  
Reply With Quote #4

The problem is finding an efficient way of getting the shield (ie- a forward).. having to listen to too many events for different parts makes for big and sloppy code to find out one simple thing! and setting a milisecond timer (task) is a no no.

the only ways to detect shield are...

client command: shield (whatever buys it right out)
menu command: equipment menu, key 8
touch event when walking over it to pick it up
hideweapon event -OR- curweapon event... just in case any of the above were missed.

however, many plugins give players shields via the give_item function, which does not trigger any of the above events.

it's too bad valve (ming) didnt make this easier for scripters to detect.
__________________
Warcraft 3: Expansion
Homepage | Downloads | Forums
Ryan is offline
Send a message via AIM to Ryan
SidLuke
Senior Member
Join Date: Mar 2004
Location: Poland, Chrzanow
Old 09-26-2004 , 19:23  
Reply With Quote #5

so you need shield_pickup , shield_drop forwards...
I did a look at messages when you drop/pickup shiled but none of them was send (even hide weapon and current weapon do not detect shield ... ). I will try to find another way but I can't promise you anything...
SidLuke is offline
Send a message via AIM to SidLuke Send a message via MSN to SidLuke
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 09-26-2004 , 21:56  
Reply With Quote #6

the offset works fine but the engine seems to be messing up sometimes. i think i found a fix for it but dont noe yet. I got a custume edited cstrike with get_user_shield(id) native added and it seems to be working.
Freecode is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 09-27-2004 , 08:06  
Reply With Quote #7

Quote:
Originally Posted by Freecode
the offset works fine but the engine seems to be messing up sometimes. i think i found a fix for it but dont noe yet. I got a custume edited cstrike with get_user_shield(id) native added and it seems to be working.

ewww sounds yummy....
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 09-30-2004 , 04:09  
Reply With Quote #8

Code:
/* Returns 1 when user has a primary weapon OR a shield in inventory, else 0.  */ native cs_get_user_hasprim(index);

If it returns 0 you can be sure user has no shield...
Johnny got his gun is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 10-24-2004 , 22:44  
Reply With Quote #9

but sometimes we JUST want to know if it is a shield, like weapon reincarnation in war3

Also, why is this needed:

new arg[32]
read_argv(1,arg,31)

new vid = cmd_target(id,arg,;
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 11-30-2004 , 09:44  
Reply With Quote #10

Freecode ever get anywhere on that offset thing?
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
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 15:58.


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