enum PED { PEDC } new Text:PEDSText[MAX_PLAYERS]; new PEDS[MAX_PLAYERS][PED]; public OnPlayerConnect(playerid) { new peds[128]; format(peds, sizeof(peds), "PED: ~w~%d", peds); PEDSText[playerid] = TextDrawCreate(156.875000, 432.666839, "Peds: ~w~%d"); TextDrawLetterSize(PEDSText[playerid], 0.400000, 1.600000); TextDrawAlignment(PEDSText[playerid], 1); TextDrawColor(PEDSText[playerid], 866792447); TextDrawSetShadow(PEDSText[playerid], 0); TextDrawSetOutline(PEDSText[playerid], 0); TextDrawBackgroundColor(PEDSText[playerid], 255); TextDrawFont(PEDSText[playerid], 1); TextDrawSetProportional(PEDSText[playerid], 1); TextDrawSetShadow(PEDSText[playerid], 0); TextDrawShowForPlayer(playerid, PEDSText[playerid]); TextDrawSetString(PEDSText[playerid], peds); return 1; } public OnPlayerDisconnect(playerid, reason) { TextDrawDestroy(PEDSText[playerid]); return 1; } public OnPlayerStreamIn(playerid, forplayerid) { new peds[128]; format(peds, sizeof(peds), "PED: ~w~%d", peds); TextDrawSetString(PEDSText[playerid], PEDS[playerid][PEDC]++); } public OnPlayerStreamOut(playerid, forplayerid) { new peds[128]; format(peds, sizeof(peds), "PED: ~w~%d", peds); TextDrawSetString(PEDSText[playerid], PEDS[playerid][PEDC]--); } |
new ped[MAX_PLAYERS];
public OnPlayerStreamIn(playerid, forplayerid)
{
new peds[128];
ped[playerid]++; // Ped irб aumentar apos algm entrar no campo de visao
format(peds, sizeof(peds), "PED: ~w~%d", ped[playerid]);
TextDrawSetString(PEDSText[playerid], peds);
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
new peds[128];
ped[playerid]--; // Ped diminui apos sair do campo de visгo
format(peds, sizeof(peds), "PED: ~w~%d", ped[playerid]);
TextDrawSetString(PEDSText[playerid], peds);
return 1;
}
hook OnPlayerDisconnect(playerid, reason) { new peds[128]; if(IsPlayerStreamedIn(playerid)) { ped[playerid]--; format(peds, sizeof(peds), "PED: ~w~%d", ped[playerid]); TextDrawSetString(PEDSText[playerid], peds); } return 1; } |