Raised This Month: $ Target: $400
 0% 

How to remember value?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 08-07-2013 , 10:11   How to remember value?
Reply With Quote #1

I have trouble when remember value. I want to remember first value when I killed someone, and when I kill again, the first value moves to the third value. The problem is after killing player, the first value replaced not moved to the second, how was it?

PHP Code:
public dead(id)
{
    new 
killervictimhstargawpnid
    killer 
read_data(1)
    
victim read_data(2)
    
hs read_data(3)
    
wpnid get_user_weapon(killer)
    
    
chain_stopper kills[victim]
    
    new 
Float:timeleft get_gametime()-timekill[killer]
    if (
timeleft <= 9999kills[killer] += 1
    
else kills[killer] = 1
    
if (kills[killer])
    
timekill[killer] = get_gametime()

    if (!
piercing_shot[killer]) piercing_shot[killer] = 1
    
if (!timeleftpiercing_shot[killer] += 1
    
else piercing_shot[killer] = 1
    piercing_shot
[killer] = min(3piercing_shot[killer])
    
    if (
kills[killer])
    {
        
targa 1
    
}
    
// piercing shot
    
if (piercing_shot[killer] == 2)
    {
        
kills[killer] = kills[killer] - 1
        targa 
2
    
}
    else if (
piercing_shot[killer] == 3)
    {
        
kills[killer] = kills[killer] - 2
        targa 
3
    
}
    else if (
piercing_shot[killer] == 4)
    {
        
kills[killer] = kills[killer] - 3
        targa 
4
    
}
    if (
wpnid == CSW_KNIFE)
    {
        
// knife kill
        
targa 5
    
}
    if (
chain_stopper >= 4)
    {
        
// chain stopper
        
targa 6
    
}
    if (
hs)
    {
        
// hs
        
targa 7
    
}
    if (
hs && (wpnid == CSW_KNIFE))
    {
        
// hs with knife
        
targa 8
    
}
    if (
chain_stopper >= && (wpnid == CSW_KNIFE))
    {
        
// chain stopper & HS
        
targa 9
    
}
    if (
chain_stopper >= && hs)
    {
        
// chain stopper & HS
        
targa 10
    
}
    if (
chain_stopper >= && hs && (wpnid == CSW_KNIFE))
    {
        
// chain stopper & HS
        
targa 11
    
}
    
    
client_print(idprint_chat"%i"targa)
    
    
    new 
frag1[32], frag2[32], frag3[32], frag4[32], frag5[32], frag6[32], frag7[32], frag8[32], frag9[32]
    
    new 
firstsecondthirdfourthfifthsixthseventheighthninth
    
    
if (!first)  // this part, first until ninth
        
first targa
    
if (kills[killer] == 2)
        
second first
    
if (kills[killer] == 3)
        
third second
    
if (kills[killer] == 4)
        
fourth third
    
if (kills[killer] == 5)
        
fifth fourth
    
if (kills[killer] == 6)
        
sixth fifth
    
if (kills[killer] == 7)
        
seventh sixth
    
if (kills[killer] == 8)
        
eighth seventh
    
if (kills[killer] == 9)
        
ninth eighth



Last edited by Randomize; 08-07-2013 at 10:12.
Randomize is offline
Old 08-07-2013, 13:11
LordOfNothing
This message has been deleted by ConnorMcLeod. Reason: troll, or posting random confusing code, or posting for posts count
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 08-07-2013 , 18:34   Re: How to remember value?
Reply With Quote #3

Quote:
Originally Posted by LordOfNothing View Post
nvault
don't post such stupid answers.. he wants to only know it in that function.. not to load/save it.

@randomize: you should clear a bit your code.. and then you will figure it out.
you could also use something like:

Code:
new iKills[ 9 ]; // this is global one

if( !iKills[ 0 ] )
    iKills[ 0 ] = karga;
    
for( new i = 8; i >1; i-- )
    iKills[ i ] = iKills[ i -1 ];

Last edited by red_bull2oo6; 08-08-2013 at 06:25.
red_bull2oo6 is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 08-07-2013 , 14:34   Re: How to remember value?
Reply With Quote #4

You mean in subsequent calls to same function?

Use static
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 08-07-2013 , 23:27   Re: How to remember value?
Reply With Quote #5

Okay I will try.
Randomize 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 15:57.


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