Raised This Month: $95 Target: $400
 23% 

Weap Restrist


Post New Thread Reply   
 
Thread Tools Display Modes
_KaszpiR_
AMX Mod X Beta Tester
Join Date: Feb 2004
Location: Warsaw, Poland
Old 03-16-2004 , 04:41  
Reply With Quote #11

Quote:
Originally Posted by tnsk8er27
ahh i dont understand!!!!!!!!!!!!!!!!
so at least stop posting useless posts
__________________
= Ave Cesar, morituri Te salutant. = http://nvt.prv.pl = http://hlds.pl/
_KaszpiR_ is offline
_KaszpiR_
AMX Mod X Beta Tester
Join Date: Feb 2004
Location: Warsaw, Poland
Old 03-16-2004 , 04:44  
Reply With Quote #12

MagicShot, as i said on irc
you may use
Code:
if(weap_disabled[weap])     {         first_time = true         weap_pend[weap] = 1         client_print(id,print_console," weap_msg[weap] ")     }else     {         weap_pend[weap] = 2         client_print(id,print_console," weap_msg[weap] ")     }
isntead of current code, a bit faster

also the weap_pend make a bool instead of int especially if it is a switch (or you may depcrecate the array and use a bitshifting)


also
09:40:26 (SniperBot) (MagicShot) when I do this
09:40:28 (SniperBot) (MagicShot) new weap_msg[CSMAX_WEAPONS][MAX_MSGLEN]
09:40:28 (SniperBot) (MagicShot) new weap_msg[usp][] = "[AMX] Set Weapon USP Disabled Mode"
09:409 (SniperBot) (MagicShot) it says weap_msg already defined


uou use new twice, the first with MAX values and the second you try to define array with a specified value
just remove the new in the second line and it should work

finally
decide if you use weap_msg["usp"] or weap_msg[usp]
as i understanded it on irc you want to parse a string so

but then the currweap is wrong anw the weap = read_argv is wrong
cause it should be at least
new weap[32]
read_argv(1,weap,31)
__________________
= Ave Cesar, morituri Te salutant. = http://nvt.prv.pl = http://hlds.pl/
_KaszpiR_ is offline
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-16-2004 , 05:09   Here is What I have atm
Reply With Quote #13

Code:
#include <amxmodx> #include <amxmisc> #define CSMAX_WEAPONS 30 + 1 #define MAX_MSGLEN 64 new weap_pend[5] new weap_disabled[64] new weap_msg[32][64]     weap_msg["usp"] = "[AMX] Set Weapon USP Disabled Mode"     // new bool:first_time = false public checkweap(id,level,cid) {     new weap[32]     read_argv(1,weap,31)     weap = read_argv(1,weap,31)         if(weap_disabled[weap]) {         // first_time = true         weap_pend[weap] = 1         client_print(id,print_console,"%s",weap_msg[weap] )     }else {         weap_pend[weap] = 2         client_print(id,print_console,"%s", 2 )     }     return PLUGIN_HANDLED } public plugin_init() {     register_plugin("Weapon Vote and Restrict","0.1","MagicShot")     register_cvar("amx_weaponrest","1",0)     register_clcmd("amx_magrest","checkweap",ADMIN_LEVEL_H,"amx_magrest : toggles restricted weapons eg. amx_magrest weaponname") }

The Compler Give me these errors:

Code:
Small compiler 2.1.0            Copyright (c) 1997-2002, ITB CompuPhase

new.sma(10) : error 010: invalid function or declaration
new.sma(19 -- 21) : error 033: array must be indexed (variable "weap")
new.sma(21) : error 033: array must be indexed (variable "weap")
new.sma(23) : error 033: array must be indexed (variable "weap")
new.sma(24) : error 033: array must be indexed (variable "weap")
new.sma(26) : error 033: array must be indexed (variable "weap")

6 Errors.
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
XAD
Senior Member
Join Date: Mar 2004
Location: Sweden
Old 03-16-2004 , 06:14   Re: Weap Restrist
Reply With Quote #14

Quote:
Originally Posted by MagicShot
I need some help I am working on a rewrite of my weap script that was like 5500 lines coded out.. I knew I could shorten it.
MagicShot, is there anything special with your version of weapon restrict compared to the default in AMXmod?? Or is this only an exercise to learn Small??

/X
XAD is offline
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-16-2004 , 13:56   Re: Weap Restrist
Reply With Quote #15

Quote:
Originally Posted by XAD
Quote:
Originally Posted by MagicShot
I need some help I am working on a rewrite of my weap script that was like 5500 lines coded out.. I knew I could shorten it.
MagicShot, is there anything special with your version of weapon restrict compared to the default in AMXmod?? Or is this only an exercise to learn Small??

/X
Actually Both... Its different from weapon restrist because if your playing a map and want to have just a certain gun it wont even let u pick it up, the 5500 liner works it just too long and I wanna learn small better..
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
pr0*killa
Member
Join Date: Mar 2004
Location: Estonia,Tallinn
Old 03-16-2004 , 15:00  
Reply With Quote #16

chatty!
__________________
"bug" is a verry big problem
pr0*killa is offline
Send a message via ICQ to pr0*killa
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-19-2004 , 01:16   hmm
Reply With Quote #17

Compiles with no Errors?
What am I not Seeing?
Hmm Enabling Weapongs dont work.. argh!

Code:
#include <amxmodx> #include <amxmisc> #include <string> // #define CSMAX_WEAPONS 30 + 1 // ** Future Feature ** // #define AMX_MOD // ** Future Feature ** new MsgControl = 0 // new weaponname[29][] = {"usp", "glock", "deagle", "p228" , "elites" , "fiveseven" , "pistols" , "pump" , "auto" , "shotguns" , "mac10" , "ump45" , "mp5" , "tmp", "p90" , "submachinegun" , "ak47" , "sg552" , "colt" , "aug" , "scout" , "awp" , "g3sniper" , "sgsniper" , "zoomed" , "scoped", "zoomscope" , "rifles" , "para"} // ** Old Weapons Aray ** new weaponname[31][] = {"pistols", "p228", "shotguns", "scout", "submachineguns", "auto", "zoomed", "mac10", "aug", "scoped", "elites", "fiveseven", "ump45", "sgsniper", "zoomscope", "rifles", "usp", "glock", "awp", "mp5", "para", "pump", "colt", "tmp", "g3sniper", "25", "deagle", "sg552", "ak47", "knife", "p90"} new weap_disabled[64] new weap_pend[32] new curweap new bool:first_time = false public checkweap(id,level,cid) {     // client_print(id,print_console,"[Debug] Running CheckWeap" ) // ** [Debug] Feature **     new weap[32]     read_argv(1,weap,31)     new i = 0     while (++i <= 31) {         // client_print(id, print_console, "wpname=^"%s^", weap=^"%s^"", weaponname[i], weap) // ** [Debug] Feature **         if (containi(weaponname[i], weap)!=-1)         {             curweap = i         }     }         if (weap_disabled[curweap] == 0) {         first_time = true         weap_pend[curweap] = 1         client_print(id,print_console,"%s", curweap )         client_print(id,print_console,"%s", weaponname[curweap][0] )     }else {         weap_pend[curweap] = 2         client_print(id,print_console,"%s", curweap )         client_print(id,print_console,"%s", weap_pend[curweap] )     }     return PLUGIN_HANDLED } public dropthatweapon(id) {     new weapon, ammo, wep     weapon = get_user_weapon(id,wep,ammo)     new wepi = read_data(2)     client_print(id,print_console,"[DEBUG] FDrop That Weap Ran")     if (get_cvar_num("amx_weaponrest") == 0)         return PLUGIN_HANDLED     if(first_time == true) {         client_print(id,print_console,"[DEBUG] First Time Ran")         return PLUGIN_HANDLED     }     if (weap_disabled[wepi] == 1) {         if (weap_pend[wepi] == 1 || weap_pend[wepi] == 2 ) {             client_print(id,print_chat,"[AMX]  Hey butterfingers!  Dont waste your time and money. That Weapon is Disabled")             weapon = get_user_weapon(id,wep,ammo)             // console_print(id,"[DEBUG] weapon: %d, wep: %d, ammo: %d", weapon,wep,ammo) // ** [Debug] Feature **             disarm_player(id,weapon)         }     }        return PLUGIN_HANDLED } public RestartRoundTask() {     if (get_cvar_num("amx_weaponrest") == 0)         return PLUGIN_HANDLED     MsgControl = 0     server_print("[AMX] Restarted Round Commands")     set_task(0.2,"delayed_rs")     return PLUGIN_CONTINUE } disarm_player(victim, weapon){     new wpname[32]     new parm[2]     parm[0]=victim     get_weaponname(weapon,wpname,31)     engclient_cmd(victim,"drop",wpname)     return PLUGIN_CONTINUE } public roundend_cleanup(){     if (get_cvar_num("amx_weaponrest") == 0)         return PLUGIN_HANDLED     MsgControl = 0     return PLUGIN_CONTINUE } public round_start(){     if (get_cvar_num("amx_weaponrest") == 0)         return PLUGIN_HANDLED     set_task(0.2,"delayed_rs")     return PLUGIN_CONTINUE } public delayed_rs(){     if (get_cvar_num("amx_weaponrest") == 0)         return PLUGIN_HANDLED     if(MsgControl == 1){         server_print("[AMX] MsgControl is 1 Plugin Handled")         return PLUGIN_HANDLED     }     MsgControl = 1     if(first_time == true){         set_hudmessage(63,187,239, -1.0, 0.47, 2, 0.02, 4.5, 0.01, 0.1, 4)         first_time = false     }else{         set_hudmessage(63,187,239, -1.0, 0.73, 2, 0.02, 4.5, 0.01, 0.1, 4)     }     new j     while (j++ <= 31) {         if (weap_pend[j] == 2) {             weap_pend[j] = 1             weap_disabled[j] = 0         }     }     new k     while (k++ <= 31) {         if (weap_pend[k] == 1) {             weap_pend[k] = 1             weap_disabled[k] = 1         }     }     return PLUGIN_CONTINUE } public plugin_init() {     register_plugin("Weapon Vote and Restrict","0.1","MagicShot")     register_cvar("amx_weaponrest","1",0)     // register_cvar("amx_weaponwait","1",0) ** Future Feature **     register_cvar("amx_xtra_wep_msg","1")     register_clcmd("amx_magrest","checkweap",ADMIN_USER,"amx_magrest : toggles restricted weapons eg. amx_magrest weaponname")     register_event("CurWeapon","dropthatweapon","b","1=1")     register_event("TextMsg","RestartRoundTask","a","2&#Game_will_restart_in")     register_event("SendAudio","round_start","bc","2=%!MRAD_GO","2=%!MRAD_MOVEOUT","2=%!MRAD_LETSGO","2=%!MRAD_LOCKNLOAD")     register_event("SendAudio","roundend_cleanup","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw") }
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
_KaszpiR_
AMX Mod X Beta Tester
Join Date: Feb 2004
Location: Warsaw, Poland
Old 03-19-2004 , 07:40  
Reply With Quote #18

see this nearline 47
Code:
    for (i=0; i<=32; i++) {

and see this near line 11
Code:
new weaponname[29][] = {"usp", "glock", "deagle", "p228" , "elites" , "fiveseven" , "pistols" , "pump" , "auto" , "shotguns" , "mac10" , "ump45" , "mp5" , "tmp", "p90" , "submachinegun" , "ak47" , "sg552" , "colt" , "aug" , "scout" , "awp" , "g3sniper" , "sgsniper" , "zoomed" , "scoped", "zoomscope" , "rifles" , "para"}

you are riding out of the array size, the i should be max 29 (sorta... )

thats why i suggest using while ( ) statement
__________________
= Ave Cesar, morituri Te salutant. = http://nvt.prv.pl = http://hlds.pl/
_KaszpiR_ is offline
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-19-2004 , 14:17  
Reply With Quote #19

Quote:
Originally Posted by _KaszpiR_
see this nearline 47
Code:
    for (i=0; i<=32; i++) {

and see this near line 11
Code:
new weaponname[29][] = {"usp", "glock", "deagle", "p228" , "elites" , "fiveseven" , "pistols" , "pump" , "auto" , "shotguns" , "mac10" , "ump45" , "mp5" , "tmp", "p90" , "submachinegun" , "ak47" , "sg552" , "colt" , "aug" , "scout" , "awp" , "g3sniper" , "sgsniper" , "zoomed" , "scoped", "zoomscope" , "rifles" , "para"}

you are riding out of the array size, the i should be max 29 (sorta... )

thats why i suggest using while ( ) statement
How Does this Look? Above was edited with this also..
Does anyone see anythinf else?

Code:
weapname() {     new i = 0     while (i++ < 29) {         if (weaponname[i][0] == weap) {             curweap = i             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE }
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-20-2004 , 08:13   There is what I have...
Reply With Quote #20

Ok Here Is what I have So far..
I can't seem to get the bool:first_time to work right

Code:
bool:first_time[32]

Code:
#include <amxmodx> #include <amxmisc> #include <string> new MsgControl = 0 new const weaponname[31][] = {"pistols", "p228", "shotguns", "scout", "submachineguns", "auto", "zoomed", "mac10", "aug", "scoped", "elites", "fiveseven", "ump45", "sgsniper", "zoomscope", "rifles", "usp", "glock", "awp", "mp5", "para", "pump", "colt", "tmp", "g3sniper", "25", "deagle", "sg552", "ak47", "knife", "p90"} new weap_disabled[64] new weap_pend[32] new curweap // new bool:first_time = false new bool:first_time[32]         public checkweap(id,level,cid) {     new weap[32]     read_argv(1,weap,31)     new i = 0     while (++i <= 31) {         if (containi(weaponname[i], weap)!=-1) {             curweap = i             client_print(id, print_console, "wpname=^"%s^", weap=^"%s^", inc=^"%s^"", weaponname[i], weap, curweap)         }     }     if (weap_disabled[curweap] == 0) {         first_time[curweap] = true         weap_pend[curweap] = 1         client_print(id,print_console,"[DEBUG] Disable Weaps Next Round")     }else {         weap_pend[curweap] = 2         client_print(id,print_console,"[DEBUG] Enable Weaps Next Round")     }     return PLUGIN_HANDLED } public dropthatweapon(id) {     new weapon, ammo, wep     weapon = get_user_weapon(id,wep,ammo)     new const wepi = read_data(2)     if (get_cvar_num("amx_weaponrest") == 0)         return PLUGIN_HANDLED     if(first_time[wepi] == true) {         client_print(id,print_console,"[DEBUG] First Time Ran")         return PLUGIN_HANDLED     }         if (weap_disabled[wepi] == 1) {         // if (weap_pend[wepi] == 1) || (weap_pend[wepi] == 2) {         client_print(id,print_chat,"[AMX]  Hey butterfingers!  Dont waste your time and money. That Weapon is Disabled")         weapon = get_user_weapon(id,wep,ammo)         // console_print(id,"[DEBUG] weapon: %d, wep: %d, ammo: %d", weapon,wep,ammo) // ** [Debug] Feature **         disarm_player(id,weapon)     }     return PLUGIN_HANDLED } public RestartRoundTask() {     if (get_cvar_num("amx_weaponrest") == 0)         return PLUGIN_HANDLED     MsgControl = 0     set_task(0.2,"delayed_rs")     return PLUGIN_CONTINUE } disarm_player(victim, weapon){     new wpname[32]     new parm[2]     parm[0]=victim     get_weaponname(weapon,wpname,31)     engclient_cmd(victim,"drop",wpname)     return PLUGIN_CONTINUE } public roundend_cleanup(){     if (get_cvar_num("amx_weaponrest") == 0)         return PLUGIN_HANDLED     MsgControl = 0     return PLUGIN_CONTINUE } public round_start(){     if (get_cvar_num("amx_weaponrest") == 0)         return PLUGIN_HANDLED     MsgControl = 0     set_task(0.2,"delayed_rs")     return PLUGIN_CONTINUE } public delayed_rs(id){     if (get_cvar_num("amx_weaponrest") == 0)         return PLUGIN_HANDLED     if(MsgControl == 1){         return PLUGIN_HANDLED     }     MsgControl = 1     new h = 0     while (h++ <= 31) {         if (first_time[h] == true) {             set_hudmessage(63,187,239, -1.0, 0.47, 2, 0.02, 4.5, 0.01, 0.1, 4)             first_time[h] = false         }     }     /*     else{         set_hudmessage(63,187,239, -1.0, 0.73, 2, 0.02, 4.5, 0.01, 0.1, 4)     }     */     new j = 0     while (j++ <= 31) {         if ( (weap_pend[j] == 2) && (weap_disabled[j] == 1) ){             weap_pend[j] = 0             weap_disabled[j] = 0             //client_print(id, print_console, "wp_pend=^"%s^", weap_disabled=^"%s^"", weap_pend[16], weap_disabled[16])         }else if (weap_pend[j] == 1) {             weap_disabled[j] = 1             //client_print(id, print_console, "wp_pend=^"%s^", weap_disabled=^"%s^"", weap_pend[j], weap_disabled[j])         }     }        /*     new k = 0     while (k++ <= 31) {         if (weap_pend[k] == 1) {             weap_pend[k] = 2             weap_disabled[k] = 1             client_print(id, print_console, "wp_pend=^"%s^", weap_disabled=^"%s^"", weap_pend[k], weap_disabled[k])         }     */     return PLUGIN_CONTINUE } public plugin_init() {     register_plugin("Weapon Vote and Restrict","0.1","MagicShot")     register_cvar("amx_weaponrest","1",0)     register_cvar("amx_xtra_wep_msg","1")     register_clcmd("amx_magrest","checkweap",ADMIN_USER,"amx_magrest : toggles restricted weapons eg. amx_magrest weaponname")     register_event("CurWeapon","dropthatweapon","b","1=1")     register_event("TextMsg","RestartRoundTask","a","2&#Game_will_restart_in")     register_event("SendAudio","round_start","bc","2=%!MRAD_GO","2=%!MRAD_MOVEOUT","2=%!MRAD_LETSGO","2=%!MRAD_LOCKNLOAD")     register_event("SendAudio","roundend_cleanup","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw") }
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
Reply


Thread Tools
Display Modes

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 14:17.


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