15/07/2022 14:40
É um tópico antigo, mas vou deixar minha mensagem se por a caso alguém precisar algum dia.
Código PHP:
#define PAYDAY 40 // Defina o tempo do seu PayDay, defini para 40 minutos.
// Variáveis Globais
new Text:PaydayText[2];
new PlayerText:PaydayPlayerText[MAX_PLAYERS][1];
new PaydayTimer[MAX_PLAYERS];
new Timer[MAX_PLAYERS];
public OnGameModeInit() {
// TextDraws
PaydayText[0] = TextDrawCreate(432.058837, 384.249938, "ld_grav:timer");
TextDrawTextSize(PaydayText[0], 24.000000, 28.000000);
TextDrawAlignment(PaydayText[0], 1);
TextDrawColor(PaydayText[0], -1);
TextDrawSetShadow(PaydayText[0], 0);
TextDrawBackgroundColor(PaydayText[0], 255);
TextDrawFont(PaydayText[0], 4);
TextDrawSetProportional(PaydayText[0], 0);
PaydayText[1] = TextDrawCreate(457.999847, 394.749969, "box");
TextDrawLetterSize(PaydayText[1], 0.000000, -0.070588);
TextDrawTextSize(PaydayText[1], 618.000000, 0.000000);
TextDrawAlignment(PaydayText[1], 1);
TextDrawColor(PaydayText[1], -1);
TextDrawUseBox(PaydayText[1], 1);
TextDrawBoxColor(PaydayText[1], 255);
TextDrawSetShadow(PaydayText[1], 0);
TextDrawBackgroundColor(PaydayText[1], 255);
TextDrawFont(PaydayText[1], 1);
TextDrawSetProportional(PaydayText[1], 1);
return 1;
}
public OnPlayerConnect(playerid) {
// TextDraws
PaydayPlayerText[playerid][0] = CreatePlayerTextDraw(playerid, 624.588378, 396.500091, "~w~Payday em ~g~40~w~ minutos!");
PlayerTextDrawLetterSize(playerid, PaydayPlayerText[playerid][0], 0.400000, 1.600000);
PlayerTextDrawAlignment(playerid, PaydayPlayerText[playerid][0], 3);
PlayerTextDrawColor(playerid, PaydayPlayerText[playerid][0], 41215);
PlayerTextDrawSetShadow(playerid, PaydayPlayerText[playerid][0], 0);
PlayerTextDrawSetOutline(playerid, PaydayPlayerText[playerid][0], 1);
PlayerTextDrawBackgroundColor(playerid, PaydayPlayerText[playerid][0], 255);
PlayerTextDrawFont(playerid, PaydayPlayerText[playerid][0], 3);
PlayerTextDrawSetProportional(playerid, PaydayPlayerText[playerid][0], 1);
MostrarText(playerid);
Timer[playerid] = PAYDAY * 60 + 1;
// Timer
PaydayTimer[playerid] = SetTimerEx("PayDay", 1000, true, "i", playerid);
return 1;
}
forward PayDay(i);
public PayDay(i)
{
new string[128];
Timer[i]--;
format(string, sizeof(string), "~w~Payday em ~g~%s~w~ minutos!", Convert(Timer[i]));
PlayerTextDrawSetString(i, PaydayPlayerText[i][0], string);
if(Timer[i] == 0) {
SetPlayerScore(i, GetPlayerScore(i) + 1);
GivePlayerMoney(i, 2500);
SendClientMessage(i, -1, "=========================\nPayday!\n=========================");
PlayerPlaySound(i, 1137, 0.0, 0.0, 0.0);
Timer[i] = PAYDAY * 60 + 1;
}
return 1;
}
stock Convert(number) {
new hours, mins, secs, string[100];
hours = floatround(number / 3600);
mins = floatround((number / 60) - (hours * 60));
secs = floatround(number - ((hours * 3600) + (mins * 60)));
if(hours >= 24) hours = hours % 24;
if(hours > 0) format(string, 100, "%02d:%02d:%02d", hours, mins, secs);
else format(string, 100, "%02d:%02d", mins, secs);
return string;
}
stock MostrarText(playerid) {
for(new i = 0; i < 2; i++) TextDrawShowForPlayer(playerid, PaydayText[i]);
for(new j = 0; j < 1; j++) PlayerTextDrawShow(playerid, PaydayPlayerText[playerid][j]);
return 1;
}
stock EsconderText(playerid) {
for(new i = 0; i < 2; i++) TextDrawHideForPlayer(playerid, PaydayText[i]);
for(new j = 0; j < 1; j++) PlayerTextDrawHide(playerid, PaydayPlayerText[playerid][j]);
return 1;
}
Não estou disponível para realizar serviços relacionados ao SA-MP e não costumo responder a mensagens privadas, a menos que estejam relacionadas à moderação do fórum.