Raised This Month: $ Target: $400
 0% 

Client command to switch weapons?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jordan
Veteran Member
Join Date: Aug 2005
Old 12-16-2005 , 17:27   Client command to switch weapons?
Reply With Quote #1

Is there one? I need it

Or, better yet:

Can I use an array for a client cmd?

like this:

Code:
client_cmd(id, "drop", g_szPrimary)

ATM it doesn't work but I figured I did something wrong...
Jordan is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 12-16-2005 , 19:51  
Reply With Quote #2

you want them to switch weapon or drop weapons?
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Jordan
Veteran Member
Join Date: Aug 2005
Old 12-16-2005 , 20:09  
Reply With Quote #3

Well I know that
Code:
client_cmd(id, "drop")

Will drop the weapon that the player is currently holding. But, if the player is holding a m4 for example, I want him to switch his weapon to his sidearm so he can drop it.
Jordan is offline
DarlD
Senior Member
Join Date: Aug 2004
Old 12-16-2005 , 20:18  
Reply With Quote #4

bind "q" "lastinv"

i believe:

Code:
client_cmd(id, "lastinv")

try it out
__________________
DarlD is offline
Send a message via MSN to DarlD
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 12-16-2005 , 20:37  
Reply With Quote #5

Code:
client_cmd(id, "%s", g_szPrimary)

Code:
client_cmd(id, "slot2") client_cmd(id, "drop")
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 12-16-2005 , 20:51  
Reply With Quote #6

@ satanwoj

What the idea of your plugin anyways? So player don't have secondary?

Cause if you run what cheapsuit said.. and for some out of the blue he doesn't have a secondary. It try to drop what ever he is holding.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Jordan
Veteran Member
Join Date: Aug 2005
Old 12-16-2005 , 21:04  
Reply With Quote #7

Nah I'm gonna but lotsa if's in there

I'm making a plugin which enables players to buy guns from the other team.
Jordan is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 12-16-2005 , 21:07  
Reply With Quote #8

Code:
#define MAX_PISTOLS 6 new g_szPistolList[MAX_PISTOLS][] =   {     "weapon_usp",     "weapon_glock",     "weapon_elites",     "weapon_fiveseven",     "weapon_p228",     "weapon_deagle" } new weapons[32], wNum get_user_weapons(id, weapons, wNum) for(new a = 0; a < wNum; a++) {     for(new i = 0; i < MAX_PISTOLS; i++) if(equali(weapons[a], g_szPistolList[i]))     {         client_cmd(id, "%s", g_szPistolList[i])         client_cmd(id, "drop")     } }
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
Jordan
Veteran Member
Join Date: Aug 2005
Old 12-16-2005 , 21:22  
Reply With Quote #9

K this is where it gets weird. To start, the cs_set_user_money function doesn't work, and the weapons don't switch or drop. The weapon isn't added to the player either.

Code:
    new money = ((cs_get_user_money(id)) - dualies)     new money2 = ((cs_get_user_money(id)) - mac10)     new money3 = ((cs_get_user_money(id)) - galil)     new money4 = ((cs_get_user_money(id)) - ak47)     new money5 = ((cs_get_user_money(id)) - sg552)     new money6 = ((cs_get_user_money(id)) - g3sg1)         if (key == 0){           if(cs_get_user_money(id) < dualies){         client_print(id, print_chat, "You don't have enough money!")         return PLUGIN_HANDLED;         } else { new weapons[32], wNum   get_user_weapons(id, weapons, wNum);{   for(new a = 0; a < wNum; a++){         for(new i = 0; i < MAX_PISTOLS; i++) if(equali(weapons[a], g_szPistolList[i]))         {               client_cmd(id, "%s", g_szPistolList[i])               client_cmd(id, "drop")             give_item (id, "weapon_elite")         }         cs_set_user_money(id, money)           return PLUGIN_HANDLED         }           }         }

This is the only part of the plugin I'm actually testing atm. I have all the defines and new stuff up that the top of the plugin and it's all correct. P.S. Those final brackets really aren't where they look like.

Edit: And my whole "You don't have enough money!" things don't worik >.<
Jordan is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 12-16-2005 , 22:36  
Reply With Quote #10

Code:
{     "weapon_usp",     "weapon_glock",  // << it suppose to be weapon_glock18     "weapon_elites",     "weapon_fiveseven",     "weapon_p228",     "weapon_deagle" }


is this function a menu part of a menu?


you can change this
Code:
client_cmd(id, "%s", g_szPistolList[i])   client_cmd(id, "drop")

to
Code:
client_cmd(id, "drop %s", g_szPistolList[i])
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
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:11.


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