Posts: 3,312
Threads: 33
Joined: Nov 2008
Reputation:
0
So yea i got an hour system that counts minutes,secs,and Hours and my score goes for 1Hour = 1Point
and now i did a textdraw so the ppl can see how much minutes,secs etc they got...
but when it refreshes it just does overlay again...
and when i add a destroytextdraw
the textdraw does never appear.not even once...
so please help....
iposted this prob already but nobody did help me :/
i did wait like 2 days now...
Posts: 69
Threads: 3
Joined: Mar 2009
Reputation:
0
OnFilterScriptInit: create a textdraw for all players using a loop
OnPlayerConnect/Login: TextDrawShowForPlayer
OnPlayerDisconnect: TextDrawHideForPlayer
and to change the text in it (in the timer): TextDrawSetString
Posts: 3,312
Threads: 33
Joined: Nov 2008
Reputation:
0
Thanks and wat do i put as string?
Posts: 3,312
Threads: 33
Joined: Nov 2008
Reputation:
0
i dont get it.....
How should i do that?
sry if im annoying ya...
Posts: 2,593
Threads: 34
Joined: Dec 2007
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;
}