19.12.2013, 17:41
Hi,
I've got a problem.
I'm using multiple filterscripts to split up some stuff.
Speedometer script, admin script and housing/businesses script.
This way, I can later re-use those systems easily when I would create a new gamemode.
But by doing this, alot of data must be transferred between those scripts.
I'm using CallRemoteFunction to do this.
In the speedometer script for example, I need to know if a player is an admin before a command may be used in the speedometer script.
So, from within the speedometer script, I'm calling a remote function inside the admin script, which returns 1 or -1 to the speedometer script.
This works fine as they are integers.
But I don't seem to be able to return floats or strings this way.
Inside the speedometer script:
Admin-script:
This works for example.
The speedometer script makes a call to the admin script, which gets the admin-lvl of the given player and returns it.
But how can I make the same system returning floats and strings? In case I need coordinates or a name returned.
I have made a work-around for this though, but it's quite complex.
The speedometer script makes a call using CallRemoteFunction to get the vehicle-name of an owned vehicle from the housing script (owned vehicles can be renamed by the owner).
The housing script answers that call and uses another CallRemoteFunction to transfer the name to the speedometer script, which receives it and stores the name in a variable.
This works, but it's complex to manage if you need to do this for alot of different things.
Each variable passed around needs a global variable in the other script to store that result until it is used.
How can you return floats/strings?
Is it possible?
I've got a problem.
I'm using multiple filterscripts to split up some stuff.
Speedometer script, admin script and housing/businesses script.
This way, I can later re-use those systems easily when I would create a new gamemode.
But by doing this, alot of data must be transferred between those scripts.
I'm using CallRemoteFunction to do this.
In the speedometer script for example, I need to know if a player is an admin before a command may be used in the speedometer script.
So, from within the speedometer script, I'm calling a remote function inside the admin script, which returns 1 or -1 to the speedometer script.
This works fine as they are integers.
But I don't seem to be able to return floats or strings this way.
Inside the speedometer script:
Code:
if (CallRemoteFunction("Admin_GetPlayerLevel", "i", playerid) > 3) SendClientMessage(playerid, 0xFFFFFFFF, "You have admin-lvl 3");
Code:
forward Admin_GetPlayerLevel(playerid); Public Admin_GetPlayerLevel(playerid) { return APlayerData[playerid][PlayerLevel]; }
The speedometer script makes a call to the admin script, which gets the admin-lvl of the given player and returns it.
But how can I make the same system returning floats and strings? In case I need coordinates or a name returned.
I have made a work-around for this though, but it's quite complex.
The speedometer script makes a call using CallRemoteFunction to get the vehicle-name of an owned vehicle from the housing script (owned vehicles can be renamed by the owner).
The housing script answers that call and uses another CallRemoteFunction to transfer the name to the speedometer script, which receives it and stores the name in a variable.
This works, but it's complex to manage if you need to do this for alot of different things.
Each variable passed around needs a global variable in the other script to store that result until it is used.
How can you return floats/strings?
Is it possible?