CallRemoteFunction
#4

You just need to add a Float: tag in front of CallRemoteFunction
PHP код:
Float:Float:CallRemoteFunction("GetSpawn","i",0),
Float:Float:CallRemoteFunction("GetSpawn","i",1),
Float:Float:CallRemoteFunction("GetSpawn","i",2) + 5.0,
Float:Float:CallRemoteFunction("GetSpawn","i",3); 
That would solve your problem but calling it like that looks kind of ugly and you are wasting memory because each constant string you use in a function call gets allocated into the data section (many "GetSpawn" and "i" instead of just one)

Therefor you should redefine the function or create a new function
PHP код:
// 1. Redefinition of CallRemoteFunction with default parameters
native Float_GetSpawn(func[] = "GetSpawn"form[] = "i", {Float_}: ...) = CallRemoteFunction;
// Macro to use the default parameter for func[] and form[]
#define GetSpawn( _GetSpawn(_,_,
// If you use this you need to put it somewhere at the top / include
// 2. Or you create a function - although with that method you lose some speed
FloatGetSpawn(coord) return FloatCallRemoteFunction("GetSpawn""i"coord);
// That could be put anywhere but you would get a forcing reparse warning if you put if after the first usage
// => Should also be somewhere at the top / include to avoid the warning 
After that it would look like that
PHP код:
Float:GetSpawn(0),
Float:GetSpawn(1),
Float:GetSpawn(2) + 5.0,
Float:GetSpawn(3); 
To convert your code just use the search and replace tool

Quote:
Originally Posted by AroseKhanNiazi
Посмотреть сообщение
I tried this code and the results in print were perfect but the spawning of vehicle was out of map(bonds) which causes a screen freeze..
The reason is simple, printf doesn't care which type of data you pass to it
But if you pass an int to a Float parameter like in CreateVehicle the compiler will do that
PHP код:
CreateVehicle(CallRemoteFunction("MapInfoCheck","ii",CurrentGameMode,4),float(CallRemoteFunction("GetSpawn","i",0)),float(CallRemoteFunction("GetSpawn","i",1)),...); 
It tries to convert the returned value of CallRemoteFunction to a float although it is already a float resulting in something undefined
Reply


Messages In This Thread
CallRemoteFunction - by AroseKhanNiazi - 08.03.2016, 15:18
Re: CallRemoteFunction - by Nero_3D - 08.03.2016, 16:06
Re: CallRemoteFunction - by AroseKhanNiazi - 08.03.2016, 16:14
Re: CallRemoteFunction - by Nero_3D - 08.03.2016, 16:48
Re: CallRemoteFunction - by AroseKhanNiazi - 08.03.2016, 17:08

Forum Jump:


Users browsing this thread: 1 Guest(s)