//TOPO DA GM
forward info(playerid);
//OnGameModeInit
SetTimer("info",1000,1);
//OnPlayerConnect
INFO[2][playerid] = CreatePlayerTextDraw(playerid,510.000000, 360.000000, "--");
PlayerTextDrawBackgroundColor(playerid,INFO[2][playerid], 255);
PlayerTextDrawFont(playerid,INFO[2][playerid], 1);
PlayerTextDrawLetterSize(playerid,INFO[2][playerid], 0.500000, 1.000000);
PlayerTextDrawColor(playerid,INFO[2][playerid], -1);
PlayerTextDrawSetOutline(playerid,INFO[2][playerid], 0);
PlayerTextDrawSetProportional(playerid,INFO[2][playerid], 1);
PlayerTextDrawSetShadow(playerid,INFO[2][playerid], 1);
PlayerTextDrawSetSelectable(playerid,INFO[2][playerid], 0);
//OnPlayerSpawn
PlayerTextDrawShow(playerid, INFO[2][playerid]);
//Public Criada
public info(playerid)
{
new str[128];
format(str, sizeof(str), "~b~Matou:~w~ %s",DOF2::GetInt(String, "Matou"));
PlayerTextDrawSetString(playerid, INFO[2][playerid], str);
}
// TOPO DA GM
forward info(playerid);
// OnGameModeInit
SetTimer("info",1000,1);
// OnPlayerConnect
INFO[2][playerid] = CreatePlayerTextDraw(playerid,510.000000, 360.000000, "--");
PlayerTextDrawBackgroundColor(playerid,INFO[2][playerid], 255);
PlayerTextDrawFont(playerid,INFO[2][playerid], 1);
PlayerTextDrawLetterSize(playerid,INFO[2][playerid], 0.500000, 1.000000);
PlayerTextDrawColor(playerid,INFO[2][playerid], -1);
PlayerTextDrawSetOutline(playerid,INFO[2][playerid], 0);
PlayerTextDrawSetProportional(playerid,INFO[2][playerid], 1);
PlayerTextDrawSetShadow(playerid,INFO[2][playerid], 1);
PlayerTextDrawSetSelectable(playerid,INFO[2][playerid], 0);
// OnPlayerSpawn
PlayerTextDrawShow(playerid, PlayerText:INFO[2][playerid]);
// Public Criada
public info(playerid)
{
new str[128];
format(str, sizeof(str), "~b~Matou:~w~ %s",DOF2::GetInt(String, "Matou"));
PlayerTextDrawSetString(playerid, INFO[2][playerid], str);
}
Estб errado: PlayerTextDrawShow(playerid, INFO[2][playerid]);
Use: PlayerTextDrawShow(playerid, PlayerText:INFO[2][playerid]); Tenta ae PHP код:
|
Por que o timer?, tentar colocar isso no onplayerconnect
info(playerid); e apaga esse timer |
public OnGameModeInit()
{
SetTimer("info", 1000, 1);
return 1;
}
public OnPlayerConnect(playerid)
{
INFO[2][playerid] = CreatePlayerTextDraw(playerid,145.000000,347.000000,"_");
PlayerTextDrawUseBox(playerid, INFO[2][playerid],1);
PlayerTextDrawBoxColor(playerid, INFO[2][playerid],0x00000066);
PlayerTextDrawTextSize(playerid, INFO[2][playerid],196.000000,14.000000);
PlayerTextDrawAlignment(playerid, INFO[2][playerid],0);
PlayerTextDrawBackgroundColor(playerid, INFO[2][playerid],0xffffffff);
PlayerTextDrawFont(playerid, INFO[2][playerid],2);
PlayerTextDrawLetterSize(playerid, INFO[2][playerid],0.199999,1.400000);
PlayerTextDrawColor(playerid, INFO[2][playerid],0xffffffff);
PlayerTextDrawSetProportional(playerid, INFO[2][playerid],1);
PlayerTextDrawSetShadow(playerid, INFO[2][playerid],0);
return 1;
}
public OnPlayerSpawn(playerid)
{
PlayerTextDrawShow(playerid, PlayerText:INFO[2][playerid]);
return 1;
}
forward info(playerid);
public info(playerid)
{
new STR[128];
format(STR, sizeof(STR), "~b~Matou: ~w~%d",DOF2::GetInt(String, "Matou"));
PlayerTextDrawSetString(playerid, INFO[2][playerid], STR);
return 1;
}
Para que utilizar timer? Pode-se utilizar a OnPlayerDeath. Mas se continuar com o timer, precisa mudar a funзгo para SetTimerEx e movк-la para a OnPlayerConnect ou dialog/comando de login, pois senгo irб bugar.
|
new Matou[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID)
{
Matou[killerid] ++;
new str[128];
format(str, sizeof(str), "~b~Matou:~w~ %d", Matou[killerid]);
PlayerTextDrawSetString(killerid, INFO[2][killerid], str);
}
return 1;
}
//ao carregar os dados do jogador
Matou[playerid] = DOF2_GetInt(String, "Matou");
//para salvar
DOF2_SetInt(String, "Matou", Matou[playerid]);
PHP код:
|