Raised This Month: $7 Target: $400
 1% 

Attach float value to weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HSFighter
Veteran Member
Join Date: Aug 2007
Location: Flensburg - Germany
Old 02-22-2016 , 16:16   Attach float value to weapons
Reply With Quote #1

Hello people,

i try to attach a float value to a weapon.

PHP Code:
new String:g_WeaponNames[3][16] = { "weapon_a""weapon_b""weapon_c"};
new 
Float:num[3] = {1.02.03.0};

public 
OnPluginStart()
{
     
HookEvent("player_death"EventPlayerDeath);
}

public 
EventPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
     
decl String:weapon[255];
     
GetEventString(event"weapon"weaponsizeof(weapon)); 
     
     new 
key FindStringInArray(g_WeaponNamesweapon);

     
PrintToChatAll("Debug: \x04%.2f"num[key]);

But get an "error 035: arrgument type mismatch" on findstring line. :/

Any ideas?
Or know someone a better possibility to realize this?

Thank you for the effort.
__________________



Sorry for my very bad english
Greetings HSFighter
HSFighter is offline
Send a message via ICQ to HSFighter
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 02-22-2016 , 16:47   Re: Attach float value to weapons
Reply With Quote #2

As you can see FindStringInArray works only for adt arrays.

Edit: I guess you can use adt tries for this: CreateTrie, SetTrieValue and GetTrieValue.
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.

Last edited by KissLick; 02-22-2016 at 16:53.
KissLick is offline
HSFighter
Veteran Member
Join Date: Aug 2007
Location: Flensburg - Germany
Old 02-22-2016 , 19:23   Re: Attach float value to weapons
Reply With Quote #3

Very interesting. i try it.

Thank you KissLick
__________________



Sorry for my very bad english
Greetings HSFighter
HSFighter is offline
Send a message via ICQ to HSFighter
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 22:28.


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