Jump to content

BuNiCu-RP

Membru
  • Posts

    160
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by BuNiCu-RP

  1. #define SECOUNDS(%0) (1000 * %0) #define MINUTES(%0) (1000 * 60 * %0) // Usage Set Timer SetTimer(funcname[], SECOUNDS(5), true); SetTimer(funcname[], MINUTES(5), true); // Usage Y_Timers timer TimerName[SECOUNDS(5)]() { return true; } ptimer TimerName[SECOUNDS(5)](playerid) { return true; }
  2. @Tud0r. Nu am de unde sa stiu ce sistem de masini foloste. I-am dat un exemplu cum sa isi faca comanda....
  3. E doar un model cum sa iti faci comanda
  4. CMD:vowner(playerid, params[]) { new owner[MAX_PLAYER_NAME+1], query[250]; if(sscanf(params, "u", owner)) return SendClientMessage(playerid, -1, "/vowner <PartOfName/PlayerID>"); if(IsPlayerInVehicle(playerid, GetPlayerVehicleID(playerid))) { mysql_format(cHandle, query, sizeof(query), "UPDATE cars SET Owner = '%s' WHERE id = %d", owner, GetPlayerVehicleID(playerid)); mysql_tquery(cHandle, query, "", ""); } return 1; }
  5. public LoadTurfs() { static rows, fields, index; cache_get_data(rows, fields, g_iHandle); for (new i = 0; i < rows; i ++) { index = cache_get_field_int(i, "ID"); TurfInfo[index][zID] = index; TurfInfo[index][zOwned] = cache_get_field_int(i, "Owned"); TurfInfo[index][zTime] = cache_get_field_int(i, "Time"); TurfInfo[index][zMinX] = cache_get_field_float(i, "MinX"); TurfInfo[index][zMinY] = cache_get_field_float(i, "MinY"); TurfInfo[index][zMaxX] = cache_get_field_float(i, "MaxX"); TurfInfo[index][zMaxY] = cache_get_field_float(i, "MaxY"); } printf("[MySQL Turfs]: %d", rows); return 1; }
  6. Deja nu mai are treaba cu stocul MySQLConnect, problema este din gm, este cu totul alta treaba !
  7. Salut, Incearca asa: https://pastebin.com/5qjqtgih
  8. https://pastebin.com/GZJ3YkSg #include <nume inc> la ongamemodeinit adauga MySQLConnect("localhost", "root", "", "databse");
  9. Ce mysql folosesti, https://pastebin.com/Suwbd6Pz cum il folosesti? ca .inc, filescript?, .pwn?
  10. Vezi asa: https://pastebin.com/Suwbd6Pz
  11. O sa revin cu un edit la topic, multumesc.
  12. #sters Un moderator sa trimita in cos acest topic !
  13. Update topic. Actual version: 1.2
  14. public LoadGraffiti() { new Cache: db = mysql_query(SQL, "SELECT * FROM `graffiti` ORDER BY `graffiti`.`ID` ASC"); new tagname[256]; for(new i, j = cache_get_row_count(); i < j; ++i) { GraffitiInfo[j][gfID] = cache_get_field_content_int(i, "ID",); GraffitiInfo[j][gfX] = cache_get_field_content_float(i, "X"); GraffitiInfo[j][gfY] = cache_get_field_content_float(i, "Y"); GraffitiInfo[j][gfZ] = cache_get_field_content_float(i, "Z"); GraffitiInfo[j][gfRot] = cache_get_field_content_float(i, "Rot"); GraffitiInfo[j][gfOwned] = cache_get_field_content(i, "Owned", 64); GraffitiInfo[j][gfTag] = cache_get_field_content(i, "Tag", 64); GraffitiInfo[j][gfColor] = cache_get_field_content(i, "Color", 32); GraffitiInfo[x][gfObject] = CreateDynamicObject(19373, GraffitiInfo[j][gfX], GraffitiInfo[j][gfY], GraffitiInfo[j][gfZ], 0.0, 0.0, GraffitiInfo[j][gfRot]); if(GraffitiInfo[j][gfOwned] == 0) tagname = "None"; else format(tagname, sizeof(tagname), "{%s}%s", ClanInfo[GraffitiInfo[j][gfOwned]][cClanColor], ClanInfo[GraffitiInfo[j][gfOwned]][cClanTag]); SetDynamicObjectMaterialText(GraffitiInfo[j][gfObject], 0, tagname, OBJECT_MATERIAL_SIZE_256x128, "BankGothic Md BT", 60, 1, 0xfff0f0f0, 0, 1); } printf("[Graffiti Script]: %d graffiti loaded.", cache_get_row_count()); print("Debug:"); printf("ID: %d | Owned: %s | Tag: %s | Color %s", GraffitiInfo[j][gfID], GraffitiInfo[j][gfOwned], GraffitiInfo[j][gfTag], GraffitiInfo[j][gfColor]); cache_delete(db); return 1; }
  15. { if(PlayerInfo[playerid][pPremiumPoints] < 100)return SCM(playerid, -1, "Nu ai suficiente puncte premium."); if(IsABike(OwnedVeh(personalcar[0][playerid])))return SCM(playerid, -1, "Nu poti face o bicicleta vehicul VIP"); if(IsABoat(OwnedVeh(personalcar[0][playerid])))return SCM(playerid, -1, "Nu poti face o barca vehicul VIP"); if(IsAPlane(OwnedVeh(personalcar[0][playerid])))return SCM(playerid, -1, "Nu poti face un avion/elicopter vehicul VIP"); if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 411 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 560 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 541) { SCM(playerid, COLOR_LIGHTBLUE, "Your vehicle was been upgraded to VIP."); CarInfo[OwnedVeh(personalcar[0][playerid])][cVIP] = 1; vUpdate(OwnedVeh(personalcar[0][playerid]), cVIPx); PlayerInfo[playerid][pPremiumPoints] -= 100; Update(playerid, pPremiumPointsx); } }
  16. Pentru ca asa va fii mai greu de implementat in gamemode. Daca ofeream codul 100% functionabil apareau `scripteri` de genul (eu am facut sistemul).
  17. new SecundeJucate[MAX_PLAYERS], SecundeTimer[MAX_PLAYERS]; forward SecundeJucate(playerid); public SecundeJucate(playerid) { SecundeJucate[playerid] ++; return 1; } public OnPlayerConenct(playerid) { SecundeJucate[playerid] = -1; SecundeTimer[playerid] = -1; SecundeTimer[playerid] = SetTimerEx("SecundeJucate", true, 1000, "d", playerid); return 1; } public OnPlayerDisconnect(playerid) { KillTimer(SecundeTimer[playerid]); return 1; } new szString[128], Minute = floatround(SecundeJucate / 60, floatround_round); format(szString, sizeof(szString), "Ai jucat %i minute", Minute); SendClientMessage(playerid, -1, szString);
  18. Da, am gasit alta solutie. T/C
  19. public:: LoadHouses() { new rows; cache_get_row_count(rows); for (new f = 0, h = rows; f <= h ; f++) { cache_get_value_int(f, "houseID", HSVar:h(ID)); cache_get_value_int(f, "houseInteriorID", HSVar:h(InteriorID)); cache_get_value_int(f, "housePrice", HSVar:h(Price)); cache_get_value_int(f, "houseLevel", HSVar:h(Level)); cache_get_value_int(f, "houseForSale", HSVar:h(ForSale)); cache_get_value_int(f, "houseVW", HSVar:h(VW)); cache_get_value_int(f, "houseLocked", HSVar:h(Locked)); cache_get_value_int(f, "houseMoney", HSVar:h(Money)); cache_get_value_int(f, "houseRentable", HSVar:h(Rentable)); cache_get_value_int(f, "houseRentprice", HSVar:h(Rentprice)); cache_get_value_int(f, "houseRenters", HSVar:h(Renters)); cache_get_value_int(f, "housePickup", HSVar:h(Pickup)); cache_get_value_float(f, "houseExteriorPosX", HSVar:h(ExteriorPosX)); cache_get_value_float(f, "houseExteriorPosY", HSVar:h(ExteriorPosY)); cache_get_value_float(f, "houseExteriorPosZ", HSVar:h(ExteriorPosZ)); cache_get_value_float(f, "houseInteriorPosX", HSVar:h(InteriorPosX)); cache_get_value_float(f, "houseInteriorPosY", HSVar:h(InteriorPosY)); cache_get_value_float(f, "houseInteriorPosZ", HSVar:h(InteriorPosZ)); cache_get_value(f, "houseOwner", HSVar:h(Owner), 32); cache_get_value(f, "houseName", HSVar:h(Name), 64); cache_get_value(f, "houseTextLabel", HSVar:h(TextLabel), 256); HSVar:h(Cache) = cache_save(); HousesPickup[f] = CreateDynamicPickup(HSVar:h(Pickup), 2, HSVar:h(ExteriorPosX), HSVar:h(ExteriorPosY), HSVar:h(ExteriorPosZ), -1, -1, -1, 25.0, -1, 0); format(HSVar:h(TextLabel), 256, "Name: %s\nOwner: %s\nLevel: %d\nRent: $%s", HSVar:h(Name), HSVar:h(Owner), HSVar:h(Level), FormatNumber(HSVar:h(Rentprice))); HSVar:f(Text) = Create3DTextLabel(HSVar:h(TextLabel), 0x64d6fcFF, HSVar:h(ExteriorPosX), HSVar:h(ExteriorPosY), HSVar:h(ExteriorPosZ), 25.0, 0, 0); if(HSVar:h(Locked) == 1) { format(HSVar:h(TextLabel), 256, "%s\nOwner: %s\nLevel: %d\n(Locked)", HSVar:h(Name), HSVar:h(Owner), HSVar:h(Level)); Update3DTextLabelText(HSVar:f(Text), 0x64d6fcFF, HSVar:h(TextLabel)); } else if(HSVar:h(ForSale) == 1) { format(HSVar:h(TextLabel), 256, "%s\nOwner: %s\nLevel: %d\nFor sale ($%s)", HSVar:h(Name), HSVar:h(Owner), HSVar:h(Level), FormatNumber(HSVar:h(Price))); Update3DTextLabelText(HSVar:f(Text), 0x64d6fcFF, HSVar:h(TextLabel)); } } /* // Server Array SAVar[f][hExit][0] = HSVar:h(ExteriorPosX); SAVar[f][hExit][1] = HSVar:h(ExteriorPosY); SAVar[f][hExit][2] = HSVar:h(ExteriorPosZ); SAVar[f][hEnter][0] = HSVar:h(InteriorPosX); SAVar[f][hEnter][1] = HSVar:h(InteriorPosY); SAVar[f][hEnter][2] = HSVar:h(InteriorPosZ); SAVar[f][hVW] = HSVar:h(VW); SAVar[f][hInt] = HSVar:h(InteriorID); SAVar[f][hxID] = HSVar:h(ID); */ TotalHouses = rows; printf("* Loaded %d house", rows); return 1; } Publicul loadHouses. Comanda enter: CMD:enter(playerid, params[]) { if(PVar:playerid[IsLoggedIn] != true) return CmdErrorMessage(playerid, "Trebuie sa fii conectat pentru a folosi comenzii"); for(new i = 0; i < MAX_HOUSES; i++) { if(HSVar:i(Locked) == 1) { GameTextForPlayer(playerid, "~r~House door loked !", 1000, 1); } if(HSVar:i(Locked) == 0) { if(IsPlayerInRangeOfPoint(playerid, 5.0, HSVar:i(ExteriorPosX), HSVar:i(ExteriorPosY), HSVar:i(ExteriorPosZ))) { SetPlayerInterior(playerid, HSVar:i(InteriorID)); SetPlayerPos(playerid, HSVar:i(InteriorPosX), HSVar:i(InteriorPosY), HSVar:i(InteriorPosZ)); GameTextForPlayer(playerid, "Welcome to home !", 1000, 4); // SetPlayerVirtualWorld(playerid, SAVar[i][hVW]); } } } return 1; } Problema este ca nu imi incarca/salveaza float...
  20. forward LoadPersonalVehicle(); public LoadPersonalVehicle() { new Cache: result = mysql_query(SQL, "SELECT * FROM cars"); new i, id, rows = cache_num_rows(); if(rows > 0) { for(i = 0; i < rows; i++) { id = cache_get_field_content_int(i, "ID"); CarInfo[i][cLocationx] = cache_get_field_content_float(id, "Locationx"); } printf("Numar masini personale: %d | Ultima incarcata ID %d", rows, id); } cache_delete(result); return 1; } Incearca asa, sper sa te ajute !
  21. Salutare, Am sa va prezint un mic sistem basic de licitatii, este facut doar basic, nu are foarte multe functii. Am decis sa ii fac un mic update, am mai optimizat putin codul. Acum licitatiile sunt afiate doar Vineri, Samabata, Duminica, cand tastam /startbids Business Name Price ne da eroare daca nu [Vineri, Samabata, Duminica,]. Rezolvat bugul din prima versiune, unde nu stoca corect numele celui care liciteaza. Bugs: Nu am gasit. Download: https://github.com/SSYT/SA-MP Photos:
  22. public LoadCar() { new i = 0, z = cache_get_row_count(), zx; for(i; i < z; i++) { if(z > 0) { zx = cache_get_field_content_int(i, "ID"); if(zx != 0) { CarInfo[i][cModel] = cache_get_field_content_int(z, "Model"); CarInfo[i][cLocationx] = cache_get_field_content_float(z, "Locationx"); CarInfo[i][cLocationy] = cache_get_field_content_float(z, "Locationy"); CarInfo[i][cLocationz] = cache_get_field_content_float(z, "Locationz"); CarInfo[i][cAngle] = cache_get_field_content_float(z, "Angle"); CarInfo[i][cColorOne] = cache_get_field_content_int(z, "ColorOne"); CarInfo[i][cColorTwo] = cache_get_field_content_int(z, "ColorTwo"); cache_get_field_content(z, "Owner", CarInfo[i][cOwner], SQL, 130); CarInfo[i][cValue] = cache_get_field_content_int(z, "Value"); cache_get_field_content(z, "License", CarInfo[i][cLicense], SQL, 130); cache_get_field_content(z, "Description", CarInfo[i][cDescription], SQL, 130); CarInfo[i][cLock] = cache_get_field_content_int(z, "Lockk"); CarInfo[i][cNewEngine] = cache_get_field_content_int(z, "NewEngine"); CarInfo[i][cTimed] = cache_get_field_content_int(z, "Timed"); CarInfo[i][cInscarprice] = cache_get_field_content_int(z, "Inscarprice"); CarInfo[i][cInsurancecar] = cache_get_field_content_int(z, "Insurancecar"); CarInfo[i][cKM] = cache_get_field_content_float(z, "KM"); CarInfo[i][cHP] = cache_get_field_content_float(z, "HP"); CarInfo[i][cDamage1] = cache_get_field_content_int(z, "Damage1"); CarInfo[i][cDamage2] = cache_get_field_content_int(z, "Damage2"); CarInfo[i][cDamage3] = cache_get_field_content_int(z, "Damage3"); CarInfo[i][cDamage4] = cache_get_field_content_int(z, "Damage4"); CarInfo[i][cGas] = cache_get_field_content_int(z, "Gas"); CarInfo[i][cOwned] = cache_get_field_content_int(z, "Owned"); CarInfo[i][cSell] = cache_get_field_content_int(z, "Sell"); CarInfo[i][mod1] = cache_get_field_content_int(z, "mod1"); CarInfo[i][mod2] = cache_get_field_content_int(z, "mod2"); CarInfo[i][mod3] = cache_get_field_content_int(z, "mod3"); CarInfo[i][mod4] = cache_get_field_content_int(z, "mod4"); CarInfo[i][mod5] = cache_get_field_content_int(z, "mod5"); CarInfo[i][mod6] = cache_get_field_content_int(z, "mod6"); CarInfo[i][mod7] = cache_get_field_content_int(z, "mod7"); CarInfo[i][mod8] = cache_get_field_content_int(z, "mod8"); CarInfo[i][mod9] = cache_get_field_content_int(z, "mod9"); CarInfo[i][mod10] = cache_get_field_content_int(z, "mod10"); CarInfo[i][mod11] = cache_get_field_content_int(z, "mod11"); CarInfo[i][mod12] = cache_get_field_content_int(z, "mod12"); CarInfo[i][mod13] = cache_get_field_content_int(z, "mod13"); CarInfo[i][mod14] = cache_get_field_content_int(z, "mod14"); CarInfo[i][mod15] = cache_get_field_content_int(z, "mod15"); CarInfo[i][mod16] = cache_get_field_content_int(z, "mod16"); CarInfo[i][mod17] = cache_get_field_content_int(z, "mod17"); CarInfo[i][cDays] = cache_get_field_content_int(z, "days"); CarInfo[i][cPaintJ] = cache_get_field_content_int(z, "PaintJ"); CarInfo[i][vArma1] = cache_get_field_content_int(z, "Arma1"); CarInfo[i][vArma2] = cache_get_field_content_int(z, "Arma2"); CarInfo[i][vArma3] = cache_get_field_content_int(z, "Arma3"); CarInfo[i][vGArma1] = cache_get_field_content_int(z, "GArma1"); CarInfo[i][vGArma2] = cache_get_field_content_int(z, "GArma2"); CarInfo[i][vGArma3] = cache_get_field_content_int(z, "GArma3"); CarInfo[i][vDroguri] = cache_get_field_content_int(z, "Droguri"); CarInfo[i][vBani] = cache_get_field_content_int(z, "Bani"); masini = i; } } } printf("Ultimul ID incarcat din tabelul `cars`: %d", masini); } Si la OnGameModeInit trebuie sa ai ceva de genu: mysql_format(SQL, query, sizeof(query), "SELECT * FROM `cars` LIMIT 0, 100"); mysql_tquery(SQL, query, "LoadCar", "");
  23. Cu acest cod javascript verifica dacă poate selecta butonul 'add as friends' nu are cum a preia alte informaţii ale contului.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.