Raised This Month: $ Target: $400
 0% 

Help with concmd and knife only thing.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ev0d00b
Member
Join Date: Aug 2005
Location: Middle Earth
Old 03-25-2006 , 02:39   Help with concmd and knife only thing.
Reply With Quote #1

im newb and have made this plugin, and i'm wanting to add a knife function so that you can only go fast with a knife out if the knife cvar is turned on.

i also need help with amx_nosmod so that it toggles the sv_nosmod on and off.

also could i get some help adding a timming function to it please, say that it only last's bout 3 seconds then takes 10 seconds to load.

thanks a bunch.

could you please also tell me what you did to it?

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> #define PLUGIN "NOSMod" #define VERSION "0.1" #define AUTHOR "DeadlyGFX" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_cvar("sv_nosmod","1")     register_cvar("sv_nosmod_knife","1")     register_clcmd("+nos", "nos_on")     register_clcmd("-nos", "nos_off")     register_concmd("amx_nosmod","nosmod",ADMIN_SLAY,": toggle's NOSMod on and off")     } public nosmod(id,level,cid) { if (!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED if (get_cvar_num("sv_nosmod")==0) {     set_cvar_string("sv_nosmod","1")     server_print("NOSMod is now on!! bind [key] +nos. To use it.") }         else {     set_cvar_string("sv_nosmod","0")     server_print("NOSMod is now off!! The admin must be a fucken pussy!!") } return PLUGIN_HANDLED } public nos_on(id){     if (!get_cvar_num("sv_nosmod")||!is_user_alive(id))     return PLUGIN_HANDLED         if (get_cvar_num("sv_nosmod_knife")==0){     server_cmd ("sv_maxspeed 1500")     client_print(id,print_chat, "Hold on tight!!")     (set_user_maxspeed(id, 2000.0))     client_cmd(id, "cl_forwardspeed 1500");     client_cmd(id, "cl_sidespeed 1500");     client_cmd(id, "cl_backspeed 1500");     }     else {     if (get_cvar_num("sv_nosmod_knife")==1){     if (cs_get_weapon_id(id)==CSW_KNIFE){     server_cmd ("sv_maxspeed 1500")     client_print(id,print_chat, "Hold on tight!!")     (set_user_maxspeed(id, 2000.0))     client_cmd(id, "cl_forwardspeed 1500");     client_cmd(id, "cl_sidespeed 1500");     client_cmd(id, "cl_backspeed 1500");     }     else {     return PLUGIN_HANDLED     }     }     }     return PLUGIN_HANDLED     } public nos_off(id){     if (get_cvar_num("sv_nosmod")==0)     (set_user_maxspeed(id, 0.0))     client_cmd(id, "cl_forwardspeed 400");     client_cmd(id, "cl_sidespeed 400");     client_cmd(id, "cl_backspeed 400");     return PLUGIN_HANDLED }
__________________
ev0d00b is offline
Send a message via MSN to ev0d00b
VEN
Veteran Member
Join Date: Jan 2005
Old 03-25-2006 , 03:07  
Reply With Quote #2

- use code indentation
- cs_get_weapon_id(id)==CSW_KNIFE is incorrect since cs_get_weapon_id returns weapon's entity id but not weapon id
- use set_cvar_num to set sv_maxspeed
- set_user_maxspeed(id, 0.0) default player entity speed is 250.0 but not 0.0
VEN is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-25-2006 , 03:22  
Reply With Quote #3

Replace this:
Code:
    if (get_cvar_num("sv_nosmod")==0) {         set_cvar_string("sv_nosmod","1")         server_print("NOSMod is now on!! bind [key] +nos. To use it.")     }     else {         set_cvar_string("sv_nosmod","0")         server_print("NOSMod is now off!! The admin must be a fucken pussy!!")     }
with this:
Code:
    switch(get_cvar_num("sv_nosmod")) {         case 0: {             set_cvar_num("sv_nosmod" , 1);             client_print(0 , print_chat , "NOSMod is now on!! bind [key] +nos to use it");         }         case 1: {             set_cvar_num("sv_nosmod" , 1);             client_print(0 , print_chat , "NOSMod is now off!! The admin must be a fuckin pussy!!");         }     }

As for your other two functions:
Code:
public nos_on(id) {     if (!get_cvar_num("sv_nosmod") || !is_user_alive(id))         return PLUGIN_HANDLED         // set_cvar_num("sv_maxspeed", 1500); // do this in plugin_init or something     if (get_cvar_num("sv_nosmod_knife") == 0) {         client_print(id,print_chat, "Hold on tight!!");         set_user_maxspeed(id, 2000.0);         client_cmd(id, "cl_forwardspeed 1500");         client_cmd(id, "cl_sidespeed 1500");         client_cmd(id, "cl_backspeed 1500");     }     else {         new clip , ammo , weapon = get_user_weapon(id, clip, ammo);         if (weapon == CSW_KNIFE) {             client_print(id, print_chat, "Hold on tight!!")             set_user_maxspeed(id, 2000.0)             client_cmd(id, "cl_forwardspeed 1500");             client_cmd(id, "cl_sidespeed 1500");             client_cmd(id, "cl_backspeed 1500");         }         else {             client_print(id, print_chat, "Take your knife out!!");         }     }     return PLUGIN_HANDLED } public nos_off(id) {     if (get_cvar_num("sv_nosmod") == 1) {         set_user_maxspeed(id, 0.0)         client_cmd(id, "cl_forwardspeed 400");         client_cmd(id, "cl_sidespeed 400");         client_cmd(id, "cl_backspeed 400");     }     return PLUGIN_HANDLED }

Of course you're going to need to do more to get it perfected.
__________________
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
ev0d00b
Member
Join Date: Aug 2005
Location: Middle Earth
Old 03-25-2006 , 09:37  
Reply With Quote #4

thank's.

the nos_on and nos_off stuff works fine, but if i put sv_nosmod_knife 1 it doesn't work at all.

so i need to do something there sorry but im still ... a little noob.

but it works well when a user press +nos and then when they let go they stop that goes awesome but when i enable knifemode for it then it doesn't do anything at all, doesn't even print client message.
__________________
ev0d00b is offline
Send a message via MSN to ev0d00b
ev0d00b
Member
Join Date: Aug 2005
Location: Middle Earth
Old 03-25-2006 , 09:41  
Reply With Quote #5

Quote:
Originally Posted by VEN
- use code indentation
- cs_get_weapon_id(id)==CSW_KNIFE is incorrect since cs_get_weapon_id returns weapon's entity id but not weapon id
- use set_cvar_num to set sv_maxspeed
- set_user_maxspeed(id, 0.0) default player entity speed is 250.0 but not 0.0
also thanks i'm wasn't too sure bout cs_get_weapon_id so yea thanks.


also it says in the docs that set_user_maxspeed(id,0.0) will set it back to defualt.

and the sv_maxspeed changes quite well at the moe

but if i wanted to do it as cvar num i just do as

set_cvar_string("sv_maxspeed",1500)

?
__________________
ev0d00b is offline
Send a message via MSN to ev0d00b
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 16:34.


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