11.01.2013, 12:12
Hey , i need some help with an ATM system, i made the system ,
This is the ENUM:
This is the LoadAtm
Under OnGameModeInit
OnPropUpdate :
The Command to create ATMS
My problem is , when i type /createatm , it creates the 3dtext and the pickup , but after ATM on the 3dtext, there are some overlayed numbers , and i get Unknown command and the pickup doesn't save on file !
How do i make the system to work ?
This is the ENUM:
Код:
enum atmInfo//ATM System { Float:atmX, Float:atmY, Float:atmZ, Text3D:atmTextInfo, }; new AtmInfo[25][atmInfo];
Код:
public LoadAtm() { new arrCoords[20][64]; new strFromFile2[256];//era 256 new File: file = fopen("ATM/ATMS.cfg", io_read); if (file) { new idx; while (idx < sizeof(AtmInfo)) { fread(file, strFromFile2); split(strFromFile2, arrCoords, '|'); AtmInfo[idx][atmX] = floatstr(arrCoords[4]); AtmInfo[idx][atmY] = floatstr(arrCoords[5]); AtmInfo[idx][atmZ] = floatstr(arrCoords[6]); idx++; } fclose(file); } return 1; }
Код:
for(new h = 0; h < sizeof(AtmInfo); h++) { new bstr[256]; format(bstr, sizeof(bstr), "ATM %d\n Scrie /atmhelp pentru \n comenzile ATM-ului",h); AtmInfo[h][atmTextInfo] = Create3DTextLabel(bstr,0xE7FF00FF,AtmInfo[h][atmX], AtmInfo[h][atmY], AtmInfo[h][atmZ]+1,20,0,1); AddStaticPickup(1212, 1, AtmInfo[h][atmX], AtmInfo[h][atmY], AtmInfo[h][atmZ]); pickups++; }
Код:
while (idx < sizeof(AtmInfo)) { new coordsstring[256]; format(coordsstring, sizeof(coordsstring), "%f,%f,%f\n", AtmInfo[idx][atmX], AtmInfo[idx][atmY], AtmInfo[idx][atmZ]); if(idx == 0) { file2 = fopen("ATM/ATMS.cfg", io_write); } else { file2 = fopen("ATM/ATMS.cfg", io_append); } fwrite(file2, coordsstring); format(coordsstring, sizeof(coordsstring), "ATM %d\n Scrie /atmhelp pentru \n comenzile ATM-ului",idx); Update3DTextLabelText (AtmInfo[idx][atmTextInfo],0xE7FF00FF,coordsstring);// idx++; fclose(file2); }
Код:
if(strcmp(cmd, "/createatm", true) == 0) { if(IsPlayerConnected(playerid)) { //new houseid = -1; new bstr[256]; new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X,Y,Z); new houseid = 0; if (PlayerInfo[playerid][pAdmin] >= 1338) { for(new h = 0; h < sizeof(AtmInfo); h++) { houseid = h + 1; AtmInfo[houseid][atmX] = X; AtmInfo[houseid][atmY] = Y; AtmInfo[houseid][atmZ] = Z; format(bstr, sizeof(bstr), "ATM %d\n Scrie /atmhelp pentru \n comenzile ATM-ului",houseid); AtmInfo[houseid][atmTextInfo] = Create3DTextLabel(bstr,0xE7FF00FF,AtmInfo[houseid][atmX], AtmInfo[houseid][atmY], AtmInfo[houseid][atmZ]+1,20,0,1); AddStaticPickup(1212, 1, AtmInfo[houseid][atmX], AtmInfo[houseid][atmY], AtmInfo[houseid][atmZ]); pickups++; } OnPropUpdate(); } } return 1; }
How do i make the system to work ?