SA-MP Forums Archive
HELP: Command says "Unknow command" ?? - 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: HELP: Command says "Unknow command" ?? (/showthread.php?tid=160679)



HELP: Command says "Unknow command" ?? - LasTRace - 17.07.2010

hai,

i was trayin to create a "/Getstats [playerid]" command with dcmd, its ok, it shows usage when i write "/getstats" only, but showing stats doesn't work(when i write /getstats [playerid]). It returns to "Unknow command". Whats wrong here?

Код:
dcmd_getstats(playerid, params[])
{

	new ReturnPlayer, ReturnUserName[24], PlayerFile[50], str[128], pDeaths[50], pKills[50];
	if(sscanf(params, "d", ReturnPlayer)) return SendClientMessage(playerid, mwhite, "Usage: /getstats [playerid]");

	GetPlayerName(ReturnPlayer, ReturnUserName, sizeof(ReturnUserName));
 	format(ReturnUserName, sizeof(ReturnUserName), "/users/%s.ini", ReturnUserName);

//	if(ReturnPlayer==playerid) return SendClientMessage(playerid, mbrightred, "Use /mystats to see your own stats.");
	if(!IsPlayerConnected(ReturnPlayer)) return SendClientMessage(playerid, mbrightred, "Invalid player ID.");
	if(!dini_Exists(PlayerFile)) return SendClientMessage(playerid, mbrightred, "This player is an unregistered player.");

	if(dini_Exists(PlayerFile))
	{
	   	pDeaths[24] = dini_Int(PlayerFile, "Deaths");
	   	pKills[24] = dini_Int(PlayerFile, "Kills");
	   	new Float:Ratio=floatdiv(pKills[24], pDeaths[24]);
		format(str, sizeof(str), "%s has died %d times and killed somebody %d times. That makes his/her ratio %.2f .", ReturnUserName, pDeaths[24], pKills[24], Ratio);
		SendClientMessage(playerid, mwhite, str);

		if(PlayerInfo[ReturnPlayer][AdminLevel] == 0)
		{
			format(str, sizeof(str), "%s is a player on the server.", ReturnUserName);
			SendClientMessage(playerid, mwhite, str);
		}

		if(PlayerInfo[ReturnPlayer][AdminLevel] > 0)
		{
			format(str, sizeof(str), "%s is a crewmember on the server.", ReturnUserName);
			SendClientMessage(playerid, mwhite, str);
		}
	}
	return 1;
}
ty


Re: HELP: Command says "Unknow command" ?? - willsuckformoney - 17.07.2010

do you has the

pawn Код:
dcmd(getstats, 8, cmdtext)



Re: HELP: Command says "Unknow command" ?? - bartje01 - 17.07.2010

Yup. He has the getstats.
But I think you need this:
not sure:
ReturnUser = strval(params)
top of command