Problema Textdraw Timer Wanted
#1

Am creat un textdraw in care sa-mi apara cat timp mai am wanted si nu merge.
Code:
forward Wanteddtimer1();
public Wanteddtimer1()
{
    new wanted;
    new string[256];
	foreach(Player, x)
	{
		if(IsPlayerConnected(x))
       	{
       	WantedLevel[x] += wanted;

		if(WantedLevel[x] > 0) { WantedLevel[x] = 6; }
			  PlayerInfo[x][pWantedLevel]--;
			  
			  switch(PlayerInfo[x][pWantedLevel])
			  {
			  case 1:
			  {
                  format(string, 500,"Wanted Timer: %d minutes", PlayerInfo[x][pWantedLevel] / 60);
		          TextDrawSetString(wanted1[x], string);
			   }
			   }
			   TextDrawSetString(wanted1[x], string);
			   if(PlayerInfo[x][pWantedLevel] == 1)
                {
                    PlayerInfo[x][pWantedLevel] = 0;
                    //PlayerInfo[x][pJailTime] = 0;
                    SendClientMessage(x, COLOR_WHITE, "Wanted Clear.");
                    }
			}
       	}
    return 1;
}
Am creat o variabila noua "new wanteddtimer; " si am pus la public-ul GameModeExitFunc() , "KillTimer(wanteddtimer);" si la public-ul OnGameModeInit (), "wanteddtimer = SetTimer("Wanteddtimer1", 1000, 1);" . Asta e tot ce am facut si tot nu merge
Reply
#2

Up!!
Reply
#3

Nu are nici o logica codul tau.
Ai adunat variabila WantedLevel cu 0, nu am idee de ce. Si de ce Dumnezeu mai verifici daca jucatorii sunt conectati din moment ce "foreach" numara doar jucatorii conectati. Si inca odata de ce un string de 256 de caractere cand MAX INPUT la textdraw-uri este de 128. Ai verificat de doua ori in acelasi cod daca PlayerInfo[x][pWantedLevel] este egal cu 1. Odata in switch(nu ii vad rostul) si odata in if, nu am idee de ce.
Reply
#4

Si care ar fi ideea cum ar fi trebuit sa arate codul?
Reply
#5

Code:
TextDrawShowForPlayer(x, wanted1[x]);
Unde e?
In script ar trebui sa ai aceasta functie, care sa arate textdraw-ul jucatorului. Tu doar setezi string-ul...
Reply
#6

Pai nu e, unde o adaug?
Reply
#7

La
Code:
OnPlayerConnect
Adaugi:
Code:
TextDrawShowForPlayer(playerid, wanted1[playerid]);
Poate asa va merge...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)