Jump to content
  • 0

comanda /jobs


testX

Question

Problema intalnita (descriere): Salut all, am facut comanda /jobs, care imi arata numele job-ului si muncitorii, am incercat prima data sa mii arate doar pe cei online la muncitori, dar m-am gandit ca e mai bine si cei online si offline, am incercat sa fac si pentru cei offline sa mii arate dar nu imi dar corect numarul de muncitori, am facut doar ptr 1 job

EX:

am 3 conturi in baza de date, 2 dintre ele au job 1(detectiv) si unu nu are niciun job, intru in joc si imi da loc de 2 muncitori 40, 43, 48 sau 50 in loc de 2


Ero(area / rile) / warning-(ul / urile): nu imi da nici in GM, svr_log sau sql_log
Liniile de cod / sursa / script-ul(obligatoriu): 

CMD:jobs(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	{
	    new pName[MAX_PLAYER_NAME];
	    GetPlayerName( playerid, pName, MAX_PLAYER_NAME );
		szQuery[ 0 ] = EOS;
	    new dec, drg, arms, trk, pilx, sp, tit, fm, ctr, lwr, string[256];
	    foreach(Player, i)
	    {
	        dec = mysql_format (mysql_db, szQuery, sizeof(szQuery), "SELECT `Job` FROM `users` WHERE `users`.`Job` ='1'"); mysql_tquery(mysql_db, szQuery);
			if(P_DATA[i][pJob] == 2)
			{
			    drg++;
			}
			if(P_DATA[i][pJob] == 3)
			{
			    arms++;
			}
			if(P_DATA[i][pJob] == 4)
			{
			    trk++;
			}
			if(P_DATA[i][pJob] == 5)
			{
			    pilx++;
			}
			if(P_DATA[i][pJob] == 6)
			{
			    sp++;
			}
			if(P_DATA[i][pJob] == 7)
			{
			    tit++;
			}
			if(P_DATA[i][pJob] == 8)
			{
			    fm++;
			}
			if(P_DATA[i][pJob] == 9)
			{
			    ctr++;
			}
			if(P_DATA[i][pJob] == 10)
			{
			    lwr++;
			}
		}
		format(string,sizeof(string),"Job\tMuncitori\n[1] Detectiv\t%d\n[2] Drugs Dealer\t%d\n[3] Arms Dealer\t%d\n[4] Trucker\t%d\n[5] Pilot\t%d\n[6] Spalator de strazi\t%d\n[7] Taietor de iarba\t%d\n[8] Farmer\t%d\n[9] Constructor\t%d\n[10] Lawyer\t%d", dec, drg, arms, trk, pilx, sp, tit, fm, ctr, lwr);
		ShowPlayerDialog(playerid, DIALOG_JOBS, DIALOG_STYLE_TABLIST_HEADERS, "Job-urile SERVER-ULUI", string, "Ok", "");
	}
	return 1;
}


Imagini / Video (optional): -
Ati incercat sa rezolvati singur?:  da

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Mai bine utilizezi functia asta, globala decat cum ai tu
 

 

getjobworkers(jobid)
{
    new Cache:Result,Get[2];
    format(strings, sizeof(strings), "SELECT `Job` FROM `users` WHERE `Job` = %d", jobid);//
    Result = mysql_query(handle,strings);
    cache_get_data(Get[0], Get[1], handle);
    cache_delete(Result);
    return Get[0];
}

si vei face asa

 

format(string,sizeof(string),"La jobul 4 sunt  %d muncitori",getjobworkers(4));

SendClientMessage(playerid,-1,string);

Edited by Mister
  • Upvote 1

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.