Raised This Month: $51 Target: $400
 12% 

array must be indexed ?


Post New Thread Reply   
 
Thread Tools Display Modes
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 11-26-2017 , 11:08   Re: array must be indexed ?
Reply With Quote #11

Quote:
Originally Posted by undead52 View Post
PHP Code:
        Killer read_data(1)
        
gKill[Killer]++;//i shouldnt get on Killer , if i could do gKill[szName],i could print it too on dhudmessage, but i cant because gKill[Killer] dont work or id 
gKill[Killer]++ it's integer, not a string )))
Operation ++ its same as N+1, and instead, -- its a N-1
I wrote to you how You can parse names. But you can show massge and recive string(PName) without arrays

gKill[Killer]++ in this situation as Frag Counter, if you want to parse plname you can use String Arrays or make stock and recive string as const

Last edited by ZASTRELIS; 11-26-2017 at 11:12.
ZASTRELIS is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 11-26-2017 , 11:11   Re: array must be indexed ?
Reply With Quote #12

if you want to use a string as the key then you have to look at tries (https://forums.alliedmods.net/showthread.php?t=201872)
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
Old 11-26-2017, 15:04
undead52
This message has been deleted by undead52.
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 11-27-2017 , 11:41   Re: array must be indexed ?
Reply With Quote #13

what are you trying to do. because it`s still unclear
__________________
retired chump
DjSoftero is offline
TheWhitesmith
Senior Member
Join Date: Oct 2017
Location: Morocco :c
Old 11-27-2017 , 12:12   Re: array must be indexed ?
Reply With Quote #14

Quote:
Originally Posted by DjSoftero View Post
what are you trying to do. because it`s still unclear
He wants to get values from an array using string instead of int, which is incorrect.
As aron9forever said, use Tries as they will fit into what you need (TrieGetCell/TrieSetCell), you can then save & get values (ints) using Strings.
__________________
TheWhitesmith is offline
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 11-27-2017 , 13:41   Re: array must be indexed ?
Reply With Quote #15

Quote:
Originally Posted by aron9forever View Post
if you want to use a string as the key then you have to look at tries (https://forums.alliedmods.net/showthread.php?t=201872)
But he don't need that I'm pretty sure... Also he don't understand the arrays, how do you expect to understand tries..

Last edited by KiLLeR.; 11-27-2017 at 13:42.
KiLLeR. is offline
TheWhitesmith
Senior Member
Join Date: Oct 2017
Location: Morocco :c
Old 11-27-2017 , 13:46   Re: array must be indexed ?
Reply With Quote #16

Quote:
Originally Posted by KiLLeR. View Post
But he don't need that I'm pretty sure...
Yup he doesnt, because he may just get user xp or stats on client putinserver. I dont know why he would save it on the client name but if he really wants to, Tries are the solution.
__________________
TheWhitesmith is offline
undead52
Senior Member
Join Date: Dec 2016
Old 11-27-2017 , 14:53   Re: array must be indexed ?
Reply With Quote #17

i count players' frags, in dhudmessage gKill[Killer] show last killer score because it refresh at every kill, this is the problem it should be for player kills.

buyuk is the highest score, no problem at it,
PHP Code:
public hud(id){
 
    if(
scor == 1){
        
set_dhudmessage153204255,    -1.00.101.01.0 );
        
show_dhudmessage(id"[ %d / %d ]"gKill[Killer], buyuk)//
    
}
 
}

public 
event_death(id)
{
    if(
scor == 1){
        
        
        
Killer read_data(1)
        
gKill[Killer]++;

        
        if(
gKill[Killer] > buyuk){
                
            
buyuk gKill[Killer];
                
        }

    }


Last edited by undead52; 11-27-2017 at 14:55.
undead52 is offline
TheWhitesmith
Senior Member
Join Date: Oct 2017
Location: Morocco :c
Old 11-27-2017 , 15:26   Re: array must be indexed ?
Reply With Quote #18

I dont understand what you need, this is what I tried to understand
PHP Code:
public hud(idKiller){
 
    if(
scor == 1){
        
set_dhudmessage153204255,    -1.00.101.01.0 );
        
show_dhudmessage(id"[ %d / %d ]"gKill[Killer], buyuk)//
    
}
 
}

public 
event_death(id)
{
    if(
scor == 1){
        
        
        
Killer read_data(1)
        
Victim read_data(2)
        
gKill[Killer]++;
        
        
        if(
gKill[Killer] > buyuk){
            
            
buyuk gKill[Killer];
            
        }
        
        
hud(VictimKiller)
    }

__________________
TheWhitesmith is offline
undead52
Senior Member
Join Date: Dec 2016
Old 11-27-2017 , 15:30   Re: array must be indexed ?
Reply With Quote #19

this shows [ Player score / Highest score ], but gKill[Killer] shows last killer score for everyone,that is the problem, i want to show everyone to himself score
PHP Code:
show_dhudmessage(id"[ %d / %d ]"gKill[Killer], buyuk)// 

Last edited by undead52; 11-27-2017 at 15:30.
undead52 is offline
TheWhitesmith
Senior Member
Join Date: Oct 2017
Location: Morocco :c
Old 11-27-2017 , 15:49   Re: array must be indexed ?
Reply With Quote #20

Man, I do not understand you. Please say what you need in steps like this:
1- Killer kills Victim
2- 1 XP is added to Killer stats
3- Hud shown to Victim showing Killer XP / Highest Score
4- etc...
__________________
TheWhitesmith is offline
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 07:09.


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