09.03.2009, 14:50
Quote:
|
Originally Posted by Jefff
FilterScript and learn it :P
Код:
#include <a_samp>
enum PlayerInfoEnum {
Text:PlayingTime,
bool:TextOn,
Time
};
new PlayerInfo[200][PlayerInfoEnum];
public OnFilterScriptInit()
{
SetTimer("Draw",1000,1);
for(new i=0; i < GetMaxPlayers(); i++) {
CreatePlayerDraw(i);
if(IsPlayerConnected(i)) {
TextDrawShowForPlayer(i,PlayerInfo[i][PlayingTime]);
}
}
return 1;
}
public OnFilterScriptExit()
{
for(new i=0; i < GetMaxPlayers(); i++) {
DestroyPlayerDraw(i);
}
return 1;
}
public OnPlayerConnect(playerid)
{
CreatePlayerDraw(playerid);
PlayerInfo[playerid][Time]=0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
DestroyPlayerDraw(playerid);
PlayerInfo[playerid][Time]=0;
return 1;
}
forward Draw();
public Draw()
{
new str[128];
for(new i=0; i<GetMaxPlayers(); i++)
{
PlayerInfo[i][Time]++;
format(str, sizeof str, "Hours:%d Mins:%d Secs:%d",PlayerInfo[i][Time]/3600,PlayerInfo[i][Time]/60-(((PlayerInfo[i][Time]/3600)*3600)/60),PlayerInfo[i][Time]-((PlayerInfo[i][Time]/60)*60));
TextDrawSetString(PlayerInfo[i][PlayingTime],str);
SetPlayerScore(i,PlayerInfo[i][Time]/3600);
}
return 1;
}
stock CreatePlayerDraw(playerid){
if(!PlayerInfo[playerid][TextOn]) {
PlayerInfo[playerid][TextOn]=true;
PlayerInfo[playerid][PlayingTime] = TextDrawCreate(303.0,432.0,"_");
TextDrawAlignment(PlayerInfo[playerid][PlayingTime],0);
TextDrawBackgroundColor(PlayerInfo[playerid][PlayingTime],0x000000ff);
TextDrawFont(PlayerInfo[playerid][PlayingTime],3);
TextDrawLetterSize(PlayerInfo[playerid][PlayingTime],0.7,1.2);
TextDrawColor(PlayerInfo[playerid][PlayingTime],0xffffffff);
TextDrawSetOutline(PlayerInfo[playerid][PlayingTime],1);
TextDrawSetProportional(PlayerInfo[playerid][PlayingTime],1);
TextDrawSetShadow(PlayerInfo[playerid][PlayingTime],1);
TextDrawShowForPlayer(playerid,PlayerInfo[playerid][PlayingTime]);
}
return 1;
}
stock DestroyPlayerDraw(playerid){
if(PlayerInfo[playerid][TextOn]) {
TextDrawHideForPlayer(playerid,PlayerInfo[playerid][PlayingTime]);
PlayerInfo[playerid][TextOn]=false;
TextDrawDestroy(PlayerInfo[playerid][PlayingTime]);
}
return 1;
}
|
2. still wrong! it creates useless textdraws!
3. Do it like i told in one of my posts in this thread!

