AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   NoScopeMode (https://forums.alliedmods.net/showthread.php?t=12263)

onfirenburnin420 04-10-2005 08:55

NoScopeMode
 
I just read over all of the "sniper" plugins i could find becasue im trying to make a plugin that lets you have unlittied ammo and only gives you a scout but its no scope ONLY. :) So If Any One Could Help??? Would Be Great

XxAvalanchexX 04-10-2005 16:33

You could try this, don't know if it will work:

Code:
public client_PreThink(id) {    if(!is_user_alive(id)) {       return PLUGIN_CONTINUE;    }    new button = get_user_button(id);    if(button & IN_ATTACK2) {       entity_set_int(id,EV_INT_button,button & ~IN_ATTACK2);    }    return PLUGIN_CONTINUE; }

onfirenburnin420 04-11-2005 15:18

Ok I Got This:
Code:
#include <amxmodx>   #include <fun> #include <engine> public plugin_init() { register_plugin("NoScopeMode","1.0","Fire") register_cvar("amx_scope","1") } public client_PreThink(id) { if (get_cvar_num("amx_scope") !=1) { return PLUGIN_CONTINUE; } if(!is_user_alive(id)) { return PLUGIN_CONTINUE; } new button = get_user_button(id); if(button & IN_ATTACK2) { entity_set_int(id,EV_INT_button,button & ~IN_ATTACK2); } return PLUGIN_CONTINUE; }
And It Works But Now I Just Need To Make A Csay Message...

v3x 04-11-2005 15:25

Use set_hudmessage() and show_hudmessage(). Also, this plugin will help you with the placement. :)

onfirenburnin420 04-11-2005 17:12

how would i toggle the hud_message for when the plugin is turned on or off.... example "No Scope Mode Has Just Been Enabled" or when you turn it off it says "No Scope Mode Has Now Been Disabled" plz help

v3x 04-11-2005 17:35

Something like this:
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <engine> public plugin_init() {     register_plugin("NoScopeMode","1.0","Fire")     register_clcmd("amx_scope","doScope",ADMIN_KICK,"- Turns scope mode on/off")     register_cvar("amx_noscope","1") } public client_PreThink(id) {     if (get_cvar_num("amx_noscope") !=1) {         return PLUGIN_CONTINUE     }     if(!is_user_alive(id)) {         return PLUGIN_CONTINUE     }     new button = get_user_button(id);     if(button & IN_ATTACK2) {         entity_set_int(id,EV_INT_button,button & ~IN_ATTACK2);     }     return PLUGIN_CONTINUE } public doScope(id,level,cid) {     if(!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     new arg[4]     read_argv(1,arg,3)     new cmd = arg[3]     if(cmd == 1) {         // set_hudmessage(...)         show_hudmessage(0,"No scope mode on")         set_cvar_num("amx_noscope",1)     }     else if(cmd == 0) {         // set_hudmessage(...)         show_hudmessage(0,"No scope mode off")         set_cvar_num("amx_noscope",1)     }     return PLUGIN_HANDLED }

Command: amx_scope <1|0>
Cvar: amx_noscope <1|0>

onfirenburnin420 04-11-2005 18:35

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <engine> public plugin_init() { register_plugin("NoScopeMode","1.0","Fire") register_cvar("amx_scope","1") register_clcmd("amx_scope 1","noscopeon",ADMIN_LEVEL_A,"- Turns No Scope Mode On") register_clcmd("amx_scope 0","noscopeoff",ADMIN_LEVEL_A,"- Turns No Scope Mode Off") } public client_PreThink(id) { if (get_cvar_num("amx_scope") !=0) { return PLUGIN_CONTINUE; } if(!is_user_alive(id)) { return PLUGIN_CONTINUE; } new button = get_user_button(id); if(button & IN_ATTACK2) { entity_set_int(id,EV_INT_button,button & ~IN_ATTACK2); } return PLUGIN_CONTINUE; } public noscopeon(id,lvl,cid) { if(!cmd_access(id,lvl,cid,2)) { server_cmd ("amx_scope 1") show_hudmessage(0,"No Scope Mode Is On") } return PLUGIN_HANDLED } public noscopeoff(id,lvl,cid) { if(!cmd_access(id,lvl,cid,2)) { server_cmd ("amx_scope 0") show_hudmessage(0,"No Scope Mode Is Off") } return PLUGIN_HANDLED }

Cant Get This To Work Wut Am I Doing Wrong???

xeroblood 04-11-2005 21:24

Try this
Code:
#include <amxmodx> #include <amxmisc> //#include <fun> #include <engine> public plugin_init() {     register_plugin("NoScopeMode","1.0","Fire")     register_cvar("sv_scope","1")     register_clcmd("amx_scope","ToggleScope",ADMIN_LEVEL_A,"<1|0> - Turns No Scope Mode On/Off") } public client_PreThink(id) {     if (!get_cvar_num("sv_scope"))         return PLUGIN_CONTINUE;     if(!is_user_alive(id))         return PLUGIN_CONTINUE;     new button = get_user_button(id);     if(button & IN_ATTACK2)         entity_set_int(id,EV_INT_button,button & ~IN_ATTACK2);     return PLUGIN_CONTINUE; } public ToggleScope(id,lvl,cid) {     if( !cmd_access(id,lvl,cid,1) )         return PLUGIN_HANDLED;     set_hudmessage(200, 100, 0, -1.0, 0.35, 0, 6.0, 12.0, 0.1, 0.2, 4);     new arg[4]     read_argv( 1, arg, 4 )     if( equali( arg, "on", 2 ) || equali( arg, "1", 1 ) )     {         set_cvar_num( "sv_scope", 1)         show_hudmessage(0,"No Scope Mode Is On")     }     else     {         set_cvar_num( "sv_scope", 0)         show_hudmessage(0,"No Scope Mode Is Off")     }     return PLUGIN_HANDLED }

Note:
You didnt need fun module included..
Also, you should follow the naming conventions used for CVARs and AMX commands, like:

Cvars start with 'sv_', which stands for 'Server Variable'
Commands start with 'amx_' which is self-explanitory.. (or 'amxx_')

Just helps users remember the command/cvar name..

Editted to reflect Avalanches keen eye from post below :D
(using all default values of course...)

XxAvalanchexX 04-11-2005 22:47

I think the problem here is that he isn't using set_hudmessage at all but trying to show one...

xeroblood 04-11-2005 23:10

:shock: :oops: I Totally missed that!! :P Good eye Avalanche!

I editted my post above, added:
(from amxmodx.inc)
Code:
native set_hudmessage(red=200, green=100, blue=0, Float:x=-1.0, Float:y=0.35, effects=0, Float:fxtime=6.0, Float:holdtime=12.0, Float:fadeintime=0.1, Float:fadeouttime=0.2,channel=4);


All times are GMT -4. The time now is 09:56.

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