Okay so, for some reason when more than one gate loads it goes to shit the second gate moves to the position of the first gate, the third gate moves to the second gate position, and so on, why is this happening?
enum _GateEnum
{
? ? GateID,
? ? Float:gate_place,
? ? Float:grX,
? ? Float:grY,
? ? Float:grZ,
? ?GateFaction,
? ?GateModel,
? ?GateObject,
? ?GateStatus
}
new Gates;
new Iterator:server_gates<MAX_GATES>;
load_gates()
{
? ? inline LoadGates()
? ? {
? ? ? ? if(!cache_num_rows())
? ? ? ? {
? ? ? ? ? ? printf(": No Gate data found!");
? ? ? ? ? ? return 0;
? ? ? ? }
? ? ? ? foreach (new i : Range(0, cache_num_rows()))
? ? ? ? {
? ? ? ? ? ? cache_get_value_int(i, "id", Gates);
? ? ? ? ? ? cache_get_value_float(i, "x", Gates);
? ? ? ? ? ? cache_get_value_float(i, "y", Gates);
? ? ? ? ? ? cache_get_value_float(i, "z", Gates);
? ? ? ? ? ? cache_get_value_float(i, "rx", Gates);
? ? ? ? ? ? cache_get_value_float(i, "ry", Gates);
? ? ? ? ? ? cache_get_value_float(i, "rz", Gates);
? ? ? ? ? ? cache_get_value_int(i, "faction", Gates);
? ? ? ? ? ? cache_get_value_int(i, "model", Gates);
? ? ? ? ? ? Gates = 0;
? ? ? ? ? ? Gates = CreateObject(Gates, Gates, Gates, Gates, Gates, Gates, Gates, 300.0);
? ? ? ? ? ? Iter_Add(server_gates, i);
? ? ? ? }
? ? ? ? printf("%d gates loaded.", i);
? ? ? ? return 1;
? ? }
? ? MySQL_TQueryInline(g_SQL, using inline LoadGates, "SELECT * FROM `server_gates`");
? ? return 1;
}
YCMD:gate(playerid, params[], help)
{
? ? foreach(new i:server_gates)
? ? {
? ? ? ? if(IsPlayerInRangeOfPoint(playerid, 5, Gates, Gates, Gates))
? ? ? ? {
? ? ? ? ? ? if(user_faction == Gates)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if(Gates == 0)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? MoveObject(Gates, Gates, Gates, Gates -7.0, 3.0);
? ? ? ? ? ? ? ? ? ? Gates = 1;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? MoveObject(Gates, Gates, Gates, Gates, 3.0);
? ? ? ? ? ? ? ? ? ? Gates = 0;
? ? ? ? ? ? ? ? }?
? ? ? ? ? ? }
? ? ? ? ? ? else
? ? ? ? ? ? {
? ? ? ? ? ? ? ? SendClientMessage(playerid, -1, " You don't have access to this gate!");
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ? SendClientMessage(playerid, -1, ": You're not near any gate!");
? ? ? ? }
? ? }
? ? return 1;
}