02.01.2017, 20:07
I made an ATM system with MySQL, but when as an admin I create one, it gives me the text, everything works, but the object doesn't spawn for some reason, and the server gives me the text: server: unknown command.
Код:
CMD:createatm(playerid, params[]) { new query[256], model, Float:p[3]; if(Player[playerid][Admin] != 3) return SendClientMessage(playerid, -1, "Nincs hozzб jogosultsбgod."); if(sscanf(params, "d", model)) return SendClientMessage(playerid, -1, "{9FCEE5}[Hasznбlat] {FFFFFF}/createatm [object model ID]"); GetPlayerPos(playerid, p[0], p[1], p[2]); for(new i = 0; i < MAX_ATM; i ++) if(!ATM[i][Letrehozva]) { ATM[i][Letrehozva] = 1; ATM[i][Model] = model; ATM[i][Pos][0] = p[0]; ATM[i][Pos][1] = p[1]; ATM[i][Pos][2] = p[1]; ATM[i][Object] = CreateDynamicObject(ATM[i][Model], ATM[i][Pos][0], ATM[i][Pos][1], ATM[i][Pos][2], ATM[i][Pos][3], ATM[i][Pos][4], ATM[i][Pos][5]); mysql_format(mysql, query, sizeof(query), "INSERT INTO `atm` (`Model`, `PosX`, `PosY`, `PosZ`, `PosRX`, `PosRY`, `PosRZ`) VALUES (%d, %f, %f, %f, 0.0, 0.0, 0.0)", model, p[0], p[1], p[2]); mysql_tquery(mysql, query, "OnATMCreate", "d", i); SendAdminAlert(COLOR_LIGHTRED, "[AdmWarn] %s lйtrehozta a(z) %d ID-jű ATM-et.", GetRPName(playerid), ATM[i][ID]); return i; } return 1; } forward OnATMCreate(id); public OnATMCreate(id) { if(id == -1 || !ATM[id][Letrehozva]) return 0; ATM[id][ID] = cache_insert_id(mysql); SaveATM(id); return 1; } stock SaveATM(id) { new query[200]; format(query, sizeof(query), "UPDATE `atm` SET `Model` = %d, `PosX` = %f, `PosY` = %f, `PosZ` = %f, `PosRX` = %f, `PosRY` = %f, `PosRZ` = %f, `Letrehozva` = %d WHERE `ID` = %d", ATM[id][Model], ATM[id][Pos][0], ATM[id][Pos][1], ATM[id][Pos][2], ATM[id][Pos][3], ATM[id][Pos][4], ATM[id][Pos][5], ATM[id][Letrehozva], ATM[id][ID]); return mysql_tquery(mysql, query); }