SA-MP Forums Archive
Showplayerstats ^^, - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Showplayerstats ^^, (/showthread.php?tid=140748)



Showplayerstats ^^, - sjvt - 10.04.2010

Hi, i was create my playerstats

but if i do /stats i see then the 3 lines :/

Код:
if(PlayerInfo[playerid][pLicenseA] == 1 || PlayerInfo[playerid][pLicenseB] == 1 || PlayerInfo[playerid][pLicenseC] == 1)
{
	SendClientMessage(playerid, COLOR_WHITE, "Flying License: yes | Boat License: yes | Driver License: yes");
}
if(PlayerInfo[playerid][pLicenseA] == 0 || PlayerInfo[playerid][pLicenseB] == 0 || PlayerInfo[playerid][pLicenseC] == 0)
{
	SendClientMessage(playerid, COLOR_WHITE, "Flying License: no | Boat License: no | Driver License: no");
}
if(PlayerInfo[playerid][pLicenseA] == 0 || PlayerInfo[playerid][pLicenseB] == 1 || PlayerInfo[playerid][pLicenseC] == 0)
{
	SendClientMessage(playerid, COLOR_WHITE, "Flying License: no | Boat License: yes | Driver License: no");
}
if(PlayerInfo[playerid][pLicenseA] == 1 || PlayerInfo[playerid][pLicenseB] == 0 || PlayerInfo[playerid][pLicenseC] == 0)
{
	SendClientMessage(playerid, COLOR_WHITE, "Flying License: yes | Boat License: no | Driver License: no");
}
if(PlayerInfo[playerid][pLicenseA] == 0 || PlayerInfo[playerid][pLicenseB] == 0 || PlayerInfo[playerid][pLicenseC] == 1)
{
	SendClientMessage(playerid, COLOR_WHITE, "Flying License: no | Boat License: no | Driver License: yes");
}
screenshot




Re: Showplayerstats ^^, - RyDeR` - 10.04.2010

All things you made there can you do in only 3 script lines.. Why so difficult?
Use format method and define 0 as NO and 1 as YES.


Re: Showplayerstats ^^, - Hiddos - 10.04.2010

Use && instead of || Example: if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][AdminLevel] >= 1) becomes if(IsPlayerAdmin(playerid) && PlayerInfo[playerid][AdminLevel] >= 1)


Re: Showplayerstats ^^, - sjvt - 10.04.2010

Quote:
Originally Posted by » RyDeR «
All things you made there can you do in only 3 script lines.. Why so difficult?
Use format method and define 0 as NO and 1 as YES.
how :$


Re: Showplayerstats ^^, - woot - 10.04.2010

Untested, might work, if it doesn't just re-do it, I guess you got how I ment it.

pawn Код:
new
    lic_str[ 3 ][ 5 ],
    output[ 94 ];
   
if(PlayerInfo[playerid][pLicenseA]) lic_str[0] = "Yes"; else lic_str[0] = "No";
if(PlayerInfo[playerid][pLicenseB]) lic_str[1] = "Yes"; else lic_str[1] = "No";
if(PlayerInfo[playerid][pLicenseC]) lic_str[2] = "Yes"; else lic_str[2] = "No";

format(output, sizeof(output), "Flying License: %s | Boat License: %s | Driver License: %s", lic_str[0], lic_str[1], lic_str[2]);
SendClientMessage(playerid, COLOR_WHITE, output);



Re: Showplayerstats ^^, - Babul - 10.04.2010

Код:
	new NoOrYes[2][]={"No","Yes"};
	new String[128];
	format(String, sizeof(String), "Flying License: %s | Boat License: %s | Driver License: %s", NoOrYes[PlayerInfo[playerid][pLicenseA]], NoOrYes[PlayerInfo[playerid][pLicenseB]], NoOrYes[PlayerInfo[playerid][pLicenseC]]);