Split Float; Dynamic Zone -
playstores - 02.11.2018
Quote:
ocmd:createzone(playerid,params[])
{
if(ZoneCreat[playerid]<1) return SCM(playerid,-1,"Get to the Max X / Y Coordinate and type /createzone");
ZoneCreat[playerid]=1;
new Float: xc, Float:yc,Float:zc,query[256];
GetPlayerPos(playerid, xc, yc, zc);
new id=getFreeHobbyLosZoneID();
//Zone[id]
}
|
I need to split X,Y Coordinates in 4 Floats: (minx, miny, maxx, maxy)
How to do that now ?
Re: Split Float; Dynamic Zone -
NaS - 02.11.2018
You must save the first pair of coordinates in a global array, or a PVar. In this case I'd prefer a PVar since only admins use this command probably, and in that case a global array would be 99% unused most of the time.
In the first step you can save the X and Y coord into a PVar like this:
Code:
SetPVarFloat(playerid, "ZoneCreateMinX", xc);
SetPVarFloat(playerid, "ZoneCreateMinY", yc);
In the second step you can get the coords with GetPVarFloat:
Code:
minx = GetPVarFloat(playerid, "ZoneCreateMinX");
miny = GetPVarFloat(playerid, "ZoneCreateMinY");
And use the coords from GetPlayerPos for MaxX and MaxY.
Z is not needed in most cases, but if you need it you can easily add that too.
Hope I got you right.
Re: Split Float; Dynamic Zone -
playstores - 02.11.2018
not possible in that way
I need minx, miny, maxx, maxy in 4 different Floats take a look at
https://sampwiki.blast.hk/wiki/GangZoneCreate
In your code it would look like:
GangZoneCreate(ZoneCreateMinX,ZoneCreateMinY) > tag mismatch
Re: Split Float; Dynamic Zone -
NaS - 02.11.2018
Quote:
Originally Posted by playstores
not possible in that way
I need minx, miny, maxx, maxy in 4 different Floats take a look at
https://sampwiki.blast.hk/wiki/GangZoneCreate
In your code it would look like:
GangZoneCreate(ZoneCreateMinX,ZoneCreateMinY) > tag mismatch
|
That's just the first pair. The second pair would be acquired from GetPlayerPos when typing the command a second time.
At least that's what I think you wanted to do.
When at minx/miny type the command to save minx/miny. Then go to maxx/maxy and type the command again, then you have maxx/maxy too.
Re: Split Float; Dynamic Zone -
playstores - 02.11.2018
I can't really Imagine what you mean
// btw wait a minute
Re: Split Float; Dynamic Zone -
TheToretto - 02.11.2018
Use a variable, and each time you type the command, increment its value by 1, just like steps to follow. Use a switch statement and use case 1: etcetera, then when you reach the fourth step and accomplish it, which will be the maxY, reset the variable's value to 0.
Well obviously each step you should save the minX / maxX using GetPlayerPos