SA-MP Forums Archive
ZCMD command returns some of the string and "Unknown command message". - 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: ZCMD command returns some of the string and "Unknown command message". (/showthread.php?tid=428443)



ZCMD command returns some of the string and "Unknown command message". - total3clipse - 05.04.2013

I am aiming to do a /stats, but when someone uses the command it sends them the first string, but then the Unknown command message underneath it without displaying the the other strings.

Code:
CMD:stats(playerid, params[])
{
 	new Float:HP, Float:ARM;
	GetPlayerHealth(playerid, HP);
	GetPlayerArmour(playerid, ARM);
 	if(p_data[playerid][AdminLevel] == 0)
        {
		new str[128], str1[128];
		format(str, sizeof(str), "Name: %s | Money: %d | Bank Money: %d | Job: %s | VIP Level: %d | Hours: %d |",getName(playerid),p_info[playerid][Money],p_data[playerid][Bank],p_info[playerid][Jobs],p_data[playerid][VIP],p_data[playerid][Hours]);
		SendClientMessage(playerid, -1, str);
		format(str1, sizeof(str1), "Deaths: %d | Kills: %d | Kill Death Ratio: %d | Group: %d | Rank: %d | ",p_data[playerid][deaths],p_data[playerid][kills],p_data[playerid][kills]/p_data[playerid][deaths],p_data[playerid][Group],p_data[playerid][Rank]);
		SendClientMessage(playerid, -1, str1);
	}
 	if(p_data[playerid][AdminLevel] >= 1)
	{
		new str[128], str1[128], str2[128];
		format(str, sizeof(str), "Name: %s | Money: %d | Bank Money: %d | Job: %s | VIP Level: %d | Armour: %.0f | Hours: %d |",getName(playerid),p_info[playerid][Money],p_data[playerid][Bank],p_info[playerid][Jobs],p_data[playerid][VIP], ARM, p_data[playerid][Hours]);
		SendClientMessage(playerid, -1, str);
		format(str1, sizeof(str1), "Admin Level: %d | Admin Actions: %d | Interior Id: %d | Virtual World: %d | Health: %.0f |",p_data[playerid][AdminLevel],p_data[playerid][actions],GetPlayerInterior(playerid),GetPlayerVirtualWorld(playerid),HP);
		SendClientMessage(playerid, -1, str1);
		format(str2, sizeof(str2), "Deaths: %d | Kills: %d | Kill Death Ratio: %d | Group: %d | Rank: %d | Skin: %d |",p_data[playerid][deaths],p_data[playerid][kills],p_data[playerid][kills]/p_data[playerid][deaths],p_data[playerid][Group],p_data[playerid][Rank],GetPlayerSkin(playerid));
		SendClientMessage(playerid, -1, str2);
	}
	return 1;
}
Also, I have placed 'return 1;' at the end of both if they're an admin or if they aren't.

Any help is greatly appreciated.


Re: ZCMD command returns some of the string and "Unknown command message". - Cheesus - 05.04.2013

Yeah same happens to me


Re: ZCMD command returns some of the string and "Unknown command message". - Isolated - 05.04.2013

Try adding
pawn Code:
return 1;
under your different sections.


Re: ZCMD command returns some of the string and "Unknown command message". - total3clipse - 05.04.2013

Quote:
Originally Posted by MikeLovesToHelp
View Post
Try adding
pawn Code:
return 1;
under your different sections.
Already tried that pal and it displays the same message and section of string.


Re: ZCMD command returns some of the string and "Unknown command message". - HurtLocker - 05.04.2013

pawn Code:
CMD:stats(playerid, params[])
{
    new Float:HP, Float:ARM;
    GetPlayerHealth(playerid, HP);
    GetPlayerArmour(playerid, ARM);
    if(p_data[playerid][AdminLevel] == 0)
        {
        new str[128], str1[128];
        format(str, sizeof(str), "Name: %s | Money: %d | Bank Money: %d | Job: %s | VIP Level: %d | Hours: %d |",getName(playerid),p_info[playerid][Money],p_data[playerid][Bank],p_info[playerid][Jobs],p_data[playerid][VIP],p_data[playerid][Hours]);
        SendClientMessage(playerid, -1, str);
        format(str1, sizeof(str1), "Deaths: %d | Kills: %d | Kill Death Ratio: %f | Group: %d | Rank: %d | ",p_data[playerid][deaths],p_data[playerid][kills],float(p_data[playerid][kills])/float(p_data[playerid][deaths]),p_data[playerid][Group],p_data[playerid][Rank]);
        SendClientMessage(playerid, -1, str1);
    }
    else if(p_data[playerid][AdminLevel] >= 1)
    {
        new str[128], str1[128], str2[128];
        format(str, sizeof(str), "Name: %s | Money: %d | Bank Money: %d | Job: %s | VIP Level: %d | Armour: %.0f | Hours: %d |",getName(playerid),p_info[playerid][Money],p_data[playerid][Bank],p_info[playerid][Jobs],p_data[playerid][VIP], ARM, p_data[playerid][Hours]);
        SendClientMessage(playerid, -1, str);
        format(str1, sizeof(str1), "Admin Level: %d | Admin Actions: %d | Interior Id: %d | Virtual World: %d | Health: %.0f |",p_data[playerid][AdminLevel],p_data[playerid][actions],GetPlayerInterior(playerid),GetPlayerVirtualWorld(playerid),HP);
        SendClientMessage(playerid, -1, str1);
        format(str2, sizeof(str2), "Deaths: %d | Kills: %d | Kill Death Ratio: %f | Group: %d | Rank: %d | Skin: %d |",p_data[playerid][deaths],p_data[playerid][kills],float(p_data[playerid][kills])/float(p_data[playerid][deaths]foat),p_data[playerid][Group],p_data[playerid][Rank],GetPlayerSkin(playerid));
        SendClientMessage(playerid, -1, str2);
    }
    return 1;
}
Why do you define armor and life values?


Re: ZCMD command returns some of the string and "Unknown command message". - zT KiNgKoNg - 05.04.2013

Add return true; to both if statements.


Re: ZCMD command returns some of the string and "Unknown command message". - LarzI - 05.04.2013

Why don't you just use else?


Re: ZCMD command returns some of the string and "Unknown command message". - total3clipse - 05.04.2013

Quote:
Originally Posted by HurtLocker
View Post
pawn Code:
CMD:stats(playerid, params[])
{
    new Float:HP, Float:ARM;
    GetPlayerHealth(playerid, HP);
    GetPlayerArmour(playerid, ARM);
    if(p_data[playerid][AdminLevel] == 0)
        {
        new str[128], str1[128];
        format(str, sizeof(str), "Name: %s | Money: %d | Bank Money: %d | Job: %s | VIP Level: %d | Hours: %d |",getName(playerid),p_info[playerid][Money],p_data[playerid][Bank],p_info[playerid][Jobs],p_data[playerid][VIP],p_data[playerid][Hours]);
        SendClientMessage(playerid, -1, str);
        format(str1, sizeof(str1), "Deaths: %d | Kills: %d | Kill Death Ratio: %f | Group: %d | Rank: %d | ",p_data[playerid][deaths],p_data[playerid][kills],float(p_data[playerid][kills])/float(p_data[playerid][deaths]),p_data[playerid][Group],p_data[playerid][Rank]);
        SendClientMessage(playerid, -1, str1);
    }
    else if(p_data[playerid][AdminLevel] >= 1)
    {
        new str[128], str1[128], str2[128];
        format(str, sizeof(str), "Name: %s | Money: %d | Bank Money: %d | Job: %s | VIP Level: %d | Armour: %.0f | Hours: %d |",getName(playerid),p_info[playerid][Money],p_data[playerid][Bank],p_info[playerid][Jobs],p_data[playerid][VIP], ARM, p_data[playerid][Hours]);
        SendClientMessage(playerid, -1, str);
        format(str1, sizeof(str1), "Admin Level: %d | Admin Actions: %d | Interior Id: %d | Virtual World: %d | Health: %.0f |",p_data[playerid][AdminLevel],p_data[playerid][actions],GetPlayerInterior(playerid),GetPlayerVirtualWorld(playerid),HP);
        SendClientMessage(playerid, -1, str1);
        format(str2, sizeof(str2), "Deaths: %d | Kills: %d | Kill Death Ratio: %f | Group: %d | Rank: %d | Skin: %d |",p_data[playerid][deaths],p_data[playerid][kills],float(p_data[playerid][kills])/float(p_data[playerid][deaths]foat),p_data[playerid][Group],p_data[playerid][Rank],GetPlayerSkin(playerid));
        SendClientMessage(playerid, -1, str2);
    }
    return 1;
}
Why do you define armor and life values?
It is the only way it works for me mate.


Re: ZCMD command returns some of the string and "Unknown command message". - total3clipse - 05.04.2013

Quote:
Originally Posted by Ultra-Gaming
View Post
Add return true; to both if statements.
Quote:
Originally Posted by LarzI
View Post
Why don't you just use else?
Nope, both give the same results.


Re: ZCMD command returns some of the string and "Unknown command message". - LarzI - 05.04.2013

Quote:
Originally Posted by total3clipse
View Post
Nope, both give the same results.
Yeah I never said that'd fix anything, it was just a question.