#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; } |
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;
}
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;
}
format(String, sizeof(String), "+UP: %s", Convert(Player[i][pSegundos]));
Olha como ficou... as linhas
http://i.imgur.com/uzRbGar.png e olha o erro que deu.. http://i.imgur.com/i8Yb1r1.png . :// |
format(String, sizeof(String), "+UP: %s", Convert(PlayerInfo[i][pSegundos]));