SA-MP Forums Archive
Minor problem with stats commands. - 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: Minor problem with stats commands. (/showthread.php?tid=361201)



Minor problem with stats commands. - [SF]OutLawZ - 20.07.2012

Hi,

After typing /stats on a un-registered player, It shows the XP and Location. (Fine)
But then, the next like says 'Unknown Command'. Not sure why, Can anyone spot the problem for the command ?

Код:
(Information) XP-> 0 .. Location -> Blueberry
Server: Unknown Command.
Код:
Stats(playerid, params[])
{
	new pid = ReturnPlayer(params);
	if (pid == INVALID_PLAYER_ID) pid = playerid;
	
	new string[MAX_STRING];
	new location[28];
	GetPlayer2DZone(pid, location, 28);
	if(GetPlayerInterior(pid) > 0){
		format(string, sizeof(location),"Interior");
	}
	new PlayerState[10];
	if(GetPlayerState(pid) == 1) { PlayerState = "On foot"; }
	if(GetPlayerState(pid) == 2) { PlayerState = "Driver"; }
	if(GetPlayerState(pid) == 3) { PlayerState = "Passenger"; }
	if(GetPlayerState(pid) == 7) { PlayerState = "Dead"; }
	if(GetPlayerState(pid) == 0 || GetPlayerState(pid) == 4 || GetPlayerState(pid) == 5 || GetPlayerState(pid) == 6 || GetPlayerState(pid) == 8) { PlayerState = "/"; }
	format(string, sizeof(string), "{068F06} %s's(id:%i) Player Statistics", g_playerdata[pid][NAME], pid);
	SendClientMessage(playerid, COLOUR_DEFAULT, string);

	format(string, sizeof(string), "{EBD113}(Information) {FFFFFF}XP -> %i .. Location -> %s",g_playerdata[pid][XP],location);
	SendPlayerInfo(playerid, string);
	new Float:kr;
	kr = (g_playerdata[pid][KILLS]/g_playerdata[pid][DEATHS]);
	format(string, sizeof(string), "{EBD113}(Kills/Deaths) {FFFFFF}Kills -> %i .. Drive-by kills - > %i .. Deaths -> %i .. Suicides -> %i .. Ratio -> %.2fm", g_playerdata[pid][KILLS], g_playerdata[pid][DBKILLS], g_playerdata[pid][DEATHS], g_playerdata[pid][SUICIDES],kr);
	SendPlayerInfo(playerid, string);
	new Float:health, Float:armour;
	GetPlayerHealth(pid,health);GetPlayerArmour(pid, armour);
	format(string, sizeof(string), "{EBD113}(Personal) {FFFFFF}Health -> %.f .. Armor -> %.f .. Bank(Approx.) -> $%i",health,armour,g_playerdata[pid][BANK]);
	SendPlayerInfo(playerid, string);

	format(string, sizeof(string), "{EBD113}(Account) {FFFFFF}Online -> %i days, %i hours and %i minutes .. Registered -> %s", max(g_playerdata[pid][TIMEONLINE] / 1440, 0), max((g_playerdata[pid][TIMEONLINE] / 60) % 24, 0), g_playerdata[pid][TIMEONLINE] % 60, INI_Exist(ReturnPlayerFilename(g_playerdata[playerid][NAME])) ? ("Yes") : ("No"));
	SendPlayerInfo(playerid, string);
	
	format(string, sizeof(string), "{EBD113}(Account) {FFFFFF}Paused -> %i days, %i hours and %i minutes .. Playerstate -> %s", max(g_playerdata[pid][PAUSETIME] / 1440, 0), max((g_playerdata[pid][PAUSETIME] / 60) % 24, 0), g_playerdata[pid][PAUSETIME] % 60, PlayerState);
	SendPlayerInfo(playerid, string);

	return 1;
}
Thanks


Re: Minor problem with stats commands. - Captain_Mani - 20.07.2012

Is that /stats command from a filterscript?


Re: Minor problem with stats commands. - Rudy_ - 20.07.2012

pawn Код:
CMD:stats(playerid, params[])
{
    new pid = ReturnPlayer(params);
    if (pid == INVALID_PLAYER_ID) pid = playerid;
   
    new string[MAX_STRING];
    new location[28];
    GetPlayer2DZone(pid, location, 28);
    if(GetPlayerInterior(pid) > 0){
        format(string, sizeof(location),"Interior");
    }
    new PlayerState[10];
    if(GetPlayerState(pid) == 1) { PlayerState = "On foot"; }
    if(GetPlayerState(pid) == 2) { PlayerState = "Driver"; }
    if(GetPlayerState(pid) == 3) { PlayerState = "Passenger"; }
    if(GetPlayerState(pid) == 7) { PlayerState = "Dead"; }
    if(GetPlayerState(pid) == 0 || GetPlayerState(pid) == 4 || GetPlayerState(pid) == 5 || GetPlayerState(pid) == 6 || GetPlayerState(pid) == 8) { PlayerState = "/"; }
    format(string, sizeof(string), "{068F06} %s's(id:%i) Player Statistics", g_playerdata[pid][NAME], pid);
    SendClientMessage(playerid, COLOUR_DEFAULT, string);

    format(string, sizeof(string), "{EBD113}(Information) {FFFFFF}XP -> %i .. Location -> %s",g_playerdata[pid][XP],location);
    SendPlayerInfo(playerid, string);
    new Float:kr;
    kr = (g_playerdata[pid][KILLS]/g_playerdata[pid][DEATHS]);
    format(string, sizeof(string), "{EBD113}(Kills/Deaths) {FFFFFF}Kills -> %i .. Drive-by kills - > %i .. Deaths -> %i .. Suicides -> %i .. Ratio -> %.2fm", g_playerdata[pid][KILLS], g_playerdata[pid][DBKILLS], g_playerdata[pid][DEATHS], g_playerdata[pid][SUICIDES],kr);
    SendPlayerInfo(playerid, string);
    new Float:health, Float:armour;
    GetPlayerHealth(pid,health);GetPlayerArmour(pid, armour);
    format(string, sizeof(string), "{EBD113}(Personal) {FFFFFF}Health -> %.f .. Armor -> %.f .. Bank(Approx.) -> $%i",health,armour,g_playerdata[pid][BANK]);
    SendPlayerInfo(playerid, string);

    format(string, sizeof(string), "{EBD113}(Account) {FFFFFF}Online -> %i days, %i hours and %i minutes .. Registered -> %s", max(g_playerdata[pid][TIMEONLINE] / 1440, 0), max((g_playerdata[pid][TIMEONLINE] / 60) % 24, 0), g_playerdata[pid][TIMEONLINE] % 60, INI_Exist(ReturnPlayerFilename(g_playerdata[playerid][NAME])) ? ("Yes") : ("No"));
    SendPlayerInfo(playerid, string);
   
    format(string, sizeof(string), "{EBD113}(Account) {FFFFFF}Paused -> %i days, %i hours and %i minutes .. Playerstate -> %s", max(g_playerdata[pid][PAUSETIME] / 1440, 0), max((g_playerdata[pid][PAUSETIME] / 60) % 24, 0), g_playerdata[pid][PAUSETIME] % 60, PlayerState);
    SendPlayerInfo(playerid, string);

    return 1;
}



Re: Minor problem with stats commands. - [SF]OutLawZ - 20.07.2012

The commands inside a include I created.

Код:
cmd(Stats, 5, cmdtext);



Re: Minor problem with stats commands. - Rudy_ - 20.07.2012

wtf? Nope
it should be like this
pawn Код:
CMD:stats(playerid,params[])
//or
Command:stats(playerid,params[])



Re: Minor problem with stats commands. - [SF]OutLawZ - 20.07.2012

Well my settings have been modified. Other then that, Even with the CMD: It still doesn't seem to work.


Re: Minor problem with stats commands. - Djole1337 - 20.07.2012

Quote:
Originally Posted by Rudy_
Посмотреть сообщение
wtf? Nope
it should be like this
pawn Код:
CMD:stats(playerid,params[])
//or
Command:stats(playerid,params[])
nah
pawn Код:
cmd(stats, playerid,params[]), command(stats, blabla, COMMAND:stats, CMD:stats
same shit...


Re: Minor problem with stats commands. - Rudy_ - 20.07.2012

He had " ; " in the last too -.-
[Remove]This forum requires that you wait 120 seconds between posts. Please try again in 50 seconds.
[/FFS]