Jump to content

BaFFyJunior

Membru
  • Content Count

    100
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by BaFFyJunior

  1. La onplayertext pui conditie ca la mesajul trimis daca playerul are admin > 0 sa ii scrie textul cu culoare. De exemplu: {008000}%s.
  2. Te poti folosi de functia CreateVehicle. Uite cum: Faci o comanda. Spre exemplu: CMD:spawneazamasina(playerid, params[]) { if(VehiculSpawnat[playerid] == 1) return SCM(playerid, -1, "Ai spawnat deja un vehicul."); strcat( gQuery, "Infernus\n" ); strcat( gQuery, "Cheetah\n" ); strcat( gQuery, "Roadtrain\r" ); ShowPlayerDialog( playerid, Dialog_Vehicule, DIALOG_STYLE_LIST, "Vehicles", gQuery, "Alege", "Inchide" ); return 1; } Apoi dialogul care e apelat de comanda. case Dialog_Vehicule: { switch(listitem) { case 0: VehiculSpawnat[playerid] = CreateVehicle(...), PutPlayerInVehicle(playerid, VehiculSpawnat[playerid], 0); case 1: VehiculSpawnat[playerid] = CreateVehicle(...), PutPlayerInVehicle(playerid, VehiculSpawnat[playerid], 0); case 2: VehiculSpawnat[playerid] = CreateVehicle(...), PutPlayerInVehicle(playerid, VehiculSpawnat[playerid], 0); } return 1; } La onplayerconnect recomand sa setezi variabila VehiculSpawnat[playerid] = 0. O definesti la inceputul gmului asa: new VehiculSpawnat[MAX_PLAYERS]; Sper ca te-am ajutat!
  3. Pai. Tu creezi vehiculul cu o functie. De exemplu: MasinaJob[playerid] = CreateVehicle(....); SetVehicleHealth(MasinaJob[playerid], 380.0); PutPlayerInVehicle(playerid, MasinaJob[playerid], 0); Cam asa ar trebui sa arate functia ta.
  4. mysql_pquery( DB_Connect, eQuery, "LoadRaceDetails", "is", playerid, rName); Asta ar fi un exemplu, poti face la toate la fel. Sper ca te-am ajutat.
  5. Pluginul streamer se incarca? Billboardurile sunt incluse in mysql? Sau nu stiu, da-ne mai multe detalii daca poti sau o copie a fisierului server_log.
  6. YCMD:id(playerid, params[], help) { new names[64], giveplayer[25], x, sstring[180]; if(sscanf(params, "s[64]", names)) return SCM(playerid, COLOR_GREY, "USAGE: {FFFFFF}/id <playerid/name>"); if(strlen(names) > 24) return SCM(playerid, COLOR_GREY, "Player not connected."); if(IsNumeric(names)) { if(strval(names) >= 1000) return SCM(playerid, COLOR_GREY, "Player not connected."); } if(IsNumeric(names)) { if(x < 10) { if(strval(names) < 0 || strval(names) > 999) return SCM(playerid, COLOR_GREY, "Player not connected."); new i = strval(names); if(IsPlayerLogged[i] == 0) return SCM(playerid, COLOR_GREY, "Player not connected."); GetPlayerName(i, giveplayer, sizeof(giveplayer)); new szRankk[180]; if(PlayerInfo[i][pMember] != 0) format(szRankk, sizeof(szRankk), " (rank %d)", PlayerInfo[i][pRank]); new factioncolor[128]; switch(PlayerInfo[i][pMember]) { case 0: factioncolor = {FFFFFF}; case 1: factioncolor = {00FF00}; } if(GetPVarInt(i, "Cover") == 1) { format(sstring, sizeof(sstring), "(ID %d) Nume: %s | Level: %d | Factiune: Civil | FPS: %d",i,giveplayer,GetPlayerScore(i), FPS2[i]); SCM(playerid, COLOR_WHITE, sstring); return 1; } new name[180]; format(name, sizeof(name), "%s", GetName(i)); new clan = PlayerInfo[i][pClan]; if(PlayerInfo[i][pSleeping] == 1 || AFKSeconds[i] >= 5) { if(clan != 0 && PlayerInfo[i][pTag] == 0) format(name, sizeof(name), "{%s}%s{AFAFAF}%s", ClanInfo[clan][clColor], ClanInfo[clan][clTag], GetName(i)); else if(clan != 0 && PlayerInfo[i][pTag] == 1) format(name, sizeof(name), "%s{%s}%s{AFAFAF}", GetName(i), ClanInfo[clan][clColor], ClanInfo[clan][clTag]); } else { if(clan != 0 && PlayerInfo[i][pTag] == 0) format(name, sizeof(name), "{%s}%s{FFFFFF}%s", ClanInfo[clan][clColor], ClanInfo[clan][clTag], GetName(i)); else if(clan != 0 && PlayerInfo[i][pTag] == 1) format(name, sizeof(name), "%s{%s}%s{FFFFFF}", GetName(i), ClanInfo[clan][clColor], ClanInfo[clan][clTag]); } format(sstring, sizeof(sstring), "(ID %d) %s | Level: %d | Factiune: %s%s | FPS: %d",i,name,PlayerInfo[i][pLevel],FactionName(PlayerInfo[i][pMember]),szRankk, FPS2[i]); SCM(playerid, COLOR_WHITE, sstring); x++; return 1; } } foreach(Player, i) { if(IsPlayerConnected(i) && IsPlayerLogged[i] == 1) { if(strfind(GetNameEx(i), names, true) != -1) { if(x < 10) { if(i == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY, "Player not connected."); GetPlayerName(i, giveplayer, sizeof(giveplayer)); new szRankk[180]; if(PlayerInfo[i][pMember] != 0) format(szRankk, sizeof(szRankk), " (Rank %d)", PlayerInfo[i][pRank]); new factioncolor[128]; switch(PlayerInfo[i][pMember]) { case 0: factioncolor = {FFFFFF}; case 1: factioncolor = {00FF00}; } if(GetPVarInt(i, "Cover") == 1) { format(sstring, sizeof(sstring), "(ID %d) Nume: %s | Level: %d | Factiune: Civil | FPS: %d",i,giveplayer,GetPlayerScore(i), FPS2[i]); SCM(playerid, COLOR_WHITE, sstring); return 1; } new name[180]; format(name, sizeof(name), "%s", GetName(i)); new clan = PlayerInfo[i][pClan]; if(PlayerInfo[i][pSleeping] == 1 || AFKSeconds[i] >= 5) { if(clan != 0 && PlayerInfo[i][pTag] == 0) format(name, sizeof(name), "{%s}%s{AFAFAF}%s", ClanInfo[clan][clColor], ClanInfo[clan][clTag], GetName(i)); else if(clan != 0 && PlayerInfo[i][pTag] == 1) format(name, sizeof(name), "%s{%s}%s{AFAFAF}", GetName(i), ClanInfo[clan][clColor], ClanInfo[clan][clTag]); } else { if(clan != 0 && PlayerInfo[i][pTag] == 0) format(name, sizeof(name), "{%s}%s{FFFFFF}%s", ClanInfo[clan][clColor], ClanInfo[clan][clTag], GetName(i)); else if(clan != 0 && PlayerInfo[i][pTag] == 1) format(name, sizeof(name), "%s{%s}%s{FFFFFF}", GetName(i), ClanInfo[clan][clColor], ClanInfo[clan][clTag]); } format(sstring, sizeof(sstring), "(ID %d) %s | Level: %d | Factiune: %s %s | FPS: %d",i,name,PlayerInfo[i][pLevel],FactionName(PlayerInfo[i][pMember]),szRankk, FPS2[i]); SCM(playerid, COLOR_WHITE, sstring); x++; } } } } if(x == 0) return SCM(playerid, COLOR_GREY, "Player not connected."); if(x == 10) SCM(playerid, COLOR_WHITE, "Au fost afisate doar primele 10 rezultate."); return 1; } Poti folosi sfatul lui El.Capo, aici ai comanda si un exemplu teoretic.
  7. CMD:fish(playerid, params[]) { if(PlayerInfo[playerid][pJob] != 11) return SCM(playerid, COLOR_GREY, "Nu esti pescar!"); if(!PlayerToPoint(125.0, playerid, 2294.1890, 533.5755, 1.8655)) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu esti intr-o locatie buna!"); if(IsPlayerInAnyVehicle(playerid)) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu poti aceasta comanda dintr-un vehicul!"); if(HaveFish[playerid] != 0) return SCM(playerid, -1, "Ai prins deja un peste! Du-te si vinde-l la unul dintre magazinele 24/7."); if(StartFish[playerid] == 1) return 1; if(Undita[playerid] == 0) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu ai o undita!"); if(Momeala[playerid] == 0) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu ai momeala!"); if(PlayerInfo[playerid][pBackpack] == 1) { if(PlayerInfo[playerid][pBackpackJobs] > 2) return SCM(playerid, COLOR_LGREEN, "Nu poti face mai mult de 2 misiuni cu ghiozdanul activ!") GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~w~YOU'RE FISHING NOW...",15000,3); SetTimerEx("Fish", 15000, 0, "d", playerid); TogglePlayerControllable(playerid, 0); ApplyAnimation(playerid, "SAMP", "FishingIdle", 3.0,1,1,0,0,0); SetPlayerAttachedObject(playerid, 0, 18632,6,0.079376,0.037070,0.007706,181.482910,0.000000,0.000000,1.000000,1.000000,1.000000); StartFish[playerid] = 1; Freezed[playerid] = 1; Momeala[playerid] --; } else { GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~w~YOU'RE FISHING NOW...",15000,3); SetTimerEx("Fish", 15000, 0, "d", playerid); TogglePlayerControllable(playerid, 0); ApplyAnimation(playerid, "SAMP", "FishingIdle", 3.0,1,1,0,0,0); SetPlayerAttachedObject(playerid, 0, 18632,6,0.079376,0.037070,0.007706,181.482910,0.000000,0.000000,1.000000,1.000000,1.000000); StartFish[playerid] = 1; Freezed[playerid] = 1; Momeala[playerid] --; } return 1; } function Fish(playerid) { new x, string[180]; if(!IsPlayerConnected(playerid)) return 1; if(PlayerInfo[playerid][pJob] == 11) { StartFish[playerid] = 0; TogglePlayerControllable(playerid, 1); Freezed[playerid] = 0; RemovePlayerAttachedObject(playerid, 0); if(IsPlayerInAnyVehicle(playerid)) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu poti pescui dintr-un vehicul!"); x = 7 + random(13); new rar = random(500); new need = 15*GetPlayerSkill(playerid); if(rar >= 495) HaveFish[playerid] = 0; else HaveFish[playerid] += x; if(rar >= 495) { format(string, sizeof(string), "* %s a prins un rechin.", GetName(playerid), FormatNumber(x)); NearMessage(playerid, COLOR_PURPLE, string); SetPlayerHealth(playerid, 0); x = 0; } else { if(HaveFish[playerid] < need) { format(string, sizeof(string), "Pentru a putea vinde pestii, iti mai trebuie %d kg.", need-HaveFish[playerid]); SCM(playerid, -1, string); } format(string, sizeof(string), "* %s a prins un peste de %d kg.", GetName(playerid), x); NearMessage(playerid, COLOR_PURPLE, string); } if(PlayerInfo[playerid][pMember] == 0) { for(new m; m < 2; m++) { if(PlayerInfo[playerid][pDailyMission][m] == 15 || PlayerInfo[playerid][pDailyMission][m] == 16) CheckMission(playerid, m); } } for(new m; m < 2; m++) { if(PlayerInfo[playerid][pDailyMission][m] == 2) CheckMission(playerid, m); } if(PlayerInfo[playerid][pBackpack] == 1) PlayerInfo[playerid][pBackpackJobs] ++; } return 1; } Trebuie sa definesti variabila pbackpackjobs. Du-te la enum playerinfo si adauga pBackpackJobs. 1. Variabila va trebui resetata dupa cum am spus. Ori pui intr-un timer ca la ora x sa se reseteze la toti playeri variabila(din mysql). Aceasta varianta iti permite ca jucatorul acela sa poata face 2 misiuni cu ghiozdan activ/zi. 2. Variabila va trebui resetata la onplayerconnect. Aceasta varianta iti permite ca jucatorul acela sa poata face 2 misiuni cu ghiozdan activ dupa fiecare conectare pe server.
  8. In general pui o restrictie la /work respectiv la /fish. If(PlayerInfo[playerid][pBackpack] != 0) { if(PlayerInfo[playerid][JobsFacuteAzi] > 2) return SCM(playerid, COLOR_ERROR, "Nu poti face mai mult de 2 misiuni daca ai ghiozdanul pus!"); //comanda ta aici } else { //comanda ta aici } PlayerInfo[playerid][JobsFacuteAzi] variabila asta verifica cate jobs ai facut cu backpack on. O pui fie sa se reseteze la onplayerconnect, fie o salvezi si in baza de date si o resetezi la o ora anume/player login. Nu cred ca exista o asemenea variabila pe burned, deci va trebui sa faci una noua. PlayerInfo[playerid][JobsFacuteAzi] ++; //asta pui la farmer/fish la finalul jobului.
  9. Fa un fisier pawn.cfg care contine -d3 si pune-l in folderul pawno, apoi compileaza. Te va ajuta sa vezi linia erorii in gamemode.
  10. La onplayerlogin. E cel mai eficient.
  11. Posteaza comanda car color aici.
  12. Pune restrictie ca parametrul sscanf sa nu fie mai mic de 0 sau mai mare de 255( if( color < 0 || color > 255) return 1;).
  13. Simbolul rainbowCAR nu este folosit, sterge definirea acestuia din gamemode.
  14. #include <a_samp> #include <a_mysql> new SQL=-1, gQuery[256], gString[4500]; #define function%0(%1) forward %0(%1); public %0(%1) #define SCM SendClientMessage #define COLOR_DARKRED 0xd80003FF enum pInfo{ pSQLID, pName[MAX_PLAYER_NAME], pPassword[32], pEmail[32], pGender } new PlayerInfo[MAX_PLAYERS][pInfo]; new IncercariParola[MAX_PLAYERS]; enum { //REGISTER DIALOG_REGISTER, DIALOG_EMAIL, DIALOG_GENDER, //LOGIN DIALOG_LOGIN } main() { print("\n----------------------------------"); print(Gamemode loaded succesfully.); print("----------------------------------\n"); //de aici poti sterge tot, poti lasa doar acoladele {} ca sa nu iti dea eroare. } public OnGameModeInit() { new liTick = GetTickCount(); SQL = mysql_connect("localhost", "root", "luna_db",""); SetGameModeText("Blank Script"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); printf("[ CALLBACK: OnGameModeInit ] Executat in %dms.", GetTickCount( ) - liTick); return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746); return 1; } public OnPlayerConnect(playerid) { IncercariParola[playerid]=0; gQuery[0]=EOS; mysql_format(SQL, gQuery, sizeof(gQuery), "SELECT * FROM `users` WHERE `name` = '%s' LIMIT 1", GetName(playerid)); mysql_tquery(SQL, gQuery, "CheckAccount", "i", playerid); return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){ switch(dialogid) { case DIALOG_REGISTER: { if(!response) return Kick(playerid); if(strlen(inputtext)<6 || strlen(inputtext)>32) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Scrie o parola pentru a te putea inregistra(6-32 caractere):", "Select", "Cancel"); gQuery[0]=EOS; mysql_format(SQL, gQuery, sizeof(gQuery), "INSERT INTO `users`(`Name`, `Password`) VALUES ('%s', '%s')", GetName(playerid), inputtext); mysql_tquery(SQL, gQuery, "insertAccount", "i", playerid); gString[0]=EOS; format(gString, sizeof(gString), "Parola ta contine %d caractere.", strlen(inputtext)); SCM(playerid, -1, gString); format(PlayerInfo[playerid][pPassword], 32, inputtext); ShowPlayerDialog(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "Email", "Adauga-ti adresa de email:", "Select", "Cancel"); } case DIALOG_EMAIL: { if(!response) return Kick(playerid); if(strlen(inputtext)<6 || strlen(inputtext)>32) return ShowPlayerDialog(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "Email", "Adauga-ti adresa de email:", "Select", "Cancel"); gQuery[0]=EOS; mysql_format(SQL, gQuery, sizeof(gQuery), "UPDATE `users` SET `Email`='%s' WHERE `ID`='%d' ",inputtext, PlayerInfo[playerid][pSQLID]); mysql_tquery(SQL, gQuery, "", ""); gString[0]=EOS; format(gString, sizeof(gString), "Email setat: %s.",inputtext); SCM(playerid, -1, gString); format(PlayerInfo[playerid][pEmail], 32, inputtext); ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_MSGBOX, "Gender", "Seteaza sexul caracterului tau:", "Masculin", "Feminin"); } case DIALOG_GENDER: { switch(response) { case 0:{ PlayerInfo[playerid][pGender]= 1; SendClientMessage(playerid,-1, "Sexul tau a fost setat: Feminin."); } case 1:{ PlayerInfo[playerid][pGender]= 0; SendClientMessage(playerid,-1, "Sexul tau a fost setat: Masculin."); } } gQuery[0]=EOS; mysql_format(SQL, gQuery, sizeof(gQuery), "UPDATE `users` SET `Gender`='%d' WHERE `ID`='%d' ",PlayerInfo[playerid][pGender], PlayerInfo[playerid][pSQLID]); mysql_tquery(SQL, gQuery, "", ""); SpawnPlayer(playerid); } case DIALOG_LOGIN: { if(!response) return Kick(playerid); mysql_format(SQL, gQuery, sizeof(gQuery), "SELECT * FROM `users` WHERE `name` = '%s' AND `Password`='%s' LIMIT 1", GetName(playerid), inputtext); mysql_tquery(SQL, gQuery, "onLogin", "i", playerid); } } return 1; } function onLogin(playerid){ switch(cache_num_rows()) { case 0: { IncercariParola[playerid] ++; gString[0] = EOS; format(gString, sizeof(gString), "Parola incorecta! Mai ai %d incercari ramase!", IncercariParola[playerid]); SCM(playerid, COLOR_DARKRED, gString); if(IncercariParola[playerid] == 3) Kick(playerid); else ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Scrie parola pentru a te putea connecta pe server:", "Select", "Cancel"); } case 1: { new result[64]; PlayerInfo[playerid][pSQLID] = cache_get_field_content_int(0, "ID", SQL); PlayerInfo[playerid][pGender] = cache_get_field_content_int(0, "Gender", SQL); cache_get_field_content_int(0, "Name", result); format(PlayerInfo[playerid][pName], MAX_PLAYER_NAME, result); cache_get_field_content_int(0, "Password", result); format(PlayerInfo[playerid][pPassword], 32, result); cache_get_field_content_int(0, "Email", result); format(PlayerInfo[playerid][pEmail], 32, result); printf("%s(user: %d) s-a logat. [Gender: %d, Name: %s, Password: %s, Email: %S]", GetName(playerid), PlayerInfo[playerid][pSQLID], PlayerInfo[playerid][pGender], PlayerInfo[playerid][pPassword], PlayerInfo[playerid][pEmail]); } } return 1; } function insertAccount(playerid){ PlayerInfo[playerid][pSQLID]= cache_insert_id(); printf("%s s-a inregistrat cu SQLID-ul #%d.", GetName(playerid), PlayerInfo[playerid][pSQLID]); return 1; } function CheckAccount(playerid){ switch(cache_num_rows()){ case 0: ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Scrie o parola pentru a te putea inregistra(6-32 caractere):", "Select", "Cancel"); case 1: ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Scrie parola pentru a te putea connecta pe server:", "Select", "Cancel"); } } stock GetName(playerid){ new playerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, playerName, MAX_PLAYER_NAME); return playerName; } Sper ca te-am ajutat.
  15. Cauta in gamemodeul tau [bank] sau CreatePickup(1274 sau CreateDynamicPickup(1274. Sper sa gasesti.
  16. !PaintType[ playerid ]  probabil asta sa fie problema. Nu stiu sigur deoarece nu cunosc gamemodeul. Sterge ! din fata painttype sau sterge painttype de tot si vezi daca se rezolva problema.
  17. If(strcmp(HouseInfo[houseid][hOwner], "The State")) ... codul pentru casa care e detinuta de cineva.
  18. Sigur e vreo comanda ascunsa sau vreo problema la mysql, dupa cum a spus Ksenon. Pune asta la /setadmin si la functia /set: if(PlayerInfo[id][pAdmin] >= 6) return SCM(playerid, COLOR_GREY, "Aceasta comanda nu poate fi executata cu succes!");
  19. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { new vsid = sVehicle[5][playerid]; if(CarInfo[vsid][cRainbowC] == 1) { if(rainbowcar[playerid] == 0) { rainbowcar[playerid] = 1; CTimer1 = SetTimerEx("Color1", 500, 0, "d" ,playerid); } return 1; } if(CarInfo[vsid][cRainbowC] == 0) { if(rainbowcar[playerid] == 1) { rainbowcar[playerid] = 0; KillTimer(CTimer1); } return 1; } if(CarInfo[vsid][cRainbowC] == 0) { if(rainbowcar[playerid] == 0) { rainbowcar[playerid] = 0; KillTimer(CTimer1); } return 1; } } Nu stiu exact cum e pe b-hood, dar banuiesc ca ai facut verificarea gresit :-? Cred ca trebuia pus if(CarInfo[vsid][cRainbowC] == 1) inainte de rainbowcar[playerid]. Pentru ca intai sa verifice daca acel vehicul are rainbow si dupa variabila rainbowcar. Doar o ipoteza. Daca nu functioneaza cineva mai experimentat ar trebui sa te ajute.
  20. Eu folosesc r39-6 de la BlueG pe serverul meu(trucking, facut relativ de la 0, deschis din 2012) si e ok. Daca ai si un host bun cu atat mai bine. Pentru host recomand ultra-h(host cumparat, nu free).
  21. Fisierul autoafk nu se afla in folderul pawno-includes. Descarca-l de pe google si pune-l acolo. Eroarea spune ca gamemodeul tau nu poate accesa fisierul autoafk.
  22. case pCashx: format(var, sizeof(var), "UPDATE `users` SET `Money`='%d' WHERE `ID`='%d'",GetPlayerCash(playerid), PlayerInfo[playerid][pSQLID]);
  23. La enum playerinfo pune pJob. Daca il ai verifica daca l-ai scris bine.
×
×
  • Create New...

Important Information

This site uses cookies. By continuing browsing, you agree to the use of this information. For more details, see Terms of Use and Privacy Policy.