Raised This Month: $ Target: $400
 0% 

Problem with plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
naXe
BANNED
Join Date: May 2009
Location: Poland/Kwidzyn
Old 02-11-2012 , 06:19   Problem with plugin
Reply With Quote #1

When I wrote the wrong forum to ask for a transfer.
I have a problem, the plugin does not create a Steam_ID.ini files in folder 'czas_gry'.
Normally, game time is calculated on the server, but after leaving the server removes the time.

Please someone to improved code.
Sorry for my bad English.
I greet.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <colorchat>

new gszFile[201], czas[33], szDir[64];

public 
plugin_init()
{
        
rregister_plugin("Czas gry""1.0""naXe");
        
register_clcmd("say /czasgry""pokaz_czas_gry");
        
register_clcmd("say_team /czasgry""pokaz_czas_gry");
        
register_clcmd("say /czas""pokaz_czas_gry");
        
register_clcmd("say_team /czas""pokaz_czas_gry");
        
get_basedir(szDirsizeof szDir);
        
formatex(gszFile200"%s/configs/czas_gry/"szDir);
}
public 
client_putinserver(id)
{
        if(!
is_user_steam(id))
        {
                return 
PLUGIN_CONTINUE;
        }
        new 
steam_id[35], adres[201], iLenText[32];
        
get_user_authid(idsteam_idsizeof steam_id 1);
        
formatex(adres200"%s/%s.ini"gszFilesteam_id);
        if(
file_exists(adres))
        {
                
read_file(adres0Text31iLen);
                
trim(Text);
                
czas[id] = str_to_num(Text);
        }
        else
        {
                
czas[id] = 0;
        }
        return 
PLUGIN_HANDLED;
}
public 
pokaz_czas_gry(id)
{
        if(!
is_user_steam(id))
        {
                return 
PLUGIN_HANDLED;
        }
        new 
iCurTime get_user_timeid );
        new 
Time czas[id];
        if((
iCurTime Time) / 60 60)
        {
                
ColorChat(idGREEN"[CzasGry]^x01 Spedziles na serwerze^x03 %d^x01 min.", (iCurTime Time) / 60);
        }
        else
        {
                
ColorChat(idGREEN"[CzasGry]^x01 Spedziles na serwerze^x03 %d^x01 h ^x03%02d^x01 min.", (iCurTime Time) / 3600, ((iCurTime Time) / 60) % 60);
        }
        return 
PLUGIN_HANDLED;
}
public 
client_disconnect(id)
{
        if(!
is_user_steam(id))
        {
                return 
PLUGIN_HANDLED;
        }
        new 
steam_id[35], adres[201], Text[200];
        
get_user_authid(idsteam_idsizeof steam_id 1);
        
formatex(adres200"%s/%s.ini"gszFilesteam_id);
        new 
szTime get_user_timeid ) + czas[id];
        
num_to_str(szTimeTextcharsmax(Text));
        
write_file(adresText0);
        return 
PLUGIN_HANDLED;
}
stock bool:is_user_steam(id)
{
        new 
authid[35]; 
        
get_user_authid(idauthidsizeof authid 1);
        return 
contain(authid ":") != -true false;

naXe is offline
Send a message via AIM to naXe
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 02-11-2012 , 09:19   Re: Problem with plugin
Reply With Quote #2

Wrong section: Ask at scripting help.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
naXe
BANNED
Join Date: May 2009
Location: Poland/Kwidzyn
Old 02-11-2012 , 09:31   Re: Problem with plugin
Reply With Quote #3

I know I've already written. Can you see?
naXe is offline
Send a message via AIM to naXe
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 09:51.


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