[Ajuda] Configurar Relogio UP
#1

Gente sou novo no lance de Scripts e estou enfrentando um problema nao sei como colocar meu relogio up mostrando o tempo do SEGUNDOSScore...
vou colocar minha script de LevelUp...Agradeзo desde de jб

Quote:

#include <a_samp>
#include <DOF2>

#define Score "ContasBRL/%s.ini" //PASTA PARA SALVAR O Score.
#define SEGUNDOSScore 3600 //TROQUE PARA OS SEGUNDOS DESEJADOS, 3600 SEGUNDOS = 1 HORA

new Text:RelogioUP;

enum Info
{
pSegundos,
pScore
};
new PlayerInfo[MAX_PLAYERS][Info];
new segundos;

public OnFilterScriptInit()
{
segundos = SetTimer("SegundoaMais",1000,1);

RelogioUP = TextDrawCreate(559.0, 372.0, "+UP 00:00");
TextDrawFont(RelogioUP, 2);
TextDrawSetOutline(RelogioUP,1);
TextDrawBackgroundColor(RelogioUP,0x000000FF);
TextDrawColor(RelogioUP,0xFFFFFFFF);
TextDrawSetProportional(RelogioUP, 1);
TextDrawLetterSize(RelogioUP,0.31, 1.10);

return 1;
}

public OnFilterScriptExit()
{
KillTimer(segundos);
TextDrawHideForAll(RelogioUP);
DOF2_Exit();
return 1;
}

public OnPlayerDisconnect(playerid)
{
new arquivo[34], playername[MAX_PLAYER_NAME];
SalvarPlayer(playerid);
GetPlayerName(playerid, playername, sizeof(playername));
format(arquivo, sizeof(arquivo), Score, playername);
if(DOF2_FileExists(arquivo))
{
DOF2_SetInt(arquivo, "Segundos", PlayerInfo[playerid][pSegundos]);
DOF2_SetInt(arquivo, "Score", PlayerInfo[playerid][pScore]);
DOF2_SaveFile();
}
else
{
DOF2_CreateFile(arquivo);
DOF2_SetInt(arquivo, "Segundos", PlayerInfo[playerid][pSegundos]);
DOF2_SetInt(arquivo, "Score", PlayerInfo[playerid][pScore]);
DOF2_SaveFile();
}
return 1;
}

public OnPlayerConnect(playerid)
{
new arquivo[34], playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
format(arquivo, sizeof(arquivo), Score, playername);
PlayerInfo[playerid][pSegundos] = DOF2_GetInt(arquivo, "Segundos");
PlayerInfo[playerid][pScore] = DOF2_GetInt(arquivo, "Score");
SetPlayerScore(playerid, DOF2_GetInt(arquivo,"Score"));
return 1;
}

public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid,RelogioUP);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
TextDrawHideForPlayer(playerid,RelogioUP);
return 1;
}

forward SegundoaMais();
public SegundoaMais()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayerInfo[i][pSegundos] ++;
if(PlayerInfo[i][pSegundos] >= SEGUNDOSScore)
{
PlayerInfo[i][pSegundos] = 0;
ScoreUP(i);
}
}
return 1;
}

ScoreUP(playerid)
{
PlayerInfo[playerid][pScore] ++;
GivePlayerMoney(playerid, 100);
GameTextForPlayer(playerid, "~w~Level ~p~UP", 2000, 1);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
// COLOQUE AQUI AS FUNЗХES QUE DESEJA NO SEU "Score UP"
}

stock SalvarPlayer(playerid)
{
new arquivo[34], playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
format(arquivo, sizeof(arquivo), Score, playername);
DOF2_SetInt(arquivo, "Score", PlayerInfo[playerid][pScore]);
DOF2::SaveFile();
return true;
}

Reply
#2

Terб que usar PlayerText em vez de uma textdraw global, por que cada player terб seu tempo;
PHP код:
new PlayerText:RelogioUP[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
        
RelogioUP[playerid] = CreatePlayerTextDraw(playerid, 86.000000, 323.000000, "+UP: 00");
    
PlayerTextDrawAlignment(playerid, RelogioUP[playerid], 2);
    
PlayerTextDrawBackgroundColor(playerid, RelogioUP[playerid], 255);
    
PlayerTextDrawFont(playerid, RelogioUP[playerid], 2);
    
PlayerTextDrawLetterSize(playerid, RelogioUP[playerid], 0.280000, 1.100000);
    
PlayerTextDrawColor(playerid, RelogioUP[playerid], -1);
    
PlayerTextDrawSetOutline(playerid, RelogioUP[playerid], 0);
    
PlayerTextDrawSetProportional(playerid, RelogioUP[playerid], 1);
    
PlayerTextDrawSetShadow(playerid, RelogioUP[playerid], 1);
    
PlayerTextDrawUseBox(playerid, RelogioUP[playerid], 1);
    
PlayerTextDrawBoxColor(playerid, RelogioUP[playerid], 100);
    
PlayerTextDrawTextSize(playerid, RelogioUP[playerid], 0.000000, 80.000000);
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    
PlayerTextDrawShow(playerid, RelogioUP[playerid]);
    return 
1;
}
forward SegundoaMais();
public 
SegundoaMais()
{
    for(new 
i = 0; i < MAX_PLAYERS; i++)
    {
        
PlayerInfo[i][pSegundos]++;
        
        new 
Str[20];
        
format(Str, sizeof(Str), "+UP: %d", PlayerInfo[i][pSegundos]);
        
PlayerTextDrawSetString(i, RelogioUP[i], Str);
        
        if(
PlayerInfo[i][pSegundos] >= SEGUNDOSScore)
        {
            
PlayerInfo[i][pSegundos] = 0;
            
ScoreUP(i);
        }
    }
    return 
1;
} 
Reply
#3

Olhas os erros.

http://i.imgur.com/yMroqTN.png
Reply
#4

Quote:
Originally Posted by felipelm3g
Посмотреть сообщение
Atualiza sua include a_samp.
Reply
#5

Como faзo isso?
Reply
#6

Caraca vei.. verdade, nem me liguei, coloquei sem querer no GamemodeInt... ajeitei aqui.. deu certo...
sу um uma duvida, ta mostrando o segundo direitinho, dar pra colocar como minutos..

ta assim ex : +UP 345 (ta em segundos e rolando de forma crescente)
tem como colocar assim? ex : +UP 04:00 (Rolar em minutos e forma decrescente)
?

Ps: reputado
Reply
#7

Usa esta stock:
PHP код:
Convert(number)
{
    new 
hours = 0, mins = 0, secs = 0, string[100];
    
hours = floatround(number / 3600);
    
mins = floatround((number / 60) - (hours * 60));
    
secs = floatround(number - ((hours * 3600) + (mins * 60)));
    new 
days = 0;
    if(
hours >= 24)
    {
        
days = floatround((hours/24), floatround_floor);
        
hours = hours % 24;
    }
    if(
days > 0)
    {
        
format(string, 100, "%d, %d:%d:%d:", days, hours, mins, secs);
    }
    else if(
hours > 0)
    {
        
format(string, 100, "%d:%d:%d", hours, mins, secs);
    }
    else
    {
        
format(string, 100, "%d:%d", mins, secs);
    }
    return 
string;
} 
Modo de uso:
PHP код:
format(String, sizeof(String), "+UP: %s", Convert(Player[i][pSegundos])); 
Reply
#8

Olha como ficou... as linhas

http://i.imgur.com/uzRbGar.png

e olha o erro que deu..

http://i.imgur.com/i8Yb1r1.png

. ://
Reply
#9

Cade:
new String[128];
?
E na linha de baixo vocк "setou" a text pra str, sendo assim, vocк formatou String e setou str.

Abraзos.
Reply
#10

Quote:
Originally Posted by felipelm3g
Посмотреть сообщение
Olha como ficou... as linhas

http://i.imgur.com/uzRbGar.png

e olha o erro que deu..

http://i.imgur.com/i8Yb1r1.png

. ://
Sua variбvel й PlayerInfo, esqueci de mudar rs.
PHP код:
format(String, sizeof(String), "+UP: %s", Convert(PlayerInfo[i][pSegundos])); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)