Licenses help
#1

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;
}
Reply
#2

explain your problem please
Reply
#3

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;
}
Reply
#4

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,
Reply
#5

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;
}
Reply
#6

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}
Reply
#7

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.
Reply
#8

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
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)