[Pomoc]Textdraw

Započeo Darkic, Februar 15, 2016, 17:11:03 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: Neka moja od 0 započeta
Detaljan opis problema: Od kad sam ubacio fuel system problem se pojavio.Znači napravio sam textdraw koji treba da pokaže koliko goriva ima u vozilu,ali problem nastaje jer i TD od Logo-a pokazuje isto
Dio skripte: Daću ispod u postu ako bude potrebno
Neke slike/video za lakse dobivanje pomoci(neobavezno):
Edit: Logo se prikazuje kao TextDrawShowForAll,dok fuel kao TextDrawShowForPlayer
Poslednja Izmena: Februar 15, 2016, 17:12:55 POSLE PODNE od Pawno

Vidi da mozda kojim slucajem nisi definisao istim imenom ili neku definiciju imaju istu sigurno ako kontas sta ti pricam

Ne,da je definisano istim imenom iskočio bi mi error da je to već definisano

Posalji deo skripte u kojem se desava to.
You have enemies? Good. That means you've stood up for something, sometime in your life.

Evo čitavog sistema:
new gorivo[MAX_VEHICLES];
forward timer_gorivo_lower();
forward timer_dopunjavanje(playerid);
new da_li_dopunjava[MAX_PLAYERS] = 0;
new Text:td_gorivo[MAX_PLAYERS];

OnGameModeInit
for(new i=0;i<MAX_VEHICLES;i++) { gorivo[i] = 50; }
Komanda za dopunjavanje
CMD:dopunigorivo(playerid, params[])
{
if(!IsPlayerInRangeOfPoint(playerid, 2.0, 242.5022, -86.4246, 1.5781))
{
if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, CRVENA, "[ERROR]: {FFFFFF}Niste u vozilu!"); //if a player isnt in a vehicle, it stops here
        if (da_li_dopunjava[playerid]) return SendClientMessage(playerid, CRVENA, "[ERROR]: {FFFFFF}Vec dopunjavaÅ¡ gorivo.!"); //if a player is already refuelling, it stops here
        if (GetPlayerMoney(playerid) - 80 <0) return SendClientMessage(playerid, CRVENA, "[ERROR]: {FFFFFF}NemaÅ¡ dovoljno novca!"); //if a player doesnt have $80 anymore, it stops here
        GivePlayerMoney(playerid,-80); //Sets the player's cash -$80
        SetCameraBehindPlayer(playerid); //Sets the camera behind the player (looks better because the player will be frozen for a few secs)
        TogglePlayerControllable(playerid,0); //freezes the player so he cant drive and refuel at the same time
        da_li_dopunjava[playerid] = 1; //setting da_li_dopunjava to 1 so the player cant spam /refuel
        TextDrawSetString(td_gorivo[playerid],"Punjenje..."); //changing textdraw to /refuel
        SetTimerEx("timer_dopunjavanje",4500,false,"i",playerid); //setting refueltimer
}
else SendClientMessage(playerid, CRVENA, "[ERROR]: {FFFFFF}Niste na benzinskoj pumpi");
return 1;
}

OnPlayerStateChange
if (newstate == PLAYER_STATE_DRIVER)
{
new vid = GetPlayerVehicleID(playerid);
new string[125];format(string,sizeof string,"Gorivo: ~w~%i~r~L",gorivo[vid]);
TextDrawSetString(td_gorivo[playerid],string);
    TextDrawShowForPlayer(playerid,td_gorivo[playerid]);
}
else
{
    TextDrawHideForPlayer(playerid,td_gorivo[playerid]);
}

Novi public
public timer_gorivo_lower()
{
    for(new i=0;i<MAX_PLAYERS;i++)
{
    if (da_li_dopunjava[i]) continue;
    new vid = GetPlayerVehicleID(i);
    if (GetPlayerVehicleSeat(i) == 0)
{
gorivo[vid] = gorivo[vid] -1;
if (gorivo[vid]<1)
{
gorivo[vid] = 0;
  RemovePlayerFromVehicle(i);
    GameTextForPlayer(i,"~r~Ostajete bez ~w~goriva~r~!",5000,4);
}
}
new string[125];format(string,sizeof string,"Gorivo: ~w~%i~r~L",gorivo[vid]);
TextDrawSetString(td_gorivo[i],string);
}
return 1;
}

Još jedan public
public timer_dopunjavanje(playerid)
{
new vid = GetPlayerVehicleID(playerid);
gorivo[vid] = gorivo[vid] = 50;
da_li_dopunjava[playerid] = 0;
TextDrawSetString(td_gorivo[playerid],"Gorivo: ~w~50~r~L");
TogglePlayerControllable(playerid,1);
return 1;
}

@Mr. Letic
Poslednja Izmena: Februar 16, 2016, 00:31:00 PRE PODNE od Pawno

Koliko vidim ovde nema mesanja TD-ova, pokusaj prebaciti gorivo TD u Player TD.
You have enemies? Good. That means you've stood up for something, sometime in your life.

Ma nema to veze s tim,pokušao sam al opet isto

Pa za gorivo,brzinu i ostalo ti ide Player TD ne mozes globalni koristiti  :D

To je prvo što sam uradio,pa sam prebacio na globalne zbog greške,ali opet isto
@[BM:RP] Leon

c0x

*

Citat: [BM:RP] Leon poslato Februar 16, 2016, 23:05:51 POSLE PODNE
Pa za gorivo,brzinu i ostalo ti ide Player TD ne mozes globalni koristiti  :D
Ja kad sam editovao UP mod edit sam i brzinomer i ceo brzinomer mi je u globalnom TDu i nema nikakvih gresaka.. ;)

Ništa od ovoga,snaćiču se nekako.Lock!