Raised This Month: $ Target: $400
 0% 

need help with making user specific cvars


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
[cTs] Strake*ROC*
Member
Join Date: Mar 2004
Old 03-23-2005 , 22:40   need help with making user specific cvars
Reply With Quote #1

Hey guys,

I do a lot of plugin making, and i am making my first ever "mod" and i am trying to make it so an admin can do "amx_wanted" and make a user "Wanted" (EX: Player Bob is wanted for TKing. Bounty: $1000)

and i want to make it so it checks: if when a player is killed, is he wanted?

so far i have the easy stuff like:

Code:
register_event("DeathMsg", "hook_death", "a", "1>0")
and

Code:
	new Killer = read_data(1)
	new Victim = read_data(2)
it checks to see if the player is wanted.

if so, then give Killer $1000 else plugin_continued

If you guys could help me with this... that would be great

Thanks Guys,
Strake
__________________
[cTs] Strake*ROC* is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-24-2005 , 00:26  
Reply With Quote #2

Make a variable, let's say "new wanted[33];". The array size is 33 so that we can store ids from 1-32, each representing a player in the game.

In the command that handles amx_wanted, use cmd_target to get the target. Set wanted[theirplayerid] to 1. When a player leaves, make sure to reset wanted[theirplayerid] back to 0.

On death, see if wanted[theirplayerid] is 1.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
[cTs] Strake*ROC*
Member
Join Date: Mar 2004
Old 03-24-2005 , 19:06  
Reply With Quote #3

yeah, but how do i do that... how do i make is so the array is the users id? thats the part that i dont understand....
__________________
[cTs] Strake*ROC* is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-24-2005 , 22:59  
Reply With Quote #4

Code:
new wanted[id]
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-24-2005 , 23:24  
Reply With Quote #5

No, v3x, no... :-\

Code:
#include <amxmodx> #include <amxmisc> new wanted[33]; public plugin_init() {    register_concmd("amx_wanted","cmd_wanted",ADMIN_KICK,"<user> <0|1> - makes a user wanted"); } public client_disconnect(id) {    wanted[id] = 0; } public cmd_wanted(id,level,cid) {    if(!cmd_access(id,level,cid,3)) {       return PLUGIN_HANDLED;    }    new arg[32];    read_argv(1,arg,31);    new target = cmd_target(id,arg,3);    read_argv(2,arg,31);    new status = str_to_num(arg);    if(!target) {       return PLUGIN_HANDLED;    }    wanted[target] = status;    new username[32];    get_user_name(target,username,31);    console_print(id,"* %s is %s wanted",username,(status == 1) ? "now" : "no longer");    return PLUGIN_HANDLED; }

Using that setup, you can check if wanted[Victim] is 1 or not on DeathMsg to see if they are wanted.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
[cTs] Strake*ROC*
Member
Join Date: Mar 2004
Old 03-24-2005 , 23:49  
Reply With Quote #6

That man... i've always wondered how to do this, but never had a chance to sit down and learn how to do that... i'll study the code, learn, then put into my plugin...

Thanks!,
Strake
__________________
[cTs] Strake*ROC* 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 10:01.


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