Caso tenha algum erro me fale,pois nгo testei.
PHP код:
new EXP[MAX_PLAYERS];
new PlayerText:EXP_DRAW[2];
new Level[MAX_PLAYERS];
new EXPTimer[MAX_PLAYERS]; // Variбvel de armazenamento de Timer.s
//Em OnPlayerSpawn
CriarTextExp(playerid);
//Em OnGameModeInit
EXPTimer[playerid] = SetTimerEx("AtualizarEXPs", 600000, true, "d", playerid);//10 minutos para cada EXP
SetTimer("AtuaizarTextdraw", 1000, true);
//Em OnPlayerDeath
Exp[killerid]++;
new string[128], PrxLvl = Level[killerid]+1;
for(new i = 0; i < 20; i++)
{
if(EXP[killerid] == EXP[playerid])
{
Level[killerid]++;
format(string, sizeof(string), "Parabйns, vocк passou para o level %d por ter matado %d players", Level[killerid], EXP[killerid]);
SendClientMessage(playerid, -1, string);
}
}
stock CriarTextExp(playerid)
{
///////////////////////// Level ////////////////////////////////////////////////
EXP_DRAW[0] = CreatePlayerTextDraw(playerid,551.000000, 291.000000, "Level: 0");
PlayerTextDrawBackgroundColor(playerid,EXP_DRAW[0], 255);
PlayerTextDrawFont(playerid,EXP_DRAW[0], 3);
PlayerTextDrawLetterSize(playerid,EXP_DRAW[0], 0.500000, 1.000000);
PlayerTextDrawColor(playerid,EXP_DRAW[0], 65535);
PlayerTextDrawSetOutline(playerid,EXP_DRAW[0], 0);
PlayerTextDrawSetProportional(playerid,EXP_DRAW[0], 1);
PlayerTextDrawSetShadow(playerid,EXP_DRAW[0], 1);
//////////////////////////Exp//////////////////////////////////////////////
EXP_DRAW[1] = CreatePlayerTextDraw(playerid,551.000000, 268.000000, "Exp: 0/5");
PlayerTextDrawBackgroundColor(playerid,EXP_DRAW[1], 255);
PlayerTextDrawFont(playerid,EXP_DRAW[1], 1);
PlayerTextDrawLetterSize(playerid,EXP_DRAW[1], 0.280000, 2.100000);
PlayerTextDrawColor(playerid,EXP_DRAW[1], -16776961);
PlayerTextDrawSetOutline(playerid,EXP_DRAW[1], 0);
PlayerTextDrawSetProportional(playerid,EXP_DRAW[1], 1);
PlayerTextDrawSetShadow(playerid,EXP_DRAW[1], 1);
return 1;
}
stock AtuaizarTextdraw(playerid)
{
new String[5000];
format(String, sizeof(String), "Level: %d", Level[playerid]);
PlayerTextDrawSetString(playerid,EXP_DRAW[0], String);
PlayerTextDrawShow(playerid, EXP_DRAW[0]);
format(String, sizeof(String), "EXP: %d", Exp[playerid]);
PlayerTextDrawSetString(playerid,EXP_DRAW[1], String);
PlayerTextDrawShow(playerid, EXP_DRAW[1]);
return 1;
}
forward AtualizarEXPs(playerid);
public AtualizarEXPs(playerid)
{
if(EXP[playerid] < 10) //Verificar para ver se e menor que 10 EXP
{
EXP[playerid] ++;
GameTextForPlayer(playerid,"Voce ganhou + 1 EXP", 1000,1);
}
else // Caso nгo seja menor que 10
{
Level[playerid]++;
EXP[playerid] = 0;
SetPlayerScore(playerid, Score[playerid]);
GameTextForPlayer(playerid,"Voce upou + 1 Level.", 1000,1);
}
}
//Em OnPlayerConnect
if(DOF2_IsSet("EXPLEVEL.ini",getPName(playerid))) Level[playerid] = (playerid,DOF2_GetInt("EXPLEVEL.ini",getPName(playerid)));
//Em OnPlayerDisconnect
DOF2_SetInt("EXPLEVEL.ini",getPName(playerid),Level[playerid]);