Thread: [Solved] Save Player Data
View Single Post
tepegoz
Member
Join Date: Apr 2019
Old 12-26-2019 , 05:28   Re: Save Player Data
Reply With Quote #10

I solved my problem. I've added these codes to my sma. Yes this is the sample i want. All I wanted was these codes.
PHP Code:
new Trie:FragSIP
enum _
:kaydet {
    
SIP[32],
    
Kills,
    
Deaths
}
public 
plugin_init() {
FragSIP TrieCreate()
//bla..
//bla..
}

public 
plugin_end()
{
    
TrieDestroy(FragSIP)
}
public 
client_disconnect(id) {
    if(
is_kickball) {
        new 
x
        
for(1x<=RECORDSx++)
            
MadeRecord[id][x] = 0
        remove_task
(id)
        if(
ballholder == id ) {
            
ballholder 0
            clearBall
()
        }
        if(
ballowner == id) {
            
ballowner 0
        
}

        
GoalyPoints[id] = 0
// ------ADD THESE----------    


        
new veriler[kaydet]
        
veriler[Kills] = PlayerKills[id]
        
veriler[Deaths] = PlayerDeaths[id]
        
get_user_ip(idveriler[SIP], 31,1)
        
TrieSetArray(FragSIPveriler[SIP], veriler,sizeof veriler)

        


// ----ADD THESE------
                
PlayerKills[id] = 0
        PlayerDeaths
[id] = 0

        is_dead
[id] = false
        seconds
[id] = 0
        g_sprint
[id] = 0
        PressedAction
[id] = 0
        has_knife
[id] = false;
        
g_Experience[id] = 0

        
for(x=1x<=UPGRADESx++)
            
PlayerUpgrades[id][x] = 0
    
}
}

public 
client_putinserver(id) {
    if(
is_kickball) {
        
set_task(20.0,"soccerjamHelp",id)
    }
// ------ADD THESE--------    
    
new veriler[kaydet]
    
get_user_ip(idveriler[SIP], 31,1)
    if(
TrieGetArray(FragSIPveriler[SIP], verilersizeof veriler))
    {
        
cs_set_user_deaths(id,veriler[Deaths])
        
entity_set_float(idEV_FL_fragsfloat(veriler[Kills]))
        
PlayerKills[id] = veriler[Kills]
        
PlayerDeaths[id] = veriler[Deaths]
        
TrieDeleteKey(FragSIP,veriler[SIP])

        
setScoreInfo(id)
    }
// ------ADD THESE---------

tepegoz is offline