SA-MP Forums Archive
Simple help :D - 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: Simple help :D (/showthread.php?tid=584558)



Simple help :D - MichaelJones - 05.08.2015

I forgot how to make the /stats command with this codes
Can you type me the code to make the /stats command with the kills/cash and this shits?

Here's the code of my pkills and this things


Quote:

enum pInfo
{
pPass,
pCash,
pAdmin,
pKills,
pDeaths
}




Re: Simple help :D - SpikeSpigel - 05.08.2015

I'm such an idiot, excuse me.


Re: Simple help :D - Fancy - 05.08.2015

Easy example

Код:
enum pInfo
{
    pMoney
}
Код:
new PlayerInfo[MAX_PLAYERS][pInfo];
Код:
new str[100];
PlayerInfo[playerid][pMoney] = GetPlayerMoney(playerid);
format(str,sizeof(str),"Money: %d", PlayerInfo[playerid][pMoney]);
SendClientMessage(playerid, 0xFFFFFFFF,str);



Re: Simple help :D - SpikeSpigel - 05.08.2015

Код:
enum pInfo
{
	pPass,
	pCash,
	pAdmin,
	pKills,
	pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo]; // In the upper part of the script.

CMD:stats(params, playerid) // In the lower part of the script.
{
	new pName[MAX_PLAYER_NAME], string[126];
	GetPlayerName(playerid, pName, sizeof(pName));
	
	if(IsPlayerConnected)
	{
		format(string, sizeof(string), "________________%s's stats_______________", pName);
		format(string, sizeof(string), "Money: %d , Kills: %d , Deaths: %d", PlayerInfo[playerid][pCash], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths]);
		format(string, sizeof(string), "________________________________________");
		SendClientMessage(playerid, -1, string);
	}
	else
	{
		SendClientMessage(playerid, -1, "You are not connected.");
	}
	return 1;
}



Re: Simple help :D - MichaelJones - 05.08.2015

Quote:
Originally Posted by SpikeSpigel
Посмотреть сообщение
Код:
enum pInfo
{
	pPass,
	pCash,
	pAdmin,
	pKills,
	pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo]; // In the upper part of the script.

CMD:stats(params, playerid) // In the lower part of the script.
{
	new pName[MAX_PLAYER_NAME], string[126];
	GetPlayerName(playerid, pName, sizeof(pName));
	
	if(IsPlayerConnected)
	{
		format(string, sizeof(string), "________________%s's stats_______________", pName);
		format(string, sizeof(string), "Money: %d , Kills: %d , Deaths: %d", PlayerInfo[playerid][pCash], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths]);
		format(string, sizeof(string), "________________________________________");
		SendClientMessage(playerid, -1, string);
	}
	else
	{
		SendClientMessage(playerid, -1, "You are not connected.");
	}
	return 1;
}
Didn't work


Re: Simple help :D - SpikeSpigel - 05.08.2015

Quote:
Originally Posted by MichaelJones
Посмотреть сообщение
Didn't work
What's exactly not working ?


Re: Simple help :D - StuartD - 05.08.2015

Quote:
Originally Posted by SpikeSpigel
Посмотреть сообщение
Код:
	if(IsPlayerConnected)
Who are you checking is connected? IsPlayerConnected(playerid)


Re: Simple help :D - SpikeSpigel - 06.08.2015

Quote:
Originally Posted by StuartD
Посмотреть сообщение
Who are you checking is connected? IsPlayerConnected(playerid)
Auch. My bad, thank you for modifying it !