SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 09/03/2019, 06:05 PM   #1
bosmania
Big Clucker
 
Join Date: Feb 2019
Posts: 94
Reputation: 0
Default /licences on dialog help

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;
}
bosmania is offline   Reply With Quote
Old 09/03/2019, 07:51 PM   #2
Autorojo
Little Clucker
 
Join Date: Mar 2015
Posts: 17
Reputation: 0
Default Re: /licences on dialog help

PHP Code:
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 View Post
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.
Autorojo is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[DIALOG]How i Create A dialog Whent Player Login To Enter in Dialog The Password donhu789 Scripting Help 8 29/09/2013 08:15 AM
Warning: PlayerDialogResponse PlayerId: 0 dialog ID doesn't match last sent dialog ID Blackazur Scripting Help 1 30/04/2013 07:25 PM
[19:58:45] Warning: PlayerDialogResponse PlayerId: 28 dialog ID doesn't match last sent dialog ID, what it means? niels44 Scripting Help 6 13/06/2012 06:53 PM
[Help] With this simple /licences command kariok Help Archive 7 20/03/2011 09:21 PM
Licences system? mathiashhg Help Archive 3 28/10/2010 11:42 PM


All times are GMT. The time now is 01:17 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.