new ExpCal[20][] =
{
"5",
"10",
"15",
"20",
"25",
"30",
"35",
"40",
"45",
"50",
"55",
"60",
"65",
"70",
"75",
"80",
"85",
"90",
"95",
"100"
};
new Text:Textdraw1[MAX_PLAYERS];
new Text:Textdraw0[MAX_PLAYERS];
new Level[MAX_PLAYERS];
new Exp[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
SetTimerEx("Timer",1000*60,true,"i",playerid);
SetTimer("ActualizarTextDraws",true,1000*60);
///////////////////////// Level ////////////////////////////////////////////////
Textdraw0[playerid] = TextDrawCreate(551.000000, 291.000000, "Level: 0");
TextDrawBackgroundColor(Textdraw0[playerid], 255);
TextDrawFont(Textdraw0[playerid], 3);
TextDrawLetterSize(Textdraw0[playerid], 0.500000, 1.000000);
TextDrawColor(Textdraw0[playerid], 65535);
TextDrawSetOutline(Textdraw0[playerid], 0);
TextDrawSetProportional(Textdraw0[playerid], 1);
TextDrawSetShadow(Textdraw0[playerid], 1);
//////////////////////////Exp//////////////////////////////////////////////
Textdraw1[playerid] = TextDrawCreate(551.000000, 268.000000, "Exp: 0/5");
TextDrawBackgroundColor(Textdraw1[playerid], 255);
TextDrawFont(Textdraw1[playerid], 1);
TextDrawLetterSize(Textdraw1[playerid], 0.280000, 2.100000);
TextDrawColor(Textdraw1[playerid], -16776961);
TextDrawSetOutline(Textdraw1[playerid], 0);
TextDrawSetProportional(Textdraw1[playerid], 1);
TextDrawSetShadow(Textdraw1[playerid], 1);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
Exp[killerid]++;
new string[128], PrxLvl = Level[killerid]+1;
for(new i = 0; i < 20; i++)
{
if(Exp[killerid] == ExpCal[i])
{
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);
}
}
forward ActualizarTextDraws();
public ActualizarTextDraws()
{
new String[100];
for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
{
if(IsPlayerConnected(playerid))
{
format(String, sizeof(String), "Level: %d", Level[playerid]);
TextDrawSetString(Textdraw0[playerid], String);
TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
format(String, sizeof(String), "EXP: %d", Exp[playerid]);
TextDrawSetString(Textdraw1[playerid], String);
TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
}
}
}
public OnPlayerConnect(playerid)
{
if(dini_Isset("levels.dkn",Nome(playerid))) Level[playerid] = (playerid,dini_Int("levels.dkn",Nome(playerid)));
public OnPlayerDisconnect(playerid, reason)
{
dini_IntSet("levels.dkn",Nome(playerid),Level[playerid]);
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]);
Caso tenha algum erro me fale,pois nгo testei.
PHP код:
|
Mano sou novato sou novato mesmo sabe entгo n entendendo muito ai eu botei tudo certinho compilei й nгo funciono a textdraw nгo aparece etc..
|