Jump to content
  • 0

Problema /v


Cordyandrey

Question

13 answers to this question

Recommended Posts

  • 0

arata comanda sa vedem ce ar putea avea

Citat
Link to comment
Share on other sites

  • 0

Dintr-un motiv sau altul modelul masini (gen 411) e incarcat gresit sau supra scris. Pentru ca scriptul in momentul in care vrea sa iti afiseze modelul masini (infernus) scade 400 din modelul masini pentru a lua indexu de la array care contine numele masinilor.

Si faptul ca zice -400 in eroare inseamna ca modelul masini e 0 in loc ds cat trebuie sa fie.

Ce iti sugerez sa faci e sa faci un fisier pawn.cfg in folderul pawno sa scrii in el -d3, sa folosesti pawno sa ii dai compile si sa reproduci bugu. In momentul in care iti va da crash iar iti va oferi si linia unde e eroarea

Link to comment
Share on other sites

  • 0

Nu. In cazul in care serverul da crash(si ai crashdetect) erorile din serverlog au si numarul liniei unde se petrece.

Nu exista nimic care sa iti arate buguri din gm. Doar gasesti bugu si citesti codul pana gasesti problema (daca exista debugger pentru samp/pawn atunci era mai usor sa indentifici probleme)

  • Upvote 1
Link to comment
Share on other sites

  • 0

@Banditul apare problema doar ca n-am habar s-o rezolv  

eroare /v
[15:19:41] [debug] Run time error 4: "Array index out of bounds"
[15:19:41] [debug]  Accessing element at negative index -400
[15:19:41] [debug] AMX backtrace:
[15:19:41] [debug] #0 0019bbfc in ShowPlayerVehicle (playerid=1) at D:\JOCURI\SERVER\Cypher-QLT\Cypher-QLT\gamemodes\gmm.pwn:12393
[15:19:41] [debug] #1 00193710 in public @_yCv (playerid=1, params[][email protected] "", help=0) at D:\JOCURI\SERVER\Cypher-QLT\Cypher-QLT\gamemodes\gmm.pwn:12047
[15:19:41] [debug] #2 001936ac in public @yC_v (... <4 arguments>)  at D:\JOCURI\SERVER\Cypher-QLT\Cypher-QLT\gamemodes\gmm.pwn:12047
[15:19:41] [debug] #3 native CallRemoteFunction () from sampsvr-port_543
[15:19:41] [debug] #4 00040f1c in Command_Process (playerid=1, cmdtext[][email protected] "/v", help=0) at D:\JOCURI\SERVER\Cypher-QLT\Cypher-QLT\pawno\include\YSI\y_commands.inc:2503
[15:19:41] [debug] #5 0004055c in ?? (... <2 arguments>) at D:\JOCURI\SERVER\Cypher-QLT\Cypher-QLT\pawno\include\YSI\y_commands.inc:2297
[15:19:41] [debug] #6 000300b4 in public OnPlayerCommandText (playerid=1, cmdtext[][email protected] "/v") at D:\JOCURI\SERVER\Cypher-QLT\Cypher-QLT\pawno\include\YSI\y_hooks/impl.inc:929

Link to comment
Share on other sites

  • 0
 

	function CancelTestDrive(playerid) {
    if(TestingModel[playerid] == 0) return 1;  
    SCM(playerid, COLOR_YELLOW, "Timpul disponibil pentru test-drive a expirat.");
    PutPlayerInVehicleEx(playerid, DealerCar[playerid], 0);
    if(DealerCarType[playerid] == 1) {
        SetPlayerInterior(playerid, 0);     
        DealerCarAngle[playerid] = -61.3200;
        SetVehiclePosEx(playerid, DealerCar[playerid], -2316.1819, 198.3852, 35.5608), SetVehicleZAngleEx(DealerCar[playerid], 75.7200);
        LinkVehicleToInterior(DealerCar[playerid], 0);
        SetPlayerCameraPos(playerid, -2329.9380, 185.0620, 37.8267);
        SetPlayerCameraLookAt(playerid, -2329.1919, 185.7270, 37.6017);
    }
    else if(DealerCarType[playerid] == 2) {
        SetPlayerInterior(playerid, 0);            LINIA PROBLEMA
        DealerCarAngle[playerid] = -61.3200;
        SetVehiclePosEx(playerid, DealerCar[playerid], -2316.1819, 198.3852, 35.5608), SetVehicleZAngleEx(DealerCar[playerid], 75.7200);
        LinkVehicleToInterior(DealerCar[playerid], 0);
        SetPlayerCameraPos(playerid, -2329.9380, 185.0620, 37.8267);
        SetPlayerCameraLookAt(playerid, -2329.1919, 185.7270, 37.6017);
    }
	

Edited by Cordyandrey
Link to comment
Share on other sites

  • 0

	function CancelTestDrive(playerid) {
    if(TestingModel[playerid] == 0) return 1;  
    SCM(playerid, COLOR_YELLOW, "Timpul disponibil pentru test-drive a expirat.");
    PutPlayerInVehicleEx(playerid, DealerCar[playerid], 0);
    if(DealerCarType[playerid] == 1) {
        SetPlayerInterior(playerid, 0);
        DealerCarAngle[playerid] = -61.3200;
        SetVehiclePosEx(playerid, DealerCar[playerid], -2316.1819, 198.3852, 35.5608), SetVehicleZAngleEx(DealerCar[playerid], 75.7200);
        LinkVehicleToInterior(DealerCar[playerid], 0);
        SetPlayerCameraPos(playerid, -2329.9380, 185.0620, 37.8267);
        SetPlayerCameraLookAt(playerid, -2329.1919, 185.7270, 37.6017);
    }
    else if(DealerCarType[playerid] == 2) {
        SetPlayerInterior(playerid, 0);                     LINIA PROBLEMA
        DealerCarAngle[playerid] = -61.3200;
        SetVehiclePosEx(playerid, DealerCar[playerid], -2316.1819, 198.3852, 35.5608), SetVehicleZAngleEx(DealerCar[playerid], 75.7200);
        LinkVehicleToInterior(DealerCar[playerid], 0);
        SetPlayerCameraPos(playerid, -2329.9380, 185.0620, 37.8267);
        SetPlayerCameraLookAt(playerid, -2329.1919, 185.7270, 37.6017);
    }
    else if(DealerCarType[playerid] == 3) {
        DealerCarAngle[playerid] = 214.5153;
        SetVehiclePosEx(playerid, DealerCar[playerid], 179.2214,-1935.9833,-0.2331), SetVehicleZAngleEx(DealerCar[playerid], 214.5153);
        SetPlayerCameraPos(playerid, 195.5355, -1952.8099, 8.7636);
        SetPlayerCameraLookAt(playerid, 194.7955, -1952.1398, 8.3886);
    }
	

 

Am bagat mai mult cod. poate te ajuta

Link to comment
Share on other sites

  • 0

	stock ShowPlayerVehicle(playerid) {
    new szTitle[180], szDialog[1300], szDialog2[1300], vstatus[1024];
    if(GetVehicles(playerid) == 0) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu ai un vehicul personal!");
    format(szTitle, sizeof(szTitle), "Vehicles (%d/%d)", GetVehicles(playerid), TotalSlots(playerid));            
    for(new i = 0; i < 10; i++) {
        if(i < 5) {
            if(i < 3) {
                if(PlayerInfo[playerid][pCarKey][i] != 0) {
                    new car =  PlayerInfo[playerid][pCarKey][i];
                    if(IsVehicleOccupied(CarInfo[car][Spawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    else if(CarInfo[car][Spawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    else format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    format(szDialog, sizeof(szDialog), "%s\n", vstatus);
                    strcat(szDialog2, szDialog);
                }
                else strcat(szDialog2, "{F3FF73}[ empty ]\n"), sVehicle[i][playerid] = 0;
            }
            else {
                if(PlayerInfo[playerid][pCarKey][i] != 0) {
                    new car =  PlayerInfo[playerid][pCarKey][i];
                    if(IsVehicleOccupied(CarInfo[car][Spawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    else if(CarInfo[car][Spawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    else format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    format(szDialog, sizeof(szDialog), "%s\n", vstatus);
                    strcat(szDialog2, szDialog);
                }
                else if(PlayerInfo[playerid][pPremiumAccount] == 1) strcat(szDialog2, "{F3FF73}[ empty ]\n"), sVehicle[i][playerid] = 0;            
            }
        }
        else {
            if(PlayerInfo[playerid][pCarKey][i] != 0) {
                new car =  PlayerInfo[playerid][pCarKey][i];
                if(IsVehicleOccupied(CarInfo[car][Spawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                else if(CarInfo[car][Spawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                else format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                format(szDialog, sizeof(szDialog), "%s\n", vstatus);
                strcat(szDialog2, szDialog);
            }
            else if(PlayerInfo[playerid][pSlot][i-5] == 1) strcat(szDialog2, "{F3FF73}[ empty ]\n"), sVehicle[i][playerid] = 0;        
        }
    }
    ShowPlayerDialog(playerid, DIALOG_GARAGE, DIALOG_STYLE_LIST, szTitle, szDialog2, "Ok", "Exit");
    return 1;
}
	

Aici e stock ShowPlayerVeh

Link to comment
Share on other sites

  • 0

Problema e de la 

aVehicleNames[CarInfo[car][cModel]-400]

Cele  9 lini care contin asta. De ce? Pentru ca 

CarInfo[car][cModel]

E 0 sau de fapt masina chiar nu exista desi e incarcata din baza de date(ciudat nu?)

O solutie ar fi sa faci asa

#define IsValidVehicleModelID(%0)				(400 <= (%0) <= 611)
stock ShowPlayerVehicle(playerid) {
    new szTitle[180], szDialog[1300], szDialog2[1300], vstatus[1024];
    if(GetVehicles(playerid) == 0) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu ai un vehicul personal!");
    format(szTitle, sizeof(szTitle), "Vehicles (%d/%d)", GetVehicles(playerid), TotalSlots(playerid));            
    for(new i = 0; i < 10; i++) {
        if(i < 5) {
            if(i < 3) {
                if(PlayerInfo[playerid][pCarKey][i] != 0) {
                    new car =  PlayerInfo[playerid][pCarKey][i];
                    if(!IsValidVehicleModelID(CarInfo[car][cModel])) continue;
                    if(IsVehicleOccupied(CarInfo[car][Spawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    else if(CarInfo[car][Spawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    else format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    format(szDialog, sizeof(szDialog), "%s\n", vstatus);
                    strcat(szDialog2, szDialog);
                }
                else strcat(szDialog2, "{F3FF73}[ empty ]\n"), sVehicle[i][playerid] = 0;
            }
            else {
                if(PlayerInfo[playerid][pCarKey][i] != 0) {
                    new car =  PlayerInfo[playerid][pCarKey][i];
                    if(!IsValidVehicleModelID(CarInfo[car][cModel])) continue;
                    if(IsVehicleOccupied(CarInfo[car][Spawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    else if(CarInfo[car][Spawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    else format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    format(szDialog, sizeof(szDialog), "%s\n", vstatus);
                    strcat(szDialog2, szDialog);
                }
                else if(PlayerInfo[playerid][pPremiumAccount] == 1) strcat(szDialog2, "{F3FF73}[ empty ]\n"), sVehicle[i][playerid] = 0;            
            }
        }
        else {
            if(PlayerInfo[playerid][pCarKey][i] != 0) {
                new car =  PlayerInfo[playerid][pCarKey][i];
                if(!IsValidVehicleModelID(CarInfo[car][cModel])) continue;
                if(IsVehicleOccupied(CarInfo[car][Spawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                else if(CarInfo[car][Spawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                else format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                format(szDialog, sizeof(szDialog), "%s\n", vstatus);
                strcat(szDialog2, szDialog);
            }
            else if(PlayerInfo[playerid][pSlot][i-5] == 1) strcat(szDialog2, "{F3FF73}[ empty ]\n"), sVehicle[i][playerid] = 0;        
        }
    }
    ShowPlayerDialog(playerid, DIALOG_GARAGE, DIALOG_STYLE_LIST, szTitle, szDialog2, "Ok", "Exit");
    return 1;
}

 

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.