String return + CallRemoteFunction - 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: String return + CallRemoteFunction (
/showthread.php?tid=441778)
String return + CallRemoteFunction -
IgrexolonO - 04.06.2013
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.
Re: String return + CallRemoteFunction -
Vince - 04.06.2013
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.
Re: String return + CallRemoteFunction -
IgrexolonO - 04.06.2013
Ok. Thank you.
Re: String return + CallRemoteFunction -
IgrexolonO - 04.06.2013
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.
Re: String return + CallRemoteFunction -
NvidiaForTheWin - 04.06.2013
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