SA-MP Forums Archive
/licences on dialog help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /licences on dialog help (/showthread.php?tid=664737)



/licences on dialog help - bosmania - 09.03.2019

This is my licences command,it works,but when one licence has 0 hours,i want to make it to write Driving:Expired,not Driving:0, for example,i want for all of them not only the driving one

CMD:licences(playerid, params[]) return ShowLicences(playerid);


function ShowLicences(playerid){

new szDialog[256];
format(szDialog, sizeof(szDialog), "{ff0000}Driving:{ffffff} %d\n{ff0000}Flying:{ffffff} %d\n{ff0000}Boat:{ffffff} %d\n{ff0000}Bike:{ffffff} %d\n{ff0000}Weapon:{ffffff} %d",
PlayerInfo[playerid][pCarLicence], PlayerInfo[playerid][pFlyLicence], PlayerInfo[playerid][pBoatLicence], PlayerInfo[playerid][pBikeLicence], PlayerInfo[playerid][pGunLicence]);
ShowPlayerDialog(playerid, DIALOG_LICENCES, DIALOG_STYLE_MSGBOX, "Your licences", szDialog, "OK", "");
return 1;
}


Re: /licences on dialog help - Autorojo - 09.03.2019

PHP код:
function ShowLicences(playerid){
    new 
carLicence[16];
    switch(
PlayerInfo[playerid][pCarLicence])
    {
        case 
0:
            
format(carLicencesizeof(carLicence), "expired");
        default:
            
format(carLicencesizeof(carLicence), "%d"PlayerInfo[playerid][pCarLicence]);
    }
    new 
szDialog[256];
    
format(szDialogsizeof(szDialog), "{ff0000}Driving:{ffffff} %s\n{ff0000}Flying:{ffffff} %d\n{ff0000}Boat:{ffffff} %d\n{ff0000}Bike:{ffffff} %d\n{ff0000}Weapon:{ffffff} %d",
    
carLicencePlayerInfo[playerid][pFlyLicence], PlayerInfo[playerid][pBoatLicence], PlayerInfo[playerid][pBikeLicence], PlayerInfo[playerid][pGunLicence]);
    
ShowPlayerDialog(playeridDIALOG_LICENCESDIALOG_STYLE_MSGBOX"Your licences"szDialog"OK""");
    return 
1;

Quote:
Originally Posted by OnlyMiniGames
Посмотреть сообщение
format(szDialog, sizeof(szDialog), "{ff0000}Driving:{ffffff} %s\n{ff0000}Flying:{ffffff} %d\n{ff0000}Boat:{ffffff} %d\n{ff0000}Bike:{ffffff} %d\n{ff0000}Weapon:{ffffff} %d",
PlayerInfo[playerid][pCarLicence] ? {PlayerInfo[playerid][pCarLicence]}:"Driving:Expired", PlayerInfo[playerid][pFlyLicence], PlayerInfo[playerid][pBoatLicence], PlayerInfo[playerid][pBikeLicence], PlayerInfo[playerid][pGunLicence]);
This don't gonna work because you are trying to format PlayerInfo[playerid][pCarLicence] like a string, and it is not a string.