new Float:spawns[][4] =
{
{-2335.0002,-1612.7473,483.7189,218.3687}
};
forward Float:GetSpawn(coord);
public Float:GetSpawn(coord)
{
if(coord < 0 || coord > 3) return -1.0;
return spawns[0][coord];
}
Float:x=CallRemoteFunction("GetSpawn","i",0),
Float:y=CallRemoteFunction("GetSpawn","i",1),
Float:z=CallRemoteFunction("GetSpawn","i",2) + 5.0,
Float:a=CallRemoteFunction("GetSpawn","i",3);
-988680192.000000 0.000000 5.000000 0.000000
native Float: _GetSpawn(func[] = "GetSpawn", form[] = "i", {Float, _}: ...) = CallRemoteFunction;
#define GetSpawn( _GetSpawn(_,_,
Veh[playerid]= CreateVehicle(CallRemoteFunction("MapInfoCheck","ii",CurrentGameMode,4),CallRemoteFunction("GetSpawn","i",0),CallRemoteFunction("GetSpawn","i",1),CallRemoteFunction("GetSpawn","i",2)+5.0,CallRemoteFunction("GetSpawn","i",3), random(256), random(256), -1, 0);
printf("%f %f %f %f",CallRemoteFunction("GetSpawn","i",0),CallRemoteFunction("GetSpawn","i",1),CallRemoteFunction("GetSpawn","i",2),CallRemoteFunction("GetSpawn","i",3));
print("PASS");
PutPlayerInVehicle(playerid, Veh[playerid], 0);
print("PASS");
TogglePlayerControllable(playerid,false);
print("PASS");
GhostModeTimer[playerid] = CallRemoteFunction("MapInfoCheck","ii",CurrentGameMode,3);
print("PASS");
printf("%d",GhostModeTimer[playerid]);
native Float: _GetSpawn(func[] = "GetSpawn", form[] = "i", {Float, _}: ...) = CallRemoteFunction;
Float:x = Float:CallRemoteFunction("GetSpawn","i",0),
Float:y = Float:CallRemoteFunction("GetSpawn","i",1),
Float:z = Float:CallRemoteFunction("GetSpawn","i",2) + 5.0,
Float:a = Float:CallRemoteFunction("GetSpawn","i",3);
// 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
Float: GetSpawn(coord) return Float: CallRemoteFunction("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
Float:x = GetSpawn(0),
Float:y = GetSpawn(1),
Float:z = GetSpawn(2) + 5.0,
Float:a = GetSpawn(3);
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..
|
CreateVehicle(CallRemoteFunction("MapInfoCheck","ii",CurrentGameMode,4),float(CallRemoteFunction("GetSpawn","i",0)),float(CallRemoteFunction("GetSpawn","i",1)),...);