Üdv! Készítettem egy textdrawot de sajnós nem megyen! Nem jeleniti meg..
#include <a_samp>
#define FILTERSCRIPT
#include <dini>
#define COLOR_RED 0xFF0000FF
#pragma tabsize 0
enum pTime
{
Seconds,
Minutes,
Hours,
Days
};
new PlayerTime[MAX_PLAYERS][pTime];
new PlayerTimer[MAX_PLAYERS];
new Text:Datum;
new UzenetTimer[MAX_PLAYERS];
forward PlayedTime(playerid);
forward vsystem(playerid);
public OnFilterScriptInit()
{
SetTimer(\"vsystem\",1000,true);
Datum = TextDrawCreate(154.000000, 373.000000, \"--\");
TextDrawBackgroundColor(Datum, 255);
TextDrawFont(Datum, 1);
TextDrawLetterSize(Datum, 0.230000, 1.400000);
TextDrawColor(Datum, -65281);
TextDrawSetOutline(Datum, 1);
TextDrawSetProportional(Datum, 1);
return 1;
}
public vsystem(playerid)
{
new st[128];
format(st, sizeof(st), \"Szerveren eltöltött idõ: %d Nap, %d Óra, %d Perc, %d Másodperc\", PlayerTime[playerid][Days], PlayerTime[playerid][Hours], PlayerTime[playerid][Minutes], PlayerTime[playerid][seconds]);
TextDrawSetString(Datum, st);
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, Datum);
return 1;
}
public OnPlayerConnect(playerid)
{
new file[128];
PlayerTimer[playerid] = SetTimerEx(\"PlayedTime\", 1000, 1, \"%d\", playerid);
UzenetTimer[playerid] = SetTimer(\"Uzenet\", 300000, true);
if(!fexist(file))
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),\"%s.ini\",name);
if(!fexist(file))
{
dini_Create(file);
dini_IntSet(file, \"Seconds\", 0);
dini_IntSet(file, \"Minutes\", 0);
dini_IntSet(file, \"Hours\", 0);
dini_IntSet(file, \"Days\", 0);
}
}
if(fexist(file))
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),\"%s.ini\",name);
if(fexist(file))
{
PlayerTime[playerid][seconds] = dini_Int(file, \"Seconds\");
PlayerTime[playerid][Minutes] = dini_Int(file, \"Minutes\");
PlayerTime[playerid][Hours] = dini_Int(file, \"Hours\");
PlayerTime[playerid][Days] = dini_Int(file, \"Days\");
}
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new file[128];
new name[MAX_PLAYER_NAME];
TextDrawHideForPlayer(playerid, Datum);
format(file,sizeof(file),\"%s.ini\",name);
if(fexist(file))
{
dini_IntSet(file, \"Seconds\", PlayerTime[playerid][seconds]);
dini_IntSet(file, \"Minutes\", PlayerTime[playerid][Minutes]);
dini_IntSet(file, \"Hours\", PlayerTime[playerid][Hours]);
dini_IntSet(file, \"Days\", PlayerTime[playerid][Days]);
KillTimer(PlayerTimer[playerid]);
}
return 1;
}
public PlayedTime(playerid)
{
if(!IsPlayerConnected(playerid)) return 0;
PlayerTime[playerid][seconds]++;
if(PlayerTime[playerid][seconds] == 60)
{
PlayerTime[playerid][Minutes]++;
PlayerTime[playerid][seconds] = 0;
}
if(PlayerTime[playerid][Minutes] == 60)
{
PlayerTime[playerid][Hours]++;
PlayerTime[playerid][Minutes] = 0;
}
if(PlayerTime[playerid][Hours] == 24)
{
PlayerTime[playerid][Days]++;
PlayerTime[playerid][Hours] = 0;
}
return 1;
}