Raised This Month: $ Target: $400
 0% 

[HELP]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-21-2017 , 10:48   [HELP]
Reply With Quote #1

Hello.

Code:
new const g_weaps[] =
{
    "weapon_357",
    "weapon_9mmAR",
    "weapon_9mmhandgun",
    "weapon_crossbow",
    "weapon_crowbar",
    "weapon_egon",
    "weapon_gauss",
    "weapon_handgrenade",
    "weapon_hornetgun",
    "weapon_rpg",
    "weapon_satchel",
    "weapon_shotgun",
    "weapon_snark",
    "weapon_tripmine"
}
How can i check if arg2 contains an item from this list, and if it does, to give_item(player,arg2) ?
Thanks !
DarthMan is offline
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 03-21-2017 , 11:03   Re: [HELP]
Reply With Quote #2

explain to us more....
__________________
D3XT3R is offline
Send a message via Skype™ to D3XT3R
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-21-2017 , 11:05   Re: [HELP]
Reply With Quote #3

Quote:
Originally Posted by D3XT3R View Post
explain to us more....
Well, I amde a command max_give_weapon Usage : player, weapon
I want to check if arg2 contains an item from the g_weaps enumeration to give the player the item from arg2 and display the emssages.Else, it should jsut display a message that the weapon is not valid.

Code:
give_item(player,arg2)
console_print(id, "Admin %s gave %s ^"%s^".", g_szPlayerName,player,arg2)
client_print(0,print_chat,"* Admin %s gave %s ^"%s^".", g_szPlayerName,player,arg2)

Last edited by DarthMan; 03-21-2017 at 11:07.
DarthMan is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-21-2017 , 11:28   Re: [HELP]
Reply With Quote #4

Code:
for ( new i; i < sizeof g_weaps; i++ ) if( contain( arg2, g_weaps[ i ] ) )
__________________
edon1337 is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-21-2017 , 11:30   Re: [HELP]
Reply With Quote #5

Quote:
Originally Posted by edon1337 View Post
Code:
for ( new i; i < sizeof g_weaps; i++ ) if( contain( arg2, g_weaps[ i ] ) )
But that will loop the messages for every i
It gave me a client overflow
I have tried with a var, but the text is displayed no matter what I type on arg2.

Last edited by DarthMan; 03-21-2017 at 11:46.
DarthMan is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 03-21-2017 , 12:17   Re: [HELP]
Reply With Quote #6

Use Trie for this.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-21-2017 , 12:22   Re: [HELP]
Reply With Quote #7

Quote:
Originally Posted by PRoSToTeM@ View Post
Use Trie for this.
Wut do u mean?
DarthMan is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-21-2017 , 16:19   Re: [HELP]
Reply With Quote #8

This array is wrong sized ( new const g_weaps[] ) should be like this >> ( new const g_weaps[][] )


And btw what edon post is right. Btw u dont get overflow unless u put in the msg in the loop
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 03-21-2017 at 16:22.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-21-2017 , 16:37   Re: [HELP]
Reply With Quote #9

Quote:
Originally Posted by Natsheh View Post
This array is wrong sized ( new const g_weaps[] ) should be like this >> ( new const g_weaps[][] )


And btw what edon post is right. Btw u dont get overflow unless u put in the msg in the loop
The plug-in is almost done, there's only 1 small error that have to be fixed.

Last edited by DarthMan; 03-21-2017 at 16:37.
DarthMan is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-21-2017 , 19:51   Re: [HELP]
Reply With Quote #10

I assume we need to guess what that is. I'll go first - a turtle is born upside down every time you use the plugin.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 17:58.


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