Raised This Month: $ Target: $400
 0% 

help with roundstart


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LittleDude
Member
Join Date: Dec 2004
Location: Selah, WA
Old 03-03-2006 , 00:42   help with roundstart
Reply With Quote #1

ok im working on a plugin, and i have it to set you to a model, and every new round the model is still that model from the plugin, and I want it to change back to the normal model at the start of the round.

So what do I need to add to make it work? What I want to do is to create a new round event so that I can check the users model at the start of the round, to see if it is that model still, and if it is, then to reset the model...

How would I do this?

Code:
 #include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> #define PLUGIN "GorillaMode" #define VERSION "1.0" #define AUTHOR "LittleDude" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /gorillame", "gorillathem")     register_clcmd("say_team /gorillame", "gorillathem")     register_cvar("amx_gorilla", "1") } public plugin_precache(){     precache_model("models/player/gorilla/gorilla.mdl")     return PLUGIN_CONTINUE } public gorillathem(id){     if(get_cvar_num("amx_gorilla") == 0)         return PLUGIN_HANDLED         if(!is_user_alive(id)){     client_print(id, print_chat, "[Gorilla] You are dead and cannot go Gorilla Mode!")     return PLUGIN_HANDLED }         new health = get_user_health(id)         if(is_user_alive(id) && health >= 50){         client_print(id, print_chat, "[Gorilla] You have too much health to turn Gorilla mode!")         return PLUGIN_HANDLED             }     else if(health < 50){         set_user_health(id, 250)         set_user_armor(id, 250)         give_item(id, "weapon_m249")         give_item(id, "ammo_556nato")         give_item(id, "ammo_556nato")         cs_set_user_model(id, "gorilla")     }         client_print(id, print_chat, "[Gorilla] You have gone Gorilla Mode!")     return PLUGIN_HANDLED }

That is my code...and also the second thing is, when i do the give_item(id, "ammo_556nato") it never gives the ammo for the m249...so how do i make this work?[/small]
__________________
It is stupid to be stupid, and stupid to not be stupid
LittleDude is offline
Send a message via AIM to LittleDude
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 03-03-2006 , 00:50  
Reply With Quote #2

i would just hook when a user spawns and reset his model.

Code:
public plugin_init() {    register_event("ResetHUD","spawn","b");    register_clcmd("fullupdate","block"); } public spawn(id) {    new model[32];    cs_get_user_model(id,model,31);    if(equali(model,"gorilla"))       cs_reset_user_model(id); } public block(id) {    return PLUGIN_HANDLED; }

this hooks the ResetHUD message, which is most of the time called when a user spawns. it then sees if his current model is gorilla, and if so it resets it. one of the downfalls to using ResetHUD is that clients can call it whenever they want by typing "fullupdate" in console. that means someone could go gorilla and then reset his model so that no one would be able to tell.

to counteract this, we hook the command and return PLUGIN_HANDLED to stop it from doing anything.

also, try using "ammo_556natobox" as your ammo type.
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
LittleDude
Member
Join Date: Dec 2004
Location: Selah, WA
Old 03-03-2006 , 08:07  
Reply With Quote #3

Thanks, but when I add these, it compiles and gives me erorrs now.

Code:
 #include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> #define PLUGIN "GorillaMode" #define VERSION "1.0" #define AUTHOR "LittleDude" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("ResetHUD","spawn","b")     register_clcmd("fullupdate","block")     register_clcmd("say /gorillame", "gorillathem")     register_clcmd("say_team /gorillame", "gorillathem")     register_cvar("amx_gorilla", "1") } public plugin_precache(){     precache_model("models/player/gorilla/gorilla.mdl")     return PLUGIN_CONTINUE } public gorillathem(id){     if(get_cvar_num("amx_gorilla") == 0)         return PLUGIN_HANDLED         if(!is_user_alive(id)){     client_print(id, print_chat, "[Gorilla] You are dead and cannot go Gorilla Mode!")     return PLUGIN_HANDLED }         new health = get_user_health(id)         if(is_user_alive(id) && health >= 50){         client_print(id, print_chat, "[Gorilla] You have too much health to turn Gorilla mode!")         return PLUGIN_HANDLED             }     else if(health < 50){         set_user_health(id, 250)         set_user_armor(id, 250)         give_item(id, "weapon_m249")         give_item(id, "ammo_556natobox")         give_item(id, "ammo_556natobox")     }         client_print(id, print_chat, "[Gorilla] You have gone Gorilla Mode!")     return PLUGIN_HANDLED } public spawn(id) {    new model[32]    cs_get_user_model(id,model,31)    if(equali(model,"gorilla"))       cs_reset_user_model(id) } public block(id) {    return PLUGIN_HANDLED }

These are the errors:

Welcome to the AMX Mod X 1.60-300 Compiler.
Copyright (c) 1997-2005 ITB CompuPhase, AMX Mod X Team

Error: Symbol already defined: "spawn" on line 57
Error: Symbol already defined: "cs_get_user_model" on line 59
Error: Invalid function or declaration on line 61
Warning: Symbol is never used: "model" on line 67

3 Errors.
Could not locate output file C:\amx_gorilla.amx (compile failed).
__________________
It is stupid to be stupid, and stupid to not be stupid
LittleDude is offline
Send a message via AIM to LittleDude
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-03-2006 , 08:10  
Reply With Quote #4

include cstrike
and spawn() is allready a func u gonna have to rename it to player_spawn or sumthin
[ --<-@ ] Black Rose is offline
LittleDude
Member
Join Date: Dec 2004
Location: Selah, WA
Old 03-03-2006 , 08:14  
Reply With Quote #5

alright thanks, i changed it to player_spawn and player_spawn in the register_event and it compiled fine, thanks , YAY IT WORKS, thanks guys you've been a big help
__________________
It is stupid to be stupid, and stupid to not be stupid
LittleDude is offline
Send a message via AIM to LittleDude
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 20:13.


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