Jump to content

Jakewow

Member
  • Posts

    130
  • Joined

  • Last visited

Everything posted by Jakewow

  1. eu nu vreau sa folosesc new string[256]; format(string, sizeof(string), "Admin %s promoted %s to admin level %d.", GetName(playerid), GetName(id), level); se poate fara?
  2. da, faza e ca nu vreau sa folosesc format..
  3. Username: Jakewow Problema întălnită: Problema adminlogs Detalii despre problemă: Vreau sa fac un AdminLog Ce ai încercat să faci înainte să postezi?: nu stiu Cod sursă (recomandat pastebin.com) : https://pastebin.com/tfsqHGMx Alte detalii: Aveti tot in pastebin
  4. incearca cu run as administrator incearca cu un sv de la 0, cel normal grandlarc il poti gasi pe pagina oficiala sa-mp.com (nu fac reclama) incearca sa adaugi crashdetect sau nativechecker
  5. unde iti spune warning 217: loose indentation inseamna ca nu e codul in rand cu celelalte linii adica mai adauga TAB-uri unde iti spune ca warning 204: symbol is assigned a value that is never used: "string7" inseamna ca tu la linia 4565 ai facut new string7[numar]; sterge acel string7[numar]; unde iti spune error 017: undefined symbol "string" inseamna ca tu trebuie sa definesti undeva new string[256];
  6. Why should I replace cache with ORM ? ORM-code is way easier to maintain. With the normal cache-stuff, you'd have to edit the code in several places in your script if you wan't to add a new variable and you also would need to edit some queries. With the ORM-system, all you need to do is to add one line. Topicul original ORM. Daca nu stii engleza naspa..
  7. E mult de explicat incepe si tu pe alt gm trebuie sa scoti securitatea pnm..
  8. Pai ai butonul asta : https://imgur.com/a/ZvSu6mQ Dupa selectezi Code Type si dai pe PHP si acolo pui codul
  9. Aici ai /setadmin : CMD:setadmin(playerid, params[]) { new id, adminlevel, gString[120]; if(PlayerInfo[playerid][pAdmin] < 6) return SCM(playerid, COLOR_WHITE, AdminOnly); if(sscanf(params, "ui", id, adminlevel)) return SCM(playerid, COLOR_GREY, "USAGE: {FFFFFF}/setadmin <playerid/name> <Admin Level>"); if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY, "Acel player nu este conectat."); if(adminlevel < 0 || adminlevel > 6) return SCM(playerid, COLOR_GREY, "Invalid admin level. 0-6"); if(PlayerInfo[id][pAdmin] > PlayerInfo[playerid][pAdmin]) return SCM(playerid, COLOR_GREY, "Nu poti folosi aceasta comanda pe acel player. Are admin level mai mare."); format(gString, 80, "Ai fost promovat la admin %d de %s", adminlevel, GetName(playerid)); SCM(id, COLOR_LIGHTBLUE, gString); format(gString, 100, "System: %s i-a setat lui %s admin level %d.", GetName(playerid), GetName(id), adminlevel); SendAdminHelperMessage(COLOR_LOGS, gString); if(adminlevel == 0) { PlayerInfo[id][pAW] = 0; UpdateVar(id, "AW", 0); SpecFaction[id] = 0; StopFly(playerid); UsedFly[playerid] = 0; SetPlayerHealthEx(playerid, 100); Iter_Remove(PlayerAdmins, id); } Iter_Add(PlayerAdmins, id); finishAchievement(id, 27); PlayerInfo[id][pAdmin] = adminlevel; new gQuery[180]; if(adminlevel >= 1) format(gQuery, sizeof(gQuery), "UPDATE users SET `Admin`='%d', `Security`='%s', `HelpedPlayers`='0' WHERE `ID`='%d'", PlayerInfo[id][pAdmin]/*, MD5_Hash(DEFAULT_PASSWORD)*/, PlayerInfo[id][pSQLID]); else UpdateVar(id, "Admin", PlayerInfo[id][pAdmin]); mysql_tquery(SQL, gQuery, "", ""); SetPVarInt(id, "SecurityPlayer", 0); return true; } Aici ai /sethelper : CMD:sethelper(playerid, params[]) { new id, gString[180], helperlevel; if(PlayerInfo[playerid][pAdmin] < 6) return SCM(playerid, COLOR_WHITE, AdminOnly); if(sscanf(params, "ui", id, helperlevel)) return SCM(playerid, COLOR_GREY, "USAGE: {FFFFFF}/sethelper <playerid/name> <level(0-3)>"); if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY, "Acel player nu este conectat."); if(helperlevel == 0) { Iter_Remove(HelpersDuty, 0); HaveHelp[playerid] = -1; format(gString, sizeof(gString), "Ai fost scos din functia de helper de catre %s", GetName(playerid)); SCM(id, COLOR_LIGHTBLUE, gString); format(gString, sizeof(gString), "System: %s a fost scos din fucntia de helper level %d de catre %s", GetName(id), helperlevel, GetName(playerid)); SendAdminHelperMessage(COLOR_LOGS, gString); PlayerInfo[id][pHW] = 0; UpdateVar(id, "HW", 0); NewbieChat[id] = 0; Iter_Remove(PlayerHelpers, playerid); } Iter_Add(PlayerHelpers, playerid); PlayerInfo[id][pHelper] = helperlevel; format(gString, sizeof(gString), "Ai fost promovat ca helper level %d de %s.", helperlevel, GetName(playerid)); SCM(id, COLOR_LIGHTBLUE, gString); format(gString, sizeof(gString), "System: %s i-a setat lui %s helper level %d", GetName(playerid), GetName(id), helperlevel); SendAdminHelperMessage(COLOR_LOGS, gString); finishAchievement(id, 26); new gQuery[128]; format(gQuery, sizeof(gQuery), "UPDATE users SET `Helper`='%d', `HelpedPlayers`='0' WHERE `ID`='%d'", helperlevel, PlayerInfo[id][pSQLID]); mysql_tquery(SQL, gQuery, "", ""); return true; }
  10. Da-ne linia 558 sau toata comanda
  11. Ai observat bine, am schimbat numele tabelului in urati si tot nu vrea....
  12. Tot nu merge, se opreste la if(cache_get_row_count() == 0) return SCM(playerid, -1, "Nu am gasit nici un urat in baza de date."); CMD:showuratii(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] <= 4) return 1; new query[256]; mysql_format(SQL, query, sizeof(query), "SELECT * FROM `urati` ORDER BY `id` DESC"); mysql_tquery(SQL, query, "", ""); if(cache_get_row_count() == 0) return SCM(playerid, -1, "Nu am gasit nici un urat in baza de date."); new id, NUME[32], IDJOC, string[512]; for(new i = 0; i < cache_num_rows(); i++) { id = cache_get_field_content_int(i, "id"); cache_get_field_content(i, "NUME", NUME, SQL, 128); IDJOC = cache_get_field_content_int(i, "IDJOC"); format(string, sizeof(string), "%d -> %s -> %s\n", id, NUME, IDJOC); printf("%d -> %s -> %s\n", id, NUME, IDJOC); } ShowPlayerDialog(playerid, DIALOG_URATI, DIALOG_STYLE_MSGBOX, "Lista cu urati", string, "Ok", ""); SCM(playerid, -1, string); return 1; }
  13. @@Leonard Nu se intampla nimic.. Dau /uratii si atat, nici un dialog nimic, da am adaugat #define dialog bla bla
  14. imi da o eroare cu getstring nedefinit
  15. Am incercat cu for.. Eu am in acel tabel 7 randuri inserate https://imgur.com/a/AIDSKTj coloana id are INT(2) si e pe AUTO_INCREMENT restul coloanelor (NUME, IDJOC) sunt cu TEXT Aici am comanda cu for dar nu imi da nimic, imi da pur si simplu o singura linie cu 0 cand o testez CMD:showuratii(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] <= 4) return SCM(playerid, -1, ""); new query[128]; format(query, sizeof(query), "SELECT * FROM `urati`"); new Cache: result, id, nick, idjoc, szResult[256]; result = mysql_query(SQL, query); for(new i, j = cache_get_row_count (); i < j; i++) { cache_get_field_content(0, "id", szResult); id = strval(szResult); cache_get_field_content(0, "NUME", szResult); nick = strval(szResult); cache_get_field_content(0, "IDJOC", szResult); idjoc = strval(szResult); } cache_delete(result); new string[128]; format(string, sizeof(string), "%d -> %s -> %s \n.",id, nick, idjoc); SCM(playerid, -1, string); return 1; }
  16. Salut Deci am in DB un tabel numit 'urati' in care am coloanele `id` `NUME` `IDJOC` In acel tabel se stocheaza niste useri Eu vreau sa fac o comanda spre exemplu /showurati in care sa-mi arate prin SCM toti userii stocati in acel tabel Ce am reusit eu pana acum : CMD:uratii(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] <= 4) return SCM(playerid, -1, ""); new query[128]; format(query, sizeof(query), "SELECT * FROM `urati`"); new Cache: result, id, nick, idjoc, szResult[256]; result = mysql_query(SQL, query); cache_get_field_content(0, "id", szResult); id = strval(szResult); cache_get_field_content(0, "NUME", szResult); nick = strval(szResult); cache_get_field_content(0, "IDJOC", szResult); idjoc = strval(szResult); cache_delete(result); new string[128]; format(string, sizeof(string), "%d -> %s -> %s \n.",id, nick, idjoc); SCM(playerid, -1, string); return 1; } Doar ca nu-mi da nimic... iar in tabel am 5 linii puse asa de test
  17. Am rezolvat, multumesc mult lui @@Leonard :)) mereu imi da raspunsul corect la fiecare problema/intrebare Trebuia modificat din YCMD in CMD Trebuia modificat din (playerid, params[], help) in (playerid, params[]) Trebuia modificat publicul OnPlayerCommandReceived Trebuia modificat publicul OnPlayerCommandPerformed
×
×
  • Create New...