SA-MP Forums Archive
Help with variable - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with variable (/showthread.php?tid=655601)



Help with variable - ,TomY' - 25.06.2018

Hi all. Have problem with code. I have this:
Код:
stock CreateFraction(FractionName[], Float:EnterX, Float:EnterY, Float:EnterZ, id, lvl, skini, uzdyrba,galininka[],spalv[],koma[], virtualus =0)
{
	new fquery[100];
	format(workInfo[workid][nam], 100, "%s", FractionName);
	format(workInfo[workid][spalva], 7, "%s", spalv);
	format(workInfo[workid][galininkas], 100, "%s", galininka);
	format(workInfo[workid][komanda], 20, "%s", koma);
	workInfo[workid][jobid] = id;
	workInfo[workid][skinid] = skini;
	workInfo[workid][lvlneed] = lvl;
	workInfo[workid][uzdirba] = uzdyrba;
	workInfo[workid][checkpointidx] = CreatePickupA(1275 ,2, EnterX, EnterY, EnterZ,virtualus);
	format(fquery,sizeof(fquery),"SELECT * FROM `darbai` WHERE `id` = '%i'",id);
	mysql_function_query(MysqlConnection,fquery,true,"DarbuLoad","d",workid);
	workid ++;
	return 1;
}
And then after server start
Код:
CreateFraction("FracName", 237.2637,110.7220,8000.2188, 0, 20000, 0,0,"test","E55B3C","/test");
This code working good. But now I trying to this:
Код:
CreateFraction("%i", 237.2637,110.7220,8000.2188, 0, 20000, 0,0,"test","E55B3C","/test",myname);
And I getting error: argument type mismatch. Is it possible, to use FractionName from variable, like I trying to do?


Re: Help with variable - div - 25.06.2018

format a string buddy

Код:
new mystring[24];
format(mystring, sizeof(mystring, "%i", myname); //If it's a string, it should be %s though
CreateFraction(mystring, 237.2637,110.7220,8000.2188, 0, 20000, 0,0,"test","E55B3C","/test");
This should work..


EDITTED: Had a mistake, try again now..


Re: Help with variable - ,TomY' - 25.06.2018

Using this code - no errors, but code doesn't work. Text does not appear :/


Re: Help with variable - Verc - 25.06.2018

Read the comment,it should be %s if it's a name.


Re: Help with variable - div - 25.06.2018

Dayum, please rep if it helped, I'm in desperate need of reputation to advertise the server I will be HAVING in future :/


Btw how much rep do i need to post in the ADVERTISEMENT SUBFORUM?


Re: Help with variable - ,TomY' - 25.06.2018

I using %s, not %i and still no text...


Re: Help with variable - div - 25.06.2018

If you want the fraction to be created with your name like ",TomY"

Код:
new mystring[24], myname[24];
GetPlayerName(playerid, myname, 24);
format(mystring, sizeof(mystring, "%s", myname); //If it's a string, it should be %s though
CreateFraction(mystring, 237.2637,110.7220,8000.2188, 0, 20000, 0,0,"test","E55B3C","/test");
[/CODE]


Re: Help with variable - GTLS - 25.06.2018

Quote:
Originally Posted by div
Посмотреть сообщение
Dayum, please rep if it helped, I'm in desperate need of reputation to advertise the server I will be HAVING in future :/


Btw how much rep do i need to post in the ADVERTISEMENT SUBFORUM?
begging does not get you true rep lol. You need 15 rep for advertisement. Dont beg for rep and have some self respect. If people wanna give you rep, they will if dont, then its not a big deal. rep isnt money. rep is rep on SAMP forums which is useless in rest of the world.


Re: Help with variable - ,TomY' - 26.06.2018

Still need help. This code does not working for me.. Pickup appears, but text - no.


Re: Help with variable - Verc - 26.06.2018

Post the function of CreatePickupA.
Or you should create pickup like normal using CreatePickup or CreateDynamicPickup.