Problem -
Micko123 - 01.09.2016
Hey guys. My friend made dynamic GPS system for me but there is one problem. It will update list of locations only when i restart server.
PHP код:
CMD:creategps(playerid, params[])
{
if (PlayerInfo[playerid][Admin] < 5)
{
ERROR(playerid, "You are not authorized!");
return 1;
}
if (sscanf(params, "s[40]", params[0]))
{
KORISTI(playerid, "/creategps [Name]");
return 1;
}
if (strlen(params[0]) < 3)
{
ERROR(playerid, "3 characters minimum!");
return 1;
}
new Free_GPSID = Iter_Free(i_GPSLocations);
if (Free_GPSID > MAX_GPS_LOCATIONS)
{
ERROR(playerid, "Not more than 20 locations");
return 1;
}
new Float: pX, Float: pY, Float: pZ;
GetPlayerPos(playerid, pX, pY, pZ);
format(GPSData[Free_GPSID][gpsName], 40, "%s", params[0]);
GPSData[Free_GPSID][gpsXPos] = pX;
GPSData[Free_GPSID][gpsYPos] = pY;
GPSData[Free_GPSID][gpsZPos] = pZ;
GPSData[Free_GPSID][gpsExist] = 1;
SachuvajGps(Free_GPSID);
new x_string[50];
format(x_string, sizeof(x_string), "You've create gps ID: %d", Free_GPSID);
SCM(playerid, -1, x_string);
return 1;
}
There is command for creating it. If you need anything else tell me
Re: Problem -
Micko123 - 01.09.2016
I just tested it and another problem came in. It won't create GPS with ID 0, 1, 1... it creates with same ID and owerwrites last one.
Re: Problem -
Sjn - 01.09.2016
Because, you didn't even add the ID with Iter_Add after creating the GPS.
Re: Problem -
Micko123 - 01.09.2016
let me say this again. Im begginer. My friend did this for me and I never used iterators. So can you help me with this maybe?
Re: Problem -
Sjn - 01.09.2016
Just add Iter_Add(Free_GPSID); after the GPSData[Free_GPSID][gpsExist] = 1; line. If that doesn't work, then there might be some mistakes while creating the iterator.
Re: Problem -
Micko123 - 01.09.2016
Someone is joking with me here. HOW IS THIS EVEN POSSIBLE
Код:
C:\Users\Micko\Desktop\BaySide\gamemodes\BS.pwn(5256) : error 017: undefined symbol "Itter_Add"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
And here is the line
PHP код:
Iter_Add(Free_GPSID);
WTF!
Re: Problem -
Sjn - 01.09.2016
I'm sorry, I forgot it should have the iterator name before the value lol. Should be Iter_Add(i_GPSLocations, Free_GPSID);
Re: Problem -
Threshold - 01.09.2016
Lol, it's probably because you're using the standalone include of foreach. Who knows? Maybe Kar screwed something up :P
Re: Problem -
JaydenJason - 01.09.2016
Quote:
Originally Posted by Micko123
Someone is joking with me here. HOW IS THIS EVEN POSSIBLE
Код:
C:\Users\Micko\Desktop\BaySide\gamemodes\BS.pwn(5256) : error 017: undefined symbol "Itter_Add"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
And here is the line
PHP код:
Iter_Add(Free_GPSID);
WTF!
|
C:\Users\Micko\Desktop\BaySide\gamemodes\BS.pwn(52 56) : error 017: undefined symbol "Itter_Add"
Make sure your code says Iter_Add
not Itter_Add
Re: Problem -
Micko123 - 01.09.2016
Okay that is fixed. But another problem came in.. (DANG). It wont write in scriptfile that ID. It only writes first gps i create. When i create 2 gps it adds them on gps list as
1:Spawn2:Burg
instead of
1:Spawn
2:Burg
You got it??