SA-MP Forums Archive
Player info - 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: Player info (/showthread.php?tid=332463)



Player info - SkyWings - 08.04.2012

How i can make player info GUI dialog? Just /pinfo command, and there:

Код:
Money:
Score:
Health:
Armour:



Re: Player info - Boooth - 08.04.2012

You should use format() and then insert the Variables into the string using %d for intergers and %f for floats like this;

PHP код:
format(stringsizeof(string), "Player Score: %d | Player Money: %d | Player Health: %f | Player Armour: %f"scorevariablemoneyvariablehealthvariablearmourvariable); 
then literally just this.

PHP код:
ShowPlayerDialog(playerid, [DIALOGID], DIALOG_STYLE_MSGBOX"*Player Information*"string"Okay""Close"); 



Re: Player info - SkyWings - 06.10.2012

I get with this code:

Код:
	if (strcmp(cmdtext, "/pinfo", true) == 0)
	{
	format(string, sizeof(string), "Player Score: %d | Player Money: %d | Player Health: %f | Player Armour: %f", scorevariable, moneyvariable, healthvariable, armourvariable);
	ShowPlayerDialog(playerid, 8555, DIALOG_STYLE_MSGBOX, "*Player information*", string, "Okay", "");
	return 1;
	}
Errors:

Код:
error 017: undefined symbol "string"
error 017: undefined symbol "string"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

Compilation aborted.



Re: Player info - gtakillerIV - 06.10.2012

Try:

Код:
if (strcmp("/pinfo", cmdtext, true, 6) == 0)
{
	new string[128];
	format(string, sizeof(string), "Player Score: %d | Player Money: %d | Player Health: %f | Player Armour: %f", scorevariable, moneyvariable, healthvariable, armourvariable);
	ShowPlayerDialog(playerid, 8555, DIALOG_STYLE_MSGBOX, "*Player information*", string, "Okay", "");
	return 1;
}



Re: Player info - SkyWings - 06.10.2012

Now i getting this:

error 017: undefined symbol "scorevariable"
Pawn compiler 3.2.3664


1 Error.


Re: Player info - gtakillerIV - 06.10.2012

Код:
if (strcmp("/pinfo", cmdtext, true, 6) == 0)
{
	new string[128];
	format(string, sizeof(string), "Player Score: %d | Player Money: %d | Player Health: %f | Player Armour: %f", GetPlayerScore(playerid), moneyvariable, healthvariable, armourvariable);
	ShowPlayerDialog(playerid, 8555, DIALOG_STYLE_MSGBOX, "*Player information*", string, "Okay", "");
	return 1;
}
Try.


Re: Player info - SkyWings - 06.10.2012

Now undefined this variables:

healthvariable, armourvariable


Re: Player info - gtakillerIV - 06.10.2012

Код:
if (strcmp("/pinfo", cmdtext, true, 6) == 0)
{
	new string[128];
	format(string, sizeof(string), "Player Score: %d | Player Money: %d | Player Health: %f | Player Armour: %f", GetPlayerScore(playerid),GetPlayerMoney(playerid), GetPlayerHealth(playerid), GetPlayerArmour(playerid));
	ShowPlayerDialog(playerid, 8555, DIALOG_STYLE_MSGBOX, "*Player information*", string, "Okay", "");
	return 1;
}
This should do it.


Re: Player info - SkyWings - 06.10.2012

My code:

if (strcmp("/pinfo", cmdtext, true, 6) == 0)
{
new string[128];
format(string, sizeof(string), "Player Score: %d | Player Money: %d | Player Health: %f | Player Armour: %f", GetPlayerScore(playerid), GetPlayerMoney(playerid), healthvariable, armourvariable);
ShowPlayerDialog(playerid, 8555, DIALOG_STYLE_MSGBOX, "*Player information*", string, "Okay", "");
return 1;
}

Anyway getting undefined.


Re: Player info - gtakillerIV - 06.10.2012

Replace it with this code.
Код:
if (strcmp("/pinfo", cmdtext, true, 6) == 0)
{
	new string[128];
	format(string, sizeof(string), "Player Score: %d | Player Money: %d | Player Health: %f | Player Armour: %f", GetPlayerScore(playerid),GetPlayerMoney(playerid), GetPlayerHealth(playerid), GetPlayerArmour(playerid));
	ShowPlayerDialog(playerid, 8555, DIALOG_STYLE_MSGBOX, "*Player information*", string, "Okay", "");
	return 1;
}