HELP: Command says "Unknow command" ??
#1

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
Reply
#2

do you has the

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)