Jump to content

Question

Posted

Salut am o problema la comanda /jobs

Quote

CMD:jobs(playerid, params[]) {
    if(InRaceArena[playerid] == 1) return SCM(playerid, COLOR_LGREEN, "Nu ai voie sa folosesti aceasta comanda atata timp cat esti in arena de curse!");
    if(JobWorking[playerid] == 1) return SCM(playerid, COLOR_LGREEN, "Nu poti folosi aceasta comanda acum deoarece muncesti!");
    new szDialog[1024], szDialog2[1024], szTitle[50], xx;
    strcat(szDialog2, "Job name\tOwner\tDistance\n");
    for(new j = 0; j < MAX_JOBS; j++) {
        if(strlen(JobInfo[j][jName]) >= 1 && j != 7) {
            format(szDialog, sizeof(szDialog), "%s\t%s\t{CBFF96}%0.2fm\n", JobInfo[j][jName], JobInfo[j][jOwner], GetPlayerDistanceFromPoint(playerid, JobInfo[j][jPosX],JobInfo[j][jPosY],JobInfo[j][jPosZ]));
            strcat(szDialog2, szDialog);
            xx++;
        }
    }
    format(szTitle, sizeof(szTitle), "Jobs: %d", xx);
    ShowPlayerDialog(playerid, DIALOG_JOBS, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szDialog2, "Ok", "Cancel");
    return 1;
}

si in game arata asa:

image.thumb.png.7570b6a302f16fb8c02ecbe611c37e64.png

18 answers to this question

Recommended Posts

  • 0
Posted
On 4/21/2020 at 10:54 AM, Raul Tiganu said:

Da ne liniile de la "DIALOG_JOBS" pentru ca din comanda nu putem sa ne dam seama.

  

Quote

     case DIALOG_JOBS: {
            if(!response) return 1;
            if(CP[playerid] != 0) return ShowPlayerDialog(playerid, DIALOG_CHECKPOINT, DIALOG_STYLE_MSGBOX, "Checkpoint", "Ai deja un checkpoint activ.\nDoresti sa-l anulezi? Daca da, apasa pe 'Ok'.", "Ok", "Exit");
            new j = listitem + 1;
            if(j >= 7) j++;
            format(string, sizeof(string), "Ti-a fost pus un checkpoint catre job-ul %s. Distanta: %0.2fm", JobInfo[j][jName], GetPlayerDistanceFromPoint(playerid, JobInfo[j][jPosX], JobInfo[j][jPosY], JobInfo[j][jPosZ]));
            SendClientMessage(playerid, COLOR_YELLOW, string);
            SetPlayerCheckpointEx(playerid, JobInfo[j][jPosX], JobInfo[j][jPosY], JobInfo[j][jPosZ], 1);
            CP[playerid] = 53;
        }

 

  • 0
Posted

k1ller, pune #define MAX_JOBS 13

si vezi

CMD:jobs(playerid, params[]) {
    if(InRaceArena[playerid] == 1) return SCM(playerid, COLOR_LGREEN, "Nu ai voie sa folosesti aceasta comanda atata timp cat esti in arena de curse!");
    if(JobWorking[playerid] == 1) return SCM(playerid, COLOR_LGREEN, "Nu poti folosi aceasta comanda acum deoarece muncesti!");
    new szDialog[1024], szDialog2[1024], szTitle[50], xx;
    strcat(szDialog2, "Job name\tDistance\n");
    for(new j = 0; j < MAX_JOBS; j++) {
        if(strlen(JobInfo[j][jName]) >= 1 && j != 7) {
            format(szDialog, sizeof(szDialog), "%s\t{CBFF96}%0.2fm\n", JobInfo[j][jName], GetPlayerDistanceFromPoint(playerid, JobInfo[j][jPosX],JobInfo[j][jPosY],JobInfo[j][jPosZ]));
            strcat(szDialog2, szDialog);
            xx++;
        }
    }
    format(szTitle, sizeof(szTitle), "Jobs: %d", xx);
    ShowPlayerDialog(playerid, DIALOG_JOBS, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szDialog2, "Ok", "Cancel");
    return 1;
}

  • 0
Posted

Am definit max_jobs 13

si acum imi arata asa, presupun ca celelalte de sub 4 apar asa ca nu au un Owner definit, dar prima si a patra apare doar prima litera din nume

image.thumb.png.ae4a78ab5b98c9528e3ab17af4ad351d.png

  • 0
Posted

Update:

Logul meu arata asa acum

[19:50:42] [debug] Run time error 4: "Array index out of bounds"
[19:50:42] [debug]  Accessing element at index 13 past array upper bound 12
[19:50:42] [debug] AMX backtrace:
[19:50:42] [debug] #0 0028ce48 in public LoadJobs () from RYL.amx
[19:50:42] [debug] #1 000b6ef8 in public L_AFK_OnGM () from RYL.amx
[19:50:42] [debug] #2 native CallLocalFunction () from samp03svr
[19:50:42] [debug] #3 00012f4c in public zcmd_OnGameModeInit () from RYL.amx
[19:50:42] [debug] #4 native CallLocalFunction () from samp03svr
[19:50:42] [debug] #5 00012a94 in public SSCANF_OnGameModeInit () from RYL.amx
[19:50:42] [debug] #6 0000cdfc in public Itter_OnGameModeInit () from RYL.amx
[19:50:42] [debug] #7 native CallLocalFunction () from samp03svr
[19:50:42] [debug] #8 0000c0cc in public ScriptInit_OnGameModeInit () from RYL.amx
[19:50:42] [debug] #9 0000b0ac in public PZone_OnGameModeInit () from RYL.amx
[19:50:42] [debug] #10 native CallLocalFunction () from samp03svr
[19:50:42] [debug] #11 00000d10 in public OnGameModeInit () from RYL.amx

  • 0
Posted

Ai 14 job-uri, nu 13, deoarece job-ul 7 (Mecanic probabil) este "dezactivat" dar el inca exista!
MAX_JOBS trebuie sa fie 14.

Discord:
! Akan !#6675

  • 0
Posted
12 minutes ago, Akan said:

Ai 14 job-uri, nu 13, deoarece job-ul 7 (Mecanic probabil) este "dezactivat" dar el inca exista!
MAX_JOBS trebuie sa fie 14.

Verific acum sa vad

  • 0
Posted (edited)

 Deci: la header tu ai 3 variabile, in loop folosesti doua. Fa asa:

for(new j = 0; j < MAX_JOBS; j++) {
        if(strlen(JobInfo[j][jName]) >= 1 && j != 7) {
            format(szDialog, sizeof(szDialog), "%s\t%s\t{CBFF96}%0.2fm\n", JobInfo[j][jName], JobInfo[j][jOwner], GetPlayerDistanceFromPoint(playerid, JobInfo[j][jPosX],JobInfo[j][jPosY],JobInfo[j][jPosZ]));
            strcat(szDialog2, szDialog);
            xx++;
        }
    }

Inlocuieste

strcat(szDialog2, "Job name\tDistance\n");

cu 

strcat(szDialog2, "Job name\tOwner\tDistance\n");

 

Daca nu merge scoate variabila Owner si vezi, ai primit un raspuns in privinta asta mai sus.

Edited by BaFFyJunior
  • 0
Posted
Acum 3 minute, k1ll3rhawk a spus:

Am rezolvat, problema era din definirea variabilei jOwner, eu l-am definit ca jOwner si nu ca jOwner[128];

Nu ai rezolvat nimic asa, acum nu o sa iti mai ia numele din baza de date la owner ! deaorece nu este de tip string!

  • 0
Posted
9 minutes ago, [El.Capo] said:

Nu ai rezolvat nimic asa, acum nu o sa iti mai ia numele din baza de date la owner ! deaorece nu este de tip string!

Am rezolvat, ia numele din baza de date, si acum apare corect peste tot

  • 0
Posted
Acum 1 minut, k1ll3rhawk a spus:

Am rezolvat, ia numele din baza de date, si acum apare corect peste tot

Ciudat... arata si o poza

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.