Raised This Month: $ Target: $400
 0% 

wtf, cs_set_user_ammo not working?!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ThantiK
Senior Member
Join Date: Mar 2004
Location: Orlando, FL
Old 04-22-2004 , 00:49   wtf, cs_set_user_ammo not working?!
Reply With Quote #1

This is a complete rip/modification of asskikrs unlimited ammo plugin...

I'm having trouble with the cs_set_user_ammo...as in, its NOT WORKING.

Code:
public changeWeapon(id) 
{ 
    if ( !AmmoMaster[id] ) return PLUGIN_CONTINUE 
    new  clip, ammo 

    if ( wpn_id==CSW_C4 || wpn_id==CSW_HEGRENADE || wpn_id == CSW_SMOKEGRENADE || wpn_id == CSW_FLASHBANG || wpn_id == CSW_KNIFE ) return PLUGIN_CONTINUE 
    
    // Never Run Out of Ammo! 
    server_print("STATUS ID=%d CLIP=%d, AMMO=%d WPN=%d", id, clip, ammo, wpn_id) 
    if ( clip < 5 ) 
    { 
    server_print("UNammo Function Running!") 
    cs_set_weapon_ammo(id, 10);
    }
    return PLUGIN_CONTINUE 
}
The function runs, but never sets the ammo!...wtf!
__________________
AMXX -- You want control? You got it.
tkwired.com cs 1.6 -- tkwired.com:27016
ThantiK is offline
Send a message via AIM to ThantiK Send a message via MSN to ThantiK
ts2do
Senior Member
Join Date: Mar 2004
Old 04-22-2004 , 01:04  
Reply With Quote #2

where are all the values coming from......post more code
ts2do is offline
Send a message via AIM to ts2do
BigBaller
Veteran Member
Join Date: Mar 2004
Location: Everett, WA
Old 04-22-2004 , 01:22  
Reply With Quote #3

maybe use the small tags instead of the code tags too only because i like the pretty colors, makes it easier to read.
__________________

BigBaller is offline
ThantiK
Senior Member
Join Date: Mar 2004
Location: Orlando, FL
Old 04-22-2004 , 01:35  
Reply With Quote #4

Code:
public plugin_init() {    register_event("CurWeapon","changeWeapon","be","1=1")

Thats whats calling the function...guys, the function runs, the ID I'm guessing is being passed by the event...the function runs...

heres all of it...I'm just trying to change it some...its not my plugin.

Code:
/* AMX Mod script. * * Made by AssKicR * * This file is provided as is (no warranties). * * Desripion: * Give Players Unlimited Ammo. * * Commands: * amx_ammo <authid, nick, @team or #userid>   // Unlimited Ammo * amx_unammo <authid, nick, @team or #userid> // Reset to normal * * Cvars: * sv_dropwpn   - Drops his weapon when he gets more ammo * sv_oneround  - Removes unlimited ammo power every new round * * Eksamples: * Give AssKicR Unlimited Ammo            - amx_ammo AssKicR * Remove AssKicRs Unlimited Ammo         - amx_unammo AssKicR * Give all CT unlimited Ammo            - amx_ammo @CT * Remove unlimited Ammo from all Terrorists - amx_ammo @TERRORISTS * Give player #7 unlimited ammo            - amx_ammo #7 * * Credits:: * Psyko - The Idea * {HOJ} Batman & AssKicR - For making the orignal code that i stole ^_^ * *Changelog: *V 1.0 -- Original version *V 1.1 -- Added amx_ammo @ALL & amx_unammo @ALL * */   #include <amxmodx.inc> #include <amxmisc.inc> #include <fun.inc> #include <cstrike.inc> // VARIABLES new bool:AmmoMaster[33] //---------------------------------------------------------------------------------------------- public plugin_init() {    register_event("CurWeapon","changeWeapon","be","1=1")      register_plugin("Admin Ammo","1.0","AssKicR")      register_concmd("amx_ammo","admin_ammo",ADMIN_LEVEL_A,"<authid, nick, @team or #userid>")      register_concmd("amx_unammo","admin_unammo",ADMIN_LEVEL_A,"<authid, nick, @team or #userid>")    if (!cvar_exists("sv_dropwpn")) register_cvar("sv_dropwpn", "0" ) } //---------------------------------------------------------------------------------------------- public admin_ammo(id,level,cid) {    if (!cmd_access(id,level,cid,2))       return PLUGIN_HANDLED    new arg[32], name2[32]    get_user_name(id,name2,31)      read_argv(1,arg,31)    if ((arg[0]=='@') && (arg[1]!='A')) {       new players[32], inum       get_players(players,inum,"ae",arg[1])       if (inum==0){          console_print(id,"No clients in such team")          return PLUGIN_HANDLED       }       for(new a=0;a<inum;++a)          AmmoMaster[players[a]]=true       switch(get_cvar_num("amx_show_activity"))   {    case 2:   client_print(0,print_chat,"ADMIN %s: set unlimited ammo on all %s",name2,arg[1])    case 1:   client_print(0,print_chat,"ADMIN: set unlimited ammo on all %s",arg[1])       }       console_print(id,"All clients on %s have unlimited ammo",arg[1])    }    else if ((arg[0]=='@') && (arg[1]=='A') && (arg[2]=='L') && (arg[2]=='L')) {       new players[32], inum       get_players(players,inum,"")               for(new a=0;a<inum;++a)          AmmoMaster[players[a]]=true       switch(get_cvar_num("amx_show_activity"))   {    case 2:   client_print(0,print_chat,"ADMIN %s: set unlimited ammo on all players",name2)    case 1:   client_print(0,print_chat,"ADMIN: set unlimited ammo on all players")       }       console_print(id,"All clients have unlimited ammo")    }    else {       new player = cmd_target(id,arg,7)       if (!player) return PLUGIN_HANDLED       AmmoMaster[player]=true       new name[32]       get_user_name(player,name,31)       switch(get_cvar_num("amx_show_activity"))   {    case 2:   client_print(0,print_chat,"ADMIN %s: set unlimited ammo on %s",name2,name)    case 1:   client_print(0,print_chat,"ADMIN: set unlimited ammo on %s",name)       }       console_print(id,"Client ^"%s^" has unlimited ammo",name)    }    return PLUGIN_HANDLED   } //---------------------------------------------------------------------------------------------- public admin_unammo(id,level,cid) {    if (!cmd_access(id,level,cid,2))       return PLUGIN_HANDLED    new arg[32], name2[32]    get_user_name(id,name2,31)    read_argv(1,arg,31)    if ((arg[0]=='@') && (arg[1]!='A')){       new players[32], inum       get_players(players,inum,"ae",arg[1])       if (inum==0){          console_print(id,"No clients in such team")          return PLUGIN_HANDLED       }       for(new a=0;a<inum;++a)          AmmoMaster[players[a]]=false       switch(get_cvar_num("amx_show_activity"))   {    case 2:   client_print(0,print_chat,"ADMIN %s: removed unlimited ammo from all %s",name2,arg[1])    case 1:   client_print(0,print_chat,"ADMIN: Removed unlimited ammo from all %s",arg[1])       }       console_print(id,"No clients on %s have unlimited ammo",arg[1])    }    else if ((arg[0]=='@') && (arg[1]=='A') && (arg[2]=='L') && (arg[2]=='L')) {       new players[32], inum       get_players(players,inum,"")               for(new a=0;a<inum;++a)          AmmoMaster[players[a]]=false       switch(get_cvar_num("amx_show_activity"))   {    case 2:   client_print(0,print_chat,"ADMIN %s: removed unlimited ammo from all players",name2)    case 1:   client_print(0,print_chat,"ADMIN: removed unlimited ammo from all players")       }       console_print(id,"No clients have unlimited ammo")    }    else {       new player = cmd_target(id,arg,7)       if (!player) return PLUGIN_HANDLED       AmmoMaster[player]=false       new name[32]       get_user_name(player,name,31)       switch(get_cvar_num("amx_show_activity"))   {    case 2:   client_print(0,print_chat,"ADMIN %s: removed unlimited ammo from %s",name2,name)    case 1:   client_print(0,print_chat,"ADMIN: Removed unlimited ammo from %s",name)       }       console_print(id,"Client ^"%s^" doesn't have unlimited ammo",name)    }    return PLUGIN_HANDLED   } //---------------------------------------------------------------------------------------------- public changeWeapon(id) {     if ( !AmmoMaster[id] ) return PLUGIN_CONTINUE     new  clip, ammo     new wpn_id=get_user_weapon(id, clip, ammo);     new wpn[32]     if ( wpn_id==CSW_C4 || wpn_id==CSW_HEGRENADE || wpn_id == CSW_SMOKEGRENADE || wpn_id == CSW_FLASHBANG || wpn_id == CSW_KNIFE ) return PLUGIN_CONTINUE         // Never Run Out of Ammo!     server_print("STATUS ID=%d CLIP=%d, AMMO=%d WPN=%d", id, clip, ammo, wpn_id)     if ( clip < 5 )     {     server_print("UNammo Function Running!")     get_weaponname(wpn_id,wpn,31)     cs_set_weapon_ammo(id, 10);     }     return PLUGIN_CONTINUE } //----------------------------------------------------------------------------------------------
__________________
AMXX -- You want control? You got it.
tkwired.com cs 1.6 -- tkwired.com:27016
ThantiK is offline
Send a message via AIM to ThantiK Send a message via MSN to ThantiK
BigBaller
Veteran Member
Join Date: Mar 2004
Location: Everett, WA
Old 04-22-2004 , 03:09  
Reply With Quote #5

I believe last weekend AssKicR ported most of his plugins onto AMXX, soo maybe its already done?
__________________

BigBaller is offline
AssKicR
Veteran Member
Join Date: Mar 2004
Location: Norway-Europe(GTM+1)
Old 04-22-2004 , 09:35  
Reply With Quote #6

Grrrr. what are you trying to do to my plugin
__________________
My Plugins

Got ??
AssKicR is offline
ThantiK
Senior Member
Join Date: Mar 2004
Location: Orlando, FL
Old 04-22-2004 , 19:04  
Reply With Quote #7

I found the problem I believe...

ID is the ID of the weapon...not the ID of the player holding the weapon.

I'm doing this so its not so "barbaric"...since sv_dropwpn has to be 1 or else things get buggy (or says so in the code)...I just dont like the idea of giving the user the weapon for replenishing their ammo...I'm trying to find a better way.

I'd rather have it so the user doesn't keep getting weapons like that...how do you get a weaponid?

Sry asskickr, I just saw that and thought it was sloppy.
__________________
AMXX -- You want control? You got it.
tkwired.com cs 1.6 -- tkwired.com:27016
ThantiK is offline
Send a message via AIM to ThantiK Send a message via MSN to ThantiK
ThantiK
Senior Member
Join Date: Mar 2004
Location: Orlando, FL
Old 04-22-2004 , 19:07  
Reply With Quote #8

I'm also cutting the freakin code in 1/2 by making the command something like

amx_ammo [name] 1/0...that way you dont have 2 functions, and you can just add like 3/4 if statements to the pre-existing functions...code cleanup...thats all I'm doing.
__________________
AMXX -- You want control? You got it.
tkwired.com cs 1.6 -- tkwired.com:27016
ThantiK is offline
Send a message via AIM to ThantiK Send a message via MSN to ThantiK
QwertyAccess
Veteran Member
Join Date: Feb 2004
Location: Enjiru Layer
Old 04-22-2004 , 19:08  
Reply With Quote #9

i personally would rather have it toggle amx_ammo qwerty and it goes on again and it goes off
__________________
QwertyAccess is offline
ThantiK
Senior Member
Join Date: Mar 2004
Location: Orlando, FL
Old 04-22-2004 , 19:16  
Reply With Quote #10

I'm trying to use the way bailopan said would be best...its just figuring it all out w/o smalled anymore...lol, I gotta take that extra time to open .inc files and look up functions...time consuming.

I just like the plugins I use to not take "shortcuts"...and I like my commands formatted certain ways...I keep a "standard" in my operations.
__________________
AMXX -- You want control? You got it.
tkwired.com cs 1.6 -- tkwired.com:27016
ThantiK is offline
Send a message via AIM to ThantiK Send a message via MSN to ThantiK
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 15:16.


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