27.02.2019, 10:51
Код:
CMD:createatm(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command!"); new Float:x, Float:y, Float:z; new str[128], query[500]; new id = Iter_Free(FreeAtmID); GetPlayerPos(playerid, Float:x, Float:y, Float:z); AtmInfo[id][PosX] = x; AtmInfo[id][PosY] = y; AtmInfo[id][PosZ] = z; AtmInfo[id][ID] = cache_insert_id(); Iter_Add(FreeAtmID, id); AtmInfo[id][AtmObject] = CreateObject(19324, AtmInfo[id][PosX], AtmInfo[id][PosY], AtmInfo[id][PosZ], 0, 0, 0, 1000); format(str,sizeof(str),"You've successfully created an ATM ID: %d", Iter_Free(FreeAtmID)); SendClientMessage(playerid, COLOR_BLUE, str); mysql_format(sqlGameConnection, query, sizeof(query),"INSERT INTO `atms` ( `IGID` , `PosX` , `PosY` , `PosZ` ) VALUES( '%i' , '%f' , '%f' , '%f' )", AtmInfo[id][ID], AtmInfo[id][PosX], AtmInfo[id][PosY], AtmInfo[id][PosZ]); mysql_pquery(sqlGameConnection, query); return 1; }