String return + CallRemoteFunction
#1

Hello! I have no idea, how can I return string from one script to another. Here's an example what I've wrote:

Код:
new VehicleNames[][]= {
    {"Landstalker"}, {"Bravura"}, {"Buffalo"}, ...blablalblabla
};

forward vehicleNamesReturner(vid);
public vehicleNamesReturner(vid)
{
	return VehicleNames[vid];
}
-> public functions may not return arrays (symbol "vehicleNamesReturner")

Ok. Now in my second script, i've got this:

Код:
	for(new i=0;i<sizeof(vehaChanga);i++)
	{
		_vcCPs[i] = CreateDynamicCircle(vehaChanga[i][1], vehaChanga[i][2], 7.5);
		new vehaName[40];
		format(vehaName, sizeof(vehaName), "{00FF00}*{FFFFFF}%s{00FF00}*", CallRemoteFunction("vehicleNamesReturner", "i", floatround(vehaChanga[i][0], floatround_round)-400));
		CreateDynamic3DTextLabel(vehaName, -1, vehaChanga[i][1], vehaChanga[i][2], vehaChanga[i][3], 25.0);
	}
So.. is there any way I could call string, and return it to another script?

Thanks for help.
Reply
#2

If these are truly two different scripts (i.e. not an include file) then there is no solution but to copy the entire array into both scripts.
Reply
#3

Ok. Thank you.
Reply
#4

Well. Last question;

it's float, because I keep positions and vehicle id on one variable.

Thanks for your solution, but your scripts, are 2 big for my idea of small gamemode. Anyway thanks.

Regards.
Reply
#5

i wonder why he dont write all the script in ONE pwn file... it wont make his GM bigger...

1400 lines of code in one pwn file
or
2 files of 700 lines
= 1400 lines ANYWAY

maybe i just didnt get his point O_O
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)