Jump to content

Recommended Posts

Posted

Salut, am modificat putin sistemul de /v si acum cand dau /v imi spune ca aceasta comanda nu exista, dar ea se afla in gamemode.

 

stock ShowPlayerVehicle(playerid) {
    new szTitle[180], szDialog[6900], szDialog2[6900], vstatus[1024];
    if(GetVehicles(playerid) == 0) return SendClientMessage(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], TotalUp(car));
                    else if(CarInfo[car][Spawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                    else format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                    format(szDialog, sizeof(szDialog), "%s\tUpgrades\n", vstatus);
                    strcat(szDialog2, szDialog);
                }
                else strcat(szDialog2, "{FFD857}<slot liber>\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\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                    else if(CarInfo[car][Spawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                    else format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    format(szDialog, sizeof(szDialog), "%s\tUpgrades\n", vstatus);
                    strcat(szDialog2, szDialog);
                }
                else if(PlayerInfo[playerid][pPremiumAccount] == 1) strcat(szDialog2, "{FFD857}<slot liber>\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\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                else if(CarInfo[car][Spawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                else format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                format(szDialog, sizeof(szDialog), "%s\tUpgrades\n", vstatus);
                    strcat(szDialog2, szDialog);
            }
            else if(PlayerInfo[playerid][pSlot][i-5] == 1) strcat(szDialog2, "{FFD857}<slot liber>\n"), sVehicle[i][playerid] = 0;        
        }
    }
    ShowPlayerDialog(playerid, DIALOG_GARAGE, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szDialog2, "Ok", "Exit");
    return 1;
}

Posted
CMD:vehicles(playerid) return ShowPlayerVehicle(playerid);

stock ShowPlayerVehicle(playerid) 
{
    new szTitle[180], szDialog[6900], szDialog2[6900], vstatus[1024];

    if(GetVehicles(playerid) == 0) return SendClientMessage(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], TotalUp(car));
                    } 

                    switch(CarInfo[car][Spawned])
                    {
                    	case 0:
                    	{
                    		format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                    	}
                    	case 1:
                    	{
                    		format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                    	}
                    }
                    format(szDialog, sizeof(szDialog), "%s\tUpgrades\n", vstatus);
                    strcat(szDialog2, szDialog);
                }
                else strcat(szDialog2, "{FFD857}<slot liber>\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\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                    } 

                    switch(CarInfo[car][Spawned])
                    {
                    	case 0:
                    	{
                    		format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    	}
                    	case 1:
                    	{
                    		format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                    	}
                    }
                    format(szDialog, sizeof(szDialog), "%s\tUpgrades\n", vstatus);
                    strcat(szDialog2, szDialog);
                }
                else if(PlayerInfo[playerid][pPremiumAccount] == 1) strcat(szDialog2, "{FFD857}<slot liber>\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\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                } 
                switch(CarInfo[car][Spawned])
                {
                	case 0:
                	{
                		format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                	}
                	case 1:
                	{
                		format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                	}
                }
                format(szDialog, sizeof(szDialog), "%s\tUpgrades\n", vstatus);
                strcat(szDialog2, szDialog);
            }
            else if(PlayerInfo[playerid][pSlot][i-5] == 1) strcat(szDialog2, "{FFD857}<slot liber>\n"), sVehicle[i][playerid] = 0;        
        }
    }
    ShowPlayerDialog(playerid, DIALOG_GARAGE, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szDialog2, "Ok", "Exit");
    return 1;
}

 

Posted
2 hours ago, Maichh said:
CMD:vehicles(playerid) return ShowPlayerVehicle(playerid);

stock ShowPlayerVehicle(playerid) 
{
    new szTitle[180], szDialog[6900], szDialog2[6900], vstatus[1024];

    if(GetVehicles(playerid) == 0) return SendClientMessage(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], TotalUp(car));
                    } 

                    switch(CarInfo[car][Spawned])
                    {
                    	case 0:
                    	{
                    		format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                    	}
                    	case 1:
                    	{
                    		format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                    	}
                    }
                    format(szDialog, sizeof(szDialog), "%s\tUpgrades\n", vstatus);
                    strcat(szDialog2, szDialog);
                }
                else strcat(szDialog2, "{FFD857}<slot liber>\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\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                    } 

                    switch(CarInfo[car][Spawned])
                    {
                    	case 0:
                    	{
                    		format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    	}
                    	case 1:
                    	{
                    		format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                    	}
                    }
                    format(szDialog, sizeof(szDialog), "%s\tUpgrades\n", vstatus);
                    strcat(szDialog2, szDialog);
                }
                else if(PlayerInfo[playerid][pPremiumAccount] == 1) strcat(szDialog2, "{FFD857}<slot liber>\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\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                } 
                switch(CarInfo[car][Spawned])
                {
                	case 0:
                	{
                		format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                	}
                	case 1:
                	{
                		format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s\t%s%s%s%s", aVehicleNames[CarInfo[car][cModel]-400], TotalUp(car));
                	}
                }
                format(szDialog, sizeof(szDialog), "%s\tUpgrades\n", vstatus);
                strcat(szDialog2, szDialog);
            }
            else if(PlayerInfo[playerid][pSlot][i-5] == 1) strcat(szDialog2, "{FFD857}<slot liber>\n"), sVehicle[i][playerid] = 0;        
        }
    }
    ShowPlayerDialog(playerid, DIALOG_GARAGE, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szDialog2, "Ok", "Exit");
    return 1;
}

 

switch-ul nu imbunatateste viteza de executie in modul in care il folosesti tu, acolo merge perfect statement-ul if/else sau chiar si un operator ternar pt toate 3 string-urile (despawnat, spawnat, ocupat) depinde de preferintele fiecaruia, dar nu switch, switch doar pt mai mult de 2 cazuri.

Posted
7 hours ago, Sancky said:

switch-ul nu imbunatateste viteza de executie in modul in care il folosesti tu, acolo merge perfect statement-ul if/else sau chiar si un operator ternar pt toate 3 string-urile (despawnat, spawnat, ocupat) depinde de preferintele fiecaruia, dar nu switch, switch doar pt mai mult de 2 cazuri.

Acum sunt la camin si nu am pc u, va da server logs maine sau vineri, depinde cand ajung acasa

Posted
On 10/10/2023 at 3:07 PM, Sancky said:

switch-ul nu imbunatateste viteza de executie in modul in care il folosesti tu, acolo merge perfect statement-ul if/else sau chiar si un operator ternar pt toate 3 string-urile (despawnat, spawnat, ocupat) depinde de preferintele fiecaruia, dar nu switch, switch doar pt mai mult de 2 cazuri.

 

server_log.txt

Posted

[22:45:41] [debug] Run time error 4: "Array index out of bounds"
[22:45:41] [debug]  Accessing element at negative index -400
[22:45:41] [debug] AMX backtrace:
[22:45:41] [debug] #0 00150c14 in ?? (0) from wa-rpg.amx
[22:45:41] [debug] #1 0014a658 in public cmd_v (0, 170215900) from wa-rpg.amx
[22:45:41] [debug] #2 native CallLocalFunction () from samp-server.exe
[22:45:41] [debug] #3 00012e40 in public OnPlayerCommandText (0, 170215888) from wa-rpg.amx

 

ce-mi vine in cap acum e acel '400', verifica unde afiseaza numele vehiculului

Posted
14 minutes ago, hanako said:

[22:45:41] [debug] Run time error 4: "Array index out of bounds"
[22:45:41] [debug]  Accessing element at negative index -400
[22:45:41] [debug] AMX backtrace:
[22:45:41] [debug] #0 00150c14 in ?? (0) from wa-rpg.amx
[22:45:41] [debug] #1 0014a658 in public cmd_v (0, 170215900) from wa-rpg.amx
[22:45:41] [debug] #2 native CallLocalFunction () from samp-server.exe
[22:45:41] [debug] #3 00012e40 in public OnPlayerCommandText (0, 170215888) from wa-rpg.amx

 

ce-mi vine in cap acum e acel '400', verifica unde afiseaza numele vehiculului

image.png.c17d48208b0b96b12c69f271f61e68aa.png

 

Posted
1 hour ago, Smokey20_official said:

image.png.c17d48208b0b96b12c69f271f61e68aa.png

 

practic inseamna ca `CarInfo[car][cModel]` este 0 la una dintre masini, nu isi atribuie valoarea modelului undeva corect, verifica si tu de unde isi incarca valoarea model-ului si ce valori incarca

Posted
8 hours ago, Sancky said:

practic inseamna ca `CarInfo[car][cModel]` este 0 la una dintre masini, nu isi atribuie valoarea modelului undeva corect, verifica si tu de unde isi incarca valoarea model-ului si ce valori incarca

am cautat in systems.inc si in wa-rpg.pwn si degeaba, nu am gasit nimic

Join the conversation

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

Guest
Reply to this topic...

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