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



Licenses help - lulo356 - 27.03.2014

Well, If you have you licenses it doenst show up in /showlicenses, but you see it in /licenses

pawn Код:
CMD:showlicenses(playerid, params[])
{
    new string[256], playerb, carlicense[128], flylicense[128], weplicense[128];
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /showlicenses [playerid]");
    if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    if(PlayerInfo[playerb][pCarLic] == 1) format(carlicense, sizeof(carlicense), "Passed");
    else if(PlayerInfo[playerb][pCarLic] == 0) format(carlicense, sizeof(carlicense), "Not Passed");
    if(PlayerInfo[playerb][pFlyLic] == 1) format(flylicense, sizeof(flylicense), "Passed");
    else if(PlayerInfo[playerb][pFlyLic] == 0) format(flylicense, sizeof(flylicense), "Not Passed");
    if(PlayerInfo[playerb][pWepLic] == 1) format(weplicense, sizeof(weplicense), "Passed");
    else if(PlayerInfo[playerb][pWepLic] == 0) format(weplicense, sizeof(weplicense), "Not Passed");
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    format(string, sizeof(string), "|____ %s Licenses ____|", RPN(playerid));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Name: {FFFFFF}%s", RPN(playerid));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Driving License Status: {FFFFFF}%s", carlicense);
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Flying License Status: {FFFFFF}%s", flylicense);
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Weapon License Status: {FFFFFF}%s", weplicense);
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    return 1;
}



Re: Licenses help - AhmedMohamed - 27.03.2014

explain your problem please


Re: Licenses help - Konstantinos - 27.03.2014

pawn Код:
CMD:showlicenses(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    new playerb;
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /showlicenses [playerid]");
    if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    new string[43];
    format(string, sizeof(string), "|____ %s Licenses ____|", RPN(playerid));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Name: {FFFFFF}%s", RPN(playerid));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Driving License Status: {FFFFFF}%s", (PlayerInfo[playerb][pCarLic]) ? ("Passed") : ("Not Passed"));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Flying License Status: {FFFFFF}%s", (PlayerInfo[playerb][pFlyLic]) ? ("Passed") : ("Not Passed"));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Weapon License Status: {FFFFFF}%s", (PlayerInfo[playerb][pWepLic]) ? ("Passed") : ("Not Passed"));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    return 1;
}



Re: Licenses help - lulo356 - 27.03.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
CMD:showlicenses(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    new playerb;
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /showlicenses [playerid]");
    if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    new string[43];
    format(string, sizeof(string), "|____ %s Licenses ____|", RPN(playerid));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Name: {FFFFFF}%s", RPN(playerid));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Driving License Status: {FFFFFF}%s", (PlayerInfo[playerb][pCarLic]) ? ("Passed") : ("Not Passed"));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Flying License Status: {FFFFFF}%s", (PlayerInfo[playerb][pFlyLic]) ? ("Passed") : ("Not Passed"));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Weapon License Status: {FFFFFF}%s", (PlayerInfo[playerb][pWepLic]) ? ("Passed") : ("Not Passed"));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    return 1;
}
Now, if you dont have your licenses, you see passed, so thats not right,


Re: Licenses help - Konstantinos - 27.03.2014

I see the problem. It shows whether it's passed or not for playerb but the name of the licence is for playerid.

pawn Код:
CMD:showlicenses(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    new playerb;
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /showlicenses [playerid]");
    if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    new string[43];
    format(string, sizeof(string), "|____ %s Licenses ____|", RPN(playerb));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Name: {FFFFFF}%s", RPN(playerb));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Driving License Status: {FFFFFF}%s", (PlayerInfo[playerb][pCarLic]) ? ("Passed") : ("Not Passed"));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Flying License Status: {FFFFFF}%s", (PlayerInfo[playerb][pFlyLic]) ? ("Passed") : ("Not Passed"));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Weapon License Status: {FFFFFF}%s", (PlayerInfo[playerb][pWepLic]) ? ("Passed") : ("Not Passed"));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    return 1;
}



Re: Licenses help - lulo356 - 27.03.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
I see the problem. It shows whether it's passed or not for playerb but the name of the licence is for playerid.

pawn Код:
CMD:showlicenses(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    new playerb;
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /showlicenses [playerid]");
    if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    new string[43];
    format(string, sizeof(string), "|____ %s Licenses ____|", RPN(playerb));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Name: {FFFFFF}%s", RPN(playerb));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Driving License Status: {FFFFFF}%s", (PlayerInfo[playerb][pCarLic]) ? ("Passed") : ("Not Passed"));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Flying License Status: {FFFFFF}%s", (PlayerInfo[playerb][pFlyLic]) ? ("Passed") : ("Not Passed"));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Weapon License Status: {FFFFFF}%s", (PlayerInfo[playerb][pWepLic]) ? ("Passed") : ("Not Passed"));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    return 1;
}
Now is the problem, you see your own licenses if you do /showlicenses {id}


Re: Licenses help - Konstantinos - 27.03.2014

I don't understand what you mean. It will show the information about playerb (if the player is connected) else it will return an error.


Re: Licenses help - lulo356 - 27.03.2014

Sorry, i was on my Phone,

But i mean, If the player do /showlicenses to you, you will see your own licenses, not the licenses from the other player


Re: Licenses help - Konstantinos - 27.03.2014

The sscanf assigns the player's ID to the variable playerb. If you use an older version of sscanf, it will be bugged and it will work only for player with ID 0 so if your ID is 0 and you try to check someone else licenses, it will show yours. That's just a theory, I don't know the version you use though so just make sure.