Raised This Month: $ Target: $400
 0% 

Help limiting to once per map


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MOBOB
Member
Join Date: Dec 2004
Old 12-28-2005 , 12:05   Help limiting to once per map
Reply With Quote #1

Hey i am writing a plugin for my server which enables server regulars to say "freegun ak" or "freegun m4" once per map to recieve the cooresponding weapon. I have edited a plugin that allows them to say "freegun XX" but i need help limiting it to only one use per map. Here is my code so far:

Code:
 #include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "AutoWeapons" #define VERSION "1.0" #define AUTHOR "[CHEEZ-IT]" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)           register_clcmd("freegun", "cmd_weapon", ADMIN_SLAY, "<weapon(m4, ak)>")           set_task(15.0, "sayplugin", 0, "", 0, "", 1)       } public cmd_weapon(id){                 new  whatwassaid[32]     read_argv(1, whatwassaid, 31)           if(equali(whatwassaid,"m4")){         give_item(id, "weapon_m4a1")         give_item(id, "weapon_m4a1")         give_item(id, "weapon_m4a1")         client_print(0,print_chat,"%s used his freegun power to give himself an M4A1. Please visit <a href="http://www.sXeGaming.cjb.net" target="_blank" rel="nofollow noopener">www.sXeGaming.cjb.net</a> to learn about donating to our server and recieving freegun access.", id)     }     if(equali(whatwassaid,"ak")){         give_item(id, "weapon_ak47")         give_item(id, "weapon_ak47")         give_item(id, "weapon_ak47")         client_print(0,print_chat,"%s used his freegun power to give himself an AK47. Please visit <a href="http://www.sXeGaming.cjb.net" target="_blank" rel="nofollow noopener">www.sXeGaming.cjb.net</a> to learn about donating to our server and recieving freegun access.", id)         }     return PLUGIN_HANDLED       }             public sayplugin(id){ client_print(id, print_chat, "|sXe| Clan Pub Server: Freegun access is enabled. Those with freegun access type freegun ak or freegun m4 in console to recieve cooresponding weapon.")     set_hudmessage(0, 0, 0, 0.57, 0.93, 0, 6.0, 12.0)     show_hudmessage(id, "If you have freegun access, say freegun to receive your gun.")       }

I have a very limited knowlege of the small language so any help is greatly appreciated.

Thanks in advance,
MOBOB
MOBOB is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 12-28-2005 , 13:03  
Reply With Quote #2

Why 3 times?
Code:
give_item(id, "weapon_m4a1")    give_item(id, "weapon_m4a1")    give_item(id, "weapon_m4a1")
VEN is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 12-28-2005 , 14:56  
Reply With Quote #3

To give more ammo.

Alternative:
Code:
cs_set_user_bpammo(id, CSW_M4A1, 90);
Or just give them the actual ammo_ in give_item.
__________________
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
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 12-28-2005 , 15:16  
Reply With Quote #4

Code:
#include <amxmodx>   #include <amxmisc>   #include <cstrike>   #include <fun>   #define PLUGIN "AutoWeapons"   #define VERSION "1.0"   #define AUTHOR "[CHEEZ-IT]"   new bool:user_gothisgun[33] public plugin_init() {       register_plugin(PLUGIN, VERSION, AUTHOR)       register_clcmd("say freegun", "cmd_weapon", ADMIN_SLAY, "<weapon(m4, ak)>")             set_task(15.0, "sayplugin", _,_,_, "b") }   public client_putinserver(id) {     user_gothisgun[id] = false } public cmd_weapon(id, level, cid) {       if(!cmd_access(id, level, cid, 2))         return PLUGIN_HANDLED     if(user_gothisgun[id])         return PLUGIN_HANDLED             new whatwassaid[32]       read_argv(1, whatwassaid, 31)           new name[32]     get_user_name(id, name, 31)         if(equali(whatwassaid,"m4", 2))     {           give_item(id, "weapon_m4a1")           cs_set_user_bpammo(id, CSW_M4A1, 90)         client_print(0,print_chat, "%s used his freegun power to give himself an M4A1. Please visit <a href="http://www.sXeGaming.cjb.net" target="_blank" rel="nofollow noopener">www.sXeGaming.cjb.net</a> to learn about donating to our server and recieving freegun access.", name)           user_gothisgun[id] = true     }     else if(equali(whatwassaid,"ak", 2))     {           give_item(id, "weapon_ak47")         cs_set_user_bpammo(id, CSW_AK47, 90)         client_print(0, print_chat, "%s used his freegun power to give himself an AK47. Please visit <a href="http://www.sXeGaming.cjb.net" target="_blank" rel="nofollow noopener">www.sXeGaming.cjb.net</a> to learn about donating to our server and recieving freegun access.", name)               user_gothisgun[id] = true     }     return PLUGIN_HANDLED }   public sayplugin() {     for(new id = 1; id <= get_maxplayers(); id++)     {         client_print(id, print_chat, "|sXe| Clan Pub Server: Freegun access is enabled. Those with freegun access type freegun ak or freegun m4 in console to recieve cooresponding weapon.")         set_hudmessage(0, 0, 0, 0.57, 0.93, 0, 6.0, 12.0)           show_hudmessage(id, "If you have freegun access, say freegun to receive your gun.")     } }

I put the
Quote:
set_task
flag to repeat. So it will repeat the message every 15 seconds.
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
MOBOB
Member
Join Date: Dec 2004
Old 12-28-2005 , 23:32  
Reply With Quote #5

ok thanks, the limiting works fine, however i made some changes and i am having some problems. Here is the code...

Code:
#include <amxmodx>   #include <amxmisc>   #include <cstrike>   #include <fun>   #define PLUGIN "Freegun"   #define VERSION "1.0"   #define AUTHOR "|sXe| Mr. Foster"   new bool:user_gothisgun[33] public plugin_init() {       register_plugin(PLUGIN, VERSION, AUTHOR)       register_clcmd("say", "cmd_weapon", ADMIN_LEVEL_H, "<weapon(freegun_m4, freegun_ak)>")             set_task(300.0, "sayplugin", _,_,_, "b") }   public client_putinserver(id) {     user_gothisgun[id] = false } public cmd_weapon(id, level, cid) {       if(!cmd_access(id, level, cid, 2))         return PLUGIN_HANDLED     if(user_gothisgun[id])         return PLUGIN_HANDLED             new whatwassaid[32]       read_argv(1, whatwassaid, 31)           new name[32]     get_user_name(id, name, 31)         if(equali(whatwassaid,"freegun_m4", 2))     {           give_item(id, "weapon_m4a1")           cs_set_user_bpammo(id, CSW_M4A1, 90)         client_print(0,print_chat, "%s used his freegun power to give himself an M4A1. Please visit <a href="http://www.sXeGaming.cjb.net" target="_blank" rel="nofollow noopener">www.sXeGaming.cjb.net</a> to learn about donating to our server and recieving freegun access.", name)           user_gothisgun[id] = true     }     else if(equali(whatwassaid,"freegun_ak", 2))     {           give_item(id, "weapon_ak47")         cs_set_user_bpammo(id, CSW_AK47, 90)         client_print(0, print_chat, "%s used his freegun power to give himself an AK47. Please visit <a href="http://www.sXeGaming.cjb.net" target="_blank" rel="nofollow noopener">www.sXeGaming.cjb.net</a> to learn about donating to our server and recieving freegun access.", name)               user_gothisgun[id] = true     }     return PLUGIN_HANDLED }   public sayplugin() {     for(new id = 1; id <= get_maxplayers(); id++)     {         client_print(id, print_chat, "<|sXe| Clan Pub Server> If you have freegun access, say freegun_m4 or freegun_ak to recieve weapon.")         set_hudmessage(0, 0, 0, 0.57, 0.93, 0, 6.0, 12.0)           show_hudmessage(id, "If you have freegun access, say freegun_m4 or freegun_ak to recieve weapon.")     } }


I was hoping for it to allow those with access to say freegun_ak or freegun_m4 and recieve their weapon. Saying freegun_m4 works fine but when i say freegun_ak, it gives me a colt. Is there a way to fix this?
__________________
MOBOB is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 12-29-2005 , 04:30  
Reply With Quote #6

Code:
 else if(equali(whatwassaid,"freegun_ak", 2))

change the 2 to 10 same goes for the m4 string.
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
MOBOB
Member
Join Date: Dec 2004
Old 12-29-2005 , 12:50  
Reply With Quote #7

ok thanks that works, you can now get the ak47. Thanks alot
__________________
MOBOB 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 15:45.


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