Raised This Month: $ Target: $400
 0% 

Camouflage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 02-27-2006 , 17:08   Camouflage
Reply With Quote #1

Hey egain
guess what? i was bored egain
This one is bigger, and far from ready.
But i dont know or it is right untill now.
The consept is simple: for 16000$ you can buy an enemy suit.
Code:
/* Plugin generated by AMXX-Studio */ // say \camouflage // say_team \camouflage // amxx_camouflage <1/0> #include <amxmodx> #include <fun> #include <cstrike> new PLUGIN[]="Camouflage" new AUTHOR[]="wouter" new VERSION[]="1.00" public plugin_init()     {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("amx_camouflage", "cmd_camouflage", ADMIN_SLAY, "<1/0>") } public cmd_camouflage(id, level, cid)     {     if Player(cs_get_user_money >= 1600)         {               if Player (CS_TEAM_CT)             {             if Player (is_user_alive)                 {                 if(cs_get_user_model(index,model[CS_CT_URBAN], len)                 {                     cs_set_user_model(index, const model[CS_T_TERROR])                 }                 else if (cs_get_user_model(index, model[CS_CT_GSG9], len)                 {                     cs_set_user_model(index, const model[CS_T_LEET])                 }                 else if (cs_get_user_model(index, model[CS_CT_GIGN], len)                 {                     cs_set_user_model(index,const model[CS_T_ARCTIC])                 }                 else if (cs_get_user_model(index,model [CS_CT_SAS], len)                 {                     cs_set_user_model(index, const model [CS_T_GUERILLA])                 }             }             if Player (CS_TEAM_T)                 {                 if Player (is_user_alive)                     {                     if(cs_get_user_model(index,model[CS_T_TERROR], len)                     {                         cs_set_user_model(index, const model[CS_CT_URBAN])                     }                     else if (cs_get_user_model(index, model[CS_T_LEET], len)                     {                         cs_set_user_model(index, const model[CS_CT_GSG9])                     }                     else if (cs_get_user_model(index, model[CS_T_ARCTIC], len)                     {                         cs_set_user_model(index,const model[CS_CT_GIGN])                     }                     else if (cs_get_user_model(index,model [CS_T_GUERILLA], len)                     {                         cs_set_user_model(index, const model [CS_CT_SAS])                     }                 }             }         }     } }
So far so good?
wouter is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 02-27-2006 , 17:31  
Reply With Quote #2

Far from it.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 02-27-2006 , 17:34  
Reply With Quote #3

can you give me a hint?
thx anyway
wouter is offline
Jordan
Veteran Member
Join Date: Aug 2005
Old 02-27-2006 , 17:43  
Reply With Quote #4

To start, on stuff like cs_get_user_model(index)

The index refers to a player index, which in this case would be id.
Second, don't use if Player(CS_Team_CT) or w/e.

Use this:

Code:
new CsTeams:team = cs_get_user_team(id)


You always have to use id in this case, so it isn't cs_get_user_money, it's cs_get_user_money(id).

And finally I think models are constant from Cstrike so you don't need to put const, or the little [].

Code:
/* Plugin generated by AMXX-Studio */ // say \camouflage // say_team \camouflage // amxx_camouflage <1/0> #include <amxmodx> #include <fun> #include <cstrike> new PLUGIN[]="Camouflage" new AUTHOR[]="wouter" new VERSION[]="1.00" new CTModels[] = {     "CS_CT_URBAN", "CS_CT_GSG9",     "CS_CT_GIGN", "CS_CT_SAS" } new TModels[] = {     "CS_T_TERROR", "CS_T_LEET",     "CS_T_ARCTIC", "CS_T_GUERILLA" } public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("amx_camouflage", "cmd_camouflage", ADMIN_SLAY, "<1/0>") // This is an admin command, not a /say command. } public cmd_camouflage(id, level, cid) {     new money = cs_get_user_money(id)     new CsTeams:team = cs_get_user_team(id)     if(!is_user_alive(id) && money < 16000)     {         client_print(id, print_chat, "You are not alive or do not have enough money!")         return PLUGIN_HANDLED;     }         if(team == CS_TEAM_CT)     {         cs_set_user_model(id, TModels)         return PLUGIN_CONTINUE;     }         else if(team == CS_TEAM_T)     {         cs_set_user_model(id, CTModels)         return PLUGIN_CONTINUE;     }     return PLUGIN_HANDLED }

You can try this, although I'm not sure if it will pick a random model.
Jordan is offline
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 02-27-2006 , 18:06  
Reply With Quote #5

i'll try to build further on this first thing in the morning.
thx man
wouter is offline
Jordan
Veteran Member
Join Date: Aug 2005
Old 02-27-2006 , 18:10  
Reply With Quote #6

No problem.
Jordan is offline
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 02-28-2006 , 08:31  
Reply With Quote #7

ok this is what i got:
Code:
/* Plugin generated by AMXX-Studio */   // say \camouflage   // say_team \camouflage   // amxx_camouflage <1/0>   #include <amxmodx>   #include <fun>   #include <cstrike>   new PLUGIN[]="Camouflage"   new AUTHOR[]="wouter"   new VERSION[]="1.00"   new CTModels[] = {     "urban", "gsg9",  //otherwise: Error: could not load file models/player/CS_CT_URBAN/CS_CT_URBAN.mdl     "gign", "sas" } new TModels[] =   {     "terror", "leet",     "artic", "guerilla" } public plugin_init()       {       register_plugin(PLUGIN, VERSION, AUTHOR)       register_clcmd("say /camouflage", "cmd_camouflage") }   public cmd_camouflage(id, level, cid)       {     new money = cs_get_user_money(id)     new CsTeams:team = cs_get_user_team(id)             if(!is_user_alive(id) && money < 16000)         {         client_print(id, print_chat, "You are not alive or do not have enough money!")         return PLUGIN_HANDLED;     }         if(team == CS_TEAM_CT)           {           cs_set_user_model(id, TModels)         cs_set_user_money(id, cs_get_user_money(id) - 16000)         client_print(id, print_chat, "You have bought a camouflage!")         set_hudmessage(255, 255, 255, -1.0, -1.0, 0, 6.0, 10.0)         show_hudmessage(id, "You have bought a camouflage!")         return PLUGIN_CONTINUE;     }           else if(team == CS_TEAM_T)           {         cs_set_user_model(id, CTModels)         cs_set_user_money(id, cs_get_user_money(id) - 16000)         client_print(id, print_chat, "You have bought a camouflage!")         set_hudmessage(255, 255, 255, -1.0, -1.0, 0, 6.0, 10.0)         show_hudmessage(id, "You have bought a camouflage!")         return PLUGIN_CONTINUE;     }     if(is_user_alive(id))  // Dont work         {         cs_reset_user_model(id)         return PLUGIN_HANDLED;     }     return PLUGIN_HANDLED; } /* To Do: set handycap: slow run => Float: get_user_maxspeed ( index ) / Float: set_user_maxspeed ( index, [ Float:speed = - 1.0 ] )           aim at person: tell in hud: enemy! && allie! => Float: get_user_aiming ( index, &id, &body, [ distance,default 9999 ] ) */
but when i die my model dont reset itself
Code:
if(is_user_alive(id))  // Dont work         {         cs_reset_user_model(id)         return PLUGIN_HANDLED;     }
what did i wrong?
thx
wouter is offline
Jordan
Veteran Member
Join Date: Aug 2005
Old 02-28-2006 , 18:02  
Reply With Quote #8

having

Code:
(is_user_alive(id)) //Says that if the user is alive then something will occur.

Code:
(!is_user_alive(id)) //Says that if the user is dead then something will occur.

All a matter of the ! ;)
Jordan is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 02-28-2006 , 19:48  
Reply With Quote #9

i think this would work, but even though the files exist dont u need a precache anyways? im not sure bout that...

is this supposed to last only for one round?

Code:
/* Plugin generated by AMXX-Studio */   // say \camouflage   // say_team \camouflage   // amxx_camouflage <1/0>   #include <amxmodx>   #include <fun>   #include <cstrike>   new PLUGIN[]="Camouflage"   new AUTHOR[]="wouter"   new VERSION[]="1.00"   new CTModels[] =   {       "urban", "gsg9",     "gign", "sas" }   new TModels[] =   {       "terror", "leet",     "artic", "guerilla" }   public plugin_init()       {       register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /camouflage", "cmd_camouflage")     register_clcmd("say /camouflage", "cmd_camouflage")     register_cvar("amx_camouflage", "1") }   public cmd_camouflage(id) {     if ( ! get_cvar_num("amxx_camouflage") )         return PLUGIN_HANDLED     new money = cs_get_user_money(id)     new CsTeams:team = cs_get_user_team(id)             if ( !is_user_alive(id) || money < 16000 ) {         client_print(id, print_chat, "You are not alive or do not have enough money!")         return PLUGIN_HANDLED;     }         i = random_num(0,3)         if (team == CS_TEAM_CT) {           cs_set_user_model(id, TModels[i])         cs_set_user_money(id, cs_get_user_money(id) - 16000)         client_print(id, print_chat, "You have bought a camouflage!")         set_hudmessage(255, 255, 255, -1.0, -1.0, 0, 6.0, 10.0)         show_hudmessage(id, "You have bought a camouflage!")         return PLUGIN_CONTINUE;       }           else if (team == CS_TEAM_T) {           cs_set_user_model(id, CTModels[i])         cs_set_user_money(id, cs_get_user_money(id) - 16000)         client_print(id, print_chat, "You have bought a camouflage!")         set_hudmessage(255, 255, 255, -1.0, -1.0, 0, 6.0, 10.0)         show_hudmessage(id, "You have bought a camouflage!")         return PLUGIN_CONTINUE;       }         if ( !is_user_alive(id) ) {         cs_reset_user_model(id)         return PLUGIN_HANDLED;     }         return PLUGIN_HANDLED; } /* To Do: set handycap: slow run => Float: get_user_maxspeed ( index ) / Float: set_user_maxspeed ( index, [ Float:speed = - 1.0 ] )   aim at person: tell in hud: enemy! && allie! => Float: get_user_aiming ( index, &id, &body, [ distance,default 9999 ] ) */
[ --<-@ ] Black Rose is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 02-28-2006 , 21:56  
Reply With Quote #10

to return their model on death, just register the deathmsg
Code:
register_event("DeathMsg", "user_death", "a")
then make a function like this
Code:
public user_death(id)
{
cs_reset_user_model(id)
}
i would suggest making a bool for if the users bought the camouflage that way your not just reseting everyones models, and it wont interfere with other plugins.

so i would suggest doing something like
Code:
public user_death(id)
{
	if(g_hasCamo[id]){
		cs_reset_user_model(id)
		g_hasCamo[id] = false
	}
}
to make the bool just after the
Code:
 new TModels[]
stuff and put
Code:
 new bool:g_hasCamo[33]
you would then have to make
Code:
g_hasCamo[id] = true
when they buy it
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
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 20:14.


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