Player info
#1

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

Код:
Money:
Score:
Health:
Armour:
Reply
#2

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"); 
Reply
#3

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

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

Now i getting this:

error 017: undefined symbol "scorevariable"
Pawn compiler 3.2.3664


1 Error.
Reply
#6

Код:
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.
Reply
#7

Now undefined this variables:

healthvariable, armourvariable
Reply
#8

Код:
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.
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)