SA-MP Forums Archive
string formating 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: string formating help (/showthread.php?tid=664803)



string formating help - bosmania - 11.03.2019

this is a part of my /licences command,the command works,but if a licence is 0 hours it shows 0 hours left,how do i make it to show "Expired" if it's 0 hours


format(szDialog, sizeof(szDialog), "{ff0000}Driving:{ffffff} %d hours left\n{ff0000}Flying:{ffffff} %d hours left\n{ff0000}Boat:{ffffff} %d hours left\n{ff0000}Bike:{ffffff} %d hours left\n{ff0000}Weapon:{ffffff} %d hours left",
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", "");


Re: string formating help - antixgaming - 11.03.2019

Basic thing. You check if hours are below 1 and if they are, you format the string to say expired.