SA-MP Forums Archive
more formats - 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: more formats (/showthread.php?tid=403559)



more formats - Visio - 30.12.2012

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?


Re: more formats - Visio - 30.12.2012

pelase help me is urgent


Re: more formats - RedCrossER - 30.12.2012

Check string length


Re: more formats - Visio - 30.12.2012

i try but nothing


Re: more formats - Visio - 31.12.2012

please help


Re: more formats - Scott Zulkifli - 31.12.2012

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

[ia]? or [i]?




Re: more formats - Visio - 31.12.2012

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


Re: more formats - Visio - 31.12.2012

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


Re: more formats - Threshold - 31.12.2012

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;
}



Re: more formats - JaKe Elite - 31.12.2012

^^

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.