more formats
#1

i have a problem,i have this
Код:
if(strcmp(cmd,"/licenses",true)==0)
    {
        if(IsPlayerConnected(playerid))
	    {
	        new pzbori = PlayerInfo[playerid][pzbor];
	    	new pvapori = PlayerInfo[playerid][pvapor];
	    	new ppestei = PlayerInfo[playerid][ppeste];
	    	new parmai = PlayerInfo[playerid][parma];
	        for(new i = 0; i < MAX_PLAYERS; i++)
			{
	        	if(PlayerInfo[i][pzbor] == 0)
					{
					    PlayerInfo[playerid][pFlyLic] = 0;
					    format(string, sizeof(string), "** Flying License: Expired[%d/10].",pzbori);
						SendClientMessage(playerid, COLOR_LICENSES, string);
						return 1;
		   			}
					else
					{
						format(string, sizeof(string), "** Flying License: Avaible[%d/10].",pzbori);
						SendClientMessage(playerid, COLOR_LICENSES, string);
					    return 1;
					}
				if(PlayerInfo[ia][ppeste] == 0)
					{
					    PlayerInfo[playerid][pFlyLic] = 0;
					    format(string, sizeof(string), "** Fishing License: Expired[%d/10].",ppestei);
						SendClientMessage(playerid, COLOR_LICENSES, string);
						return 1;
		   			}
					else
					{
						format(string, sizeof(string), "** Fishing License: Avaible[%d/10].",ppestei);
						SendClientMessage(playerid, COLOR_LICENSES, string);
					    return 1;
					}
			}
		}
	    return 1;
 	}
but te problem is that is show me only Flying License,where is the mistake?
Reply
#2

pelase help me is urgent
Reply
#3

Check string length
Reply
#4

i try but nothing
Reply
#5

please help
Reply
#6

pawn Код:
if(PlayerInfo[ia][ppeste] == 0)
Quote:

[ia]? or [i]?

Reply
#7

Quote:
Originally Posted by ******
Посмотреть сообщение
Why the loop?
just another try...
Reply
#8

Quote:
Originally Posted by Scott Zulkifli
Посмотреть сообщение
pawn Код:
if(PlayerInfo[ia][ppeste] == 0)
there i try but isn't work
Reply
#9

You have a return 1; in each if statement, so if you have a flying license, the code will stop there and will not continue. Your code should be this:
pawn Код:
if(strcmp(cmd,"/licenses",true)==0)
{
    if(IsPlayerConnected(playerid))
    {
        new pzbori = PlayerInfo[playerid][pzbor];
        new pvapori = PlayerInfo[playerid][pvapor];
        new ppestei = PlayerInfo[playerid][ppeste];
        new parmai = PlayerInfo[playerid][parma];
        if(PlayerInfo[playerid][pzbor] == 0)
        {
            PlayerInfo[playerid][pFlyLic] = 0;
            format(string, sizeof(string), "** Flying License: Expired[%d/10].",pzbori);
            SendClientMessage(playerid, COLOR_LICENSES, string);
        }
        else
        {
            format(string, sizeof(string), "** Flying License: Available[%d/10].",pzbori);
            SendClientMessage(playerid, COLOR_LICENSES, string);
        }
        if(PlayerInfo[playerid][ppeste] == 0)
        {
            PlayerInfo[playerid][pFlyLic] = 0;
            format(string, sizeof(string), "** Fishing License: Expired[%d/10].",ppestei);
            SendClientMessage(playerid, COLOR_LICENSES, string);
        }
        else
        {
            format(string, sizeof(string), "** Fishing License: Avaible[%d/10].",ppestei);
            SendClientMessage(playerid, COLOR_LICENSES, string);
        }
    }
    return 1;
}
Reply
#10

^^

Why need IsPlayerConnected?
If the player is typing is already connected.
Is there any invalid player that can type commands? LoL.
Anyway. Remove the loop. It's useless. You didn't use it in your command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)