Jump to content
  • 0

problema /jobs


k1ll3rhawk

Question

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

Link to comment
Share on other sites

18 answers to this question

Recommended Posts

  • 0
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;
        }

 

Link to comment
Share on other sites

  • 0

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;
}

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

 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
Link to comment
Share on other sites

  • 0
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!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.