Jump to content
  • 0

Ajutor sistem Job-uri


VAurel

Question

Salut, am incercat si eu pe un gamemode de la 0 sa fac un sistem de job-uri.

Am facut LoadJobs, functioneaza totul ok, Job-ul se creeaza, Text-ul si Pickup-ul sunt creeate doar ca am o problema, nu apare numele job-ului, aveti mai jos cod-ul si poza.

forward LoadJobs();
public LoadJobs()
{
	for(new i = 1; i <= cache_num_rows(); i++)
	{
		cache_get_value_name_int  (0, "ID",	 	     JobInfo[i][ID]);
		cache_get_value_name_float(0, "X", 	 	 	 JobInfo[i][LocationX]);
		cache_get_value_name_float(0, "Y", 		     JobInfo[i][LocationY]);
		cache_get_value_name_float(0, "Z", 		     JobInfo[i][LocationZ]);
		cache_get_field_name      (0, "Name",        JobInfo[i][Name]);

		Iter_Add(Jobes, i);
		new gString[200];
        format(gString,sizeof(gString),"Job: {cc0000}%s{ffffff}\nWrite {cc0000}(/getjob){ffffff} to get job\nWrite {cc0000}(/quitjob){ffffff} to quit job",JobInfo[i][Name]);
        joblabel[i] = CreateDynamic3DTextLabel(gString, 0xFFFFFFFF, JobInfo[i][LocationX],JobInfo[i][LocationY],JobInfo[i][LocationZ], 10, INVALID_PLAYER_ID, INVALID_VEHICLE_ID,  0, -1,  -1, -1,20.0 );
    	CreatePickup(1239, 23, JobInfo[i][LocationX], JobInfo[i][LocationY], JobInfo[i][LocationZ], 0);
	}
	printf("Jobs: %d", Iter_Count(Jobes));
	return 1;
}

Daca m-ati putea ajuta as fi tare recunoscator, mersi.

screenshot_01-08-2021_10-50-59-916.png

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

daca nu ma insel, ar trebui ca, codul tau sa arate astfel

 

forward LoadJobs();
public LoadJobs()
{
	for(new i = 1; i <= cache_num_rows(); i++)
	{
		cache_get_value_name_int  (0, "ID",	 	     JobInfo[i][ID]);
		cache_get_value_name_float(0, "X", 	 	 	 JobInfo[i][LocationX]);
		cache_get_value_name_float(0, "Y", 		     JobInfo[i][LocationY]);
		cache_get_value_name_float(0, "Z", 		     JobInfo[i][LocationZ]);
		cache_get_field_name      (0, "Name",        JobInfo[i][Name], 128);

		Iter_Add(Jobes, i);
		new gString[200];
        format(gString,sizeof(gString),"Job: {cc0000}%s{ffffff}\nWrite {cc0000}(/getjob){ffffff} to get job\nWrite {cc0000}(/quitjob){ffffff} to quit job",JobInfo[i][Name]);
        joblabel[i] = CreateDynamic3DTextLabel(gString, 0xFFFFFFFF, JobInfo[i][LocationX],JobInfo[i][LocationY],JobInfo[i][LocationZ], 10, INVALID_PLAYER_ID, INVALID_VEHICLE_ID,  0, -1,  -1, -1,20.0 );
    	CreatePickup(1239, 23, JobInfo[i][LocationX], JobInfo[i][LocationY], JobInfo[i][LocationZ], 0);
	}
	printf("Jobs: %d", Iter_Count(Jobes));
	return 1;
}

 

daca tot nu functioneaza, lasa-mi mesaj pe discord

hanako#5798

Link to comment
Share on other sites

  • 0
17 minutes ago, hanako said:

daca nu ma insel, ar trebui ca, codul tau sa arate astfel

 

forward LoadJobs();
public LoadJobs()
{
	for(new i = 1; i <= cache_num_rows(); i++)
	{
		cache_get_value_name_int  (0, "ID",	 	     JobInfo[i][ID]);
		cache_get_value_name_float(0, "X", 	 	 	 JobInfo[i][LocationX]);
		cache_get_value_name_float(0, "Y", 		     JobInfo[i][LocationY]);
		cache_get_value_name_float(0, "Z", 		     JobInfo[i][LocationZ]);
		cache_get_field_name      (0, "Name",        JobInfo[i][Name], 128);

		Iter_Add(Jobes, i);
		new gString[200];
        format(gString,sizeof(gString),"Job: {cc0000}%s{ffffff}\nWrite {cc0000}(/getjob){ffffff} to get job\nWrite {cc0000}(/quitjob){ffffff} to quit job",JobInfo[i][Name]);
        joblabel[i] = CreateDynamic3DTextLabel(gString, 0xFFFFFFFF, JobInfo[i][LocationX],JobInfo[i][LocationY],JobInfo[i][LocationZ], 10, INVALID_PLAYER_ID, INVALID_VEHICLE_ID,  0, -1,  -1, -1,20.0 );
    	CreatePickup(1239, 23, JobInfo[i][LocationX], JobInfo[i][LocationY], JobInfo[i][LocationZ], 0);
	}
	printf("Jobs: %d", Iter_Count(Jobes));
	return 1;
}

 

daca tot nu functioneaza, lasa-mi mesaj pe discord

hanako#5798

dty.pwn(885) : warning 202: number of arguments does not match definition 

Linia cu warnning-ul : cache_get_field_name      (0, "name",        JobInfo[i][Name], 128);

Link to comment
Share on other sites

  • 0

Ok. Pana la urma ce versiune de mysql folsoesti? r33+ sau r40+?

Pentru ca in r40+

cache_get_field_name

Are aceasta definitie care nu face ceea ce crezi  https://sampwiki.blast.hk/wiki/MySQL#cache_get_field_name

Daca intradevar folsoesti r40+ pentru a extrage acel string pentru Name poti folosi

cache_get_value_name(row, "Name", JobInfo[i][Name], 50); // row probabil este 0 daca doresti primul rezultat din query, si 50 este marimea pentru JobInfo[i][Name] editeaza cu cat este de fapt

 

  • Thanks 1
Link to comment
Share on other sites

  • 0
5 hours ago, Banditul said:

Ok. Pana la urma ce versiune de mysql folsoesti? r33+ sau r40+?

Pentru ca in r40+

cache_get_field_name

Are aceasta definitie care nu face ceea ce crezi  https://sampwiki.blast.hk/wiki/MySQL#cache_get_field_name

Daca intradevar folsoesti r40+ pentru a extrage acel string pentru Name poti folosi

cache_get_value_name(row, "Name", JobInfo[i][Name], 50); // row probabil este 0 daca doresti primul rezultat din query, si 50 este marimea pentru JobInfo[i][Name] editeaza cu cat este de fapt

 

Salut, da, r40+, am inlocuit cu ce mi-ai dat tu dar, am exact aceeasi problema pe care am avut-o prima oara cand am facut topicul, adica nu imi apare numele de la Job.

 

EDIT : Am rezolvat, eram eu prost acum am observat ca nu erau aranjate in ordine, faza este ca acum apare asa

 

screenshot_12-08-2021_20-11-00-280.png

Edited by VAurel
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.