SA-MP Forums Archive
The hell is the problem... ? - 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: The hell is the problem... ? (/showthread.php?tid=484719)



The hell is the problem... ? - FailerZ - 01.01.2014

pawn Код:
CMD:stats(playerid, params[])
{
    new targetid;
    if(PlayerInfo[playerid][pLogged] == 0) return Kick(playerid);
    if(sscanf(params, "u", targetid))
    {
        if(!IsPlayerConnected(targetid)) return SCM(playerid, -1,""ERROR_MSG" Player isn't connected.");
        if(PlayerInfo[targetid][pLogged] == 0) return SCM(playerid, -1, ""ERROR_MSG" Player isn't logged in yet.");
       
        new Score = PlayerInfo[targetid][pScore], Cash = PlayerInfo[targetid][pCash], Kills = PlayerInfo[targetid][pKills], Deaths = PlayerInfo[targetid][pDeaths];
        new Admin = PlayerInfo[targetid][pAdmin], tstr[256], str[256];
        format(tstr, sizeof(tstr), "%s[%d] Status", PlayerName(targetid), targetid);
        format(str, sizeof(str), "Score: %d\nCash: %d\nKills: %d\nDeaths: %d\nRatio: %.2f\nAdmin Level: %d", Score, Cash, Kills, Deaths, Kills/Deaths, Admin);
        ShowPlayerDialog(playerid, DIALOG_STATS2, DIALOG_STYLE_MSGBOX, tstr, str, "Close", "");
    }
    new Score = PlayerInfo[playerid][pScore], Cash = PlayerInfo[playerid][pCash], Kills = PlayerInfo[playerid][pKills], Deaths = PlayerInfo[playerid][pDeaths];
    new Admin = PlayerInfo[playerid][pAdmin], tstr[256], str[256];
    format(tstr, sizeof(tstr), "%s[%d] Status", PlayerName(playerid), playerid);
    format(str, sizeof(str), "Score: %d\nCash: %d\nKills: %d\nDeaths: %d\nRatio: %.2f\nAdmin Level: %d", Score, Cash, Kills, Deaths, Kills/Deaths, Admin);
    ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, tstr, str, "Close", "");
    SCM(playerid, -1,""INFO_MSG" You can also use /stats [PlayerID/PartOfName]");
    return 1;
}
Код HTML:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
---------------------------------------------------------------------------------------------------------------
IG:
Код HTML:
[Server] Unknown command, Use /help or /cmds
Here is OnPlayerCommandPerformed
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) return SCM(playerid, -1, ""SERVER_MSG" Unknown command, Use /help or /cmds");
    return 1;
}



Re: The hell is the problem... ? - DaRk_RaiN - 01.01.2014

This is an sscanf problem, happens when the player isn't connected, try this
pawn Код:
CMD:stats(playerid, params[])
{
    new targetid;
    if(PlayerInfo[playerid][pLogged] == 0) return Kick(playerid);
    if(sscanf(params, "u", targetid))
    {
        new Score = PlayerInfo[playerid][pScore], Cash = PlayerInfo[playerid][pCash], Kills = PlayerInfo[playerid][pKills], Deaths = PlayerInfo[playerid][pDeaths];
        new Admin = PlayerInfo[playerid][pAdmin], tstr[256], str[256];
        format(tstr, sizeof(tstr), "%s[%d] Status", PlayerName(playerid), playerid);
        format(str, sizeof(str), "Score: %d\nCash: %d\nKills: %d\nDeaths: %d\nRatio: %.2f\nAdmin Level: %d", Score, Cash, Kills, Deaths, Kills/Deaths, Admin);
        ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, tstr, str, "Close", "");
        SCM(playerid, -1,""INFO_MSG" You can also use /stats [PlayerID/PartOfName]");
        return 1;
    }
    if(!IsPlayerConnected(targetid)) return SCM(playerid, -1,""ERROR_MSG" Player isn't connected.");
    if(PlayerInfo[targetid][pLogged] == 0) return SCM(playerid, -1, ""ERROR_MSG" Player isn't logged in yet.");
    new Score = PlayerInfo[targetid][pScore], Cash = PlayerInfo[targetid][pCash], Kills = PlayerInfo[targetid][pKills], Deaths = PlayerInfo[targetid][pDeaths];
    new Admin = PlayerInfo[targetid][pAdmin], tstr[256], str[256];
    format(tstr, sizeof(tstr), "%s[%d] Status", PlayerName(targetid), targetid);
    format(str, sizeof(str), "Score: %d\nCash: %d\nKills: %d\nDeaths: %d\nRatio: %.2f\nAdmin Level: %d", Score, Cash, Kills, Deaths, Kills/Deaths, Admin);
    ShowPlayerDialog(playerid, DIALOG_STATS2, DIALOG_STYLE_MSGBOX, tstr, str, "Close", "");
    return 1;
}



Re: The hell is the problem... ? - NikO1 - 01.01.2014

What do you mean whats the problem?
Your html code is the compiler and it works so whats the problem.


Re: The hell is the problem... ? - FailerZ - 01.01.2014

Quote:
IG:
Код HTML:
[Server] Unknown command, Use /help or /cmds
Here is OnPlayerCommandPerformed
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) return SCM(playerid, -1, ""SERVER_MSG" Unknown command, Use /help or /cmds");
    return 1;
}
@NikO1 CANT YOU READ ?
-------------------------------------------------------------------------------
@DaRk_RaiN
Doesn't works mate :/
Gives the same message
Код HTML:
[Server] Unknown command, Use /help or /cmds



Re: The hell is the problem... ? - NikO1 - 01.01.2014

public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success) return SCM(playerid, -1, Unknown command, Use /help or /cmds");
return 1;
}

I do not get the problem.


Re: The hell is the problem... ? - FailerZ - 01.01.2014

Quote:
Originally Posted by NikO1
Посмотреть сообщение
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success) return SCM(playerid, -1, Unknown command, Use /help or /cmds");
return 1;
}

I do not get the problem.
-.-
When i type /stats InGame(IG)
Код HTML:
[Server] Unknown command, Use /help or /cmds
I THINK you understand it now..


Re: The hell is the problem... ? - Konstantinos - 01.01.2014

The sscanf was used incorrect.
pawn Код:
CMD:stats(playerid, params[])
{
    if(!PlayerInfo[playerid][pLogged]) return Kick(playerid);
    new targetid;
    if(!sscanf(params, "u", targetid))
    {
        if(!IsPlayerConnected(targetid)) return SCM(playerid, -1,""ERROR_MSG" Player isn't connected.");
        if(!PlayerInfo[targetid][pLogged]) return SCM(playerid, -1, ""ERROR_MSG" Player isn't logged in yet.");
       
        new Score = PlayerInfo[targetid][pScore], Cash = PlayerInfo[targetid][pCash], Kills = PlayerInfo[targetid][pKills], Deaths = PlayerInfo[targetid][pDeaths];
        new Admin = PlayerInfo[targetid][pAdmin], tstr[37], str[256];
        format(tstr, sizeof(tstr), "%s[%d] Status", PlayerName(targetid), targetid);
        format(str, sizeof(str), "Score: %d\nCash: %d\nKills: %d\nDeaths: %d\nRatio: %.2f\nAdmin Level: %d", Score, Cash, Kills, Deaths, Kills/Deaths, Admin);
        ShowPlayerDialog(playerid, DIALOG_STATS2, DIALOG_STYLE_MSGBOX, tstr, str, "Close", "");
    }
    else
    {
        new Score = PlayerInfo[playerid][pScore], Cash = PlayerInfo[playerid][pCash], Kills = PlayerInfo[playerid][pKills], Deaths = PlayerInfo[playerid][pDeaths];
        new Admin = PlayerInfo[playerid][pAdmin], tstr[37], str[256];
        format(tstr, sizeof(tstr), "%s[%d] Status", PlayerName(playerid), playerid);
        format(str, sizeof(str), "Score: %d\nCash: %d\nKills: %d\nDeaths: %d\nRatio: %.2f\nAdmin Level: %d", Score, Cash, Kills, Deaths, Kills/Deaths, Admin);
        ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, tstr, str, "Close", "");
        SCM(playerid, -1,""INFO_MSG" You can also use /stats [PlayerID/PartOfName]");
    }
    return 1;
}
By the way if you use another command processor except ZCMD, then you'll get the "SERVER: Unknown command." message.


Re: The hell is the problem... ? - FailerZ - 01.01.2014

Shows the same MESSAGE :/
I can't understand why..

Here is the includes that i am using, Can anyone help me ?
pawn Код:
//================================ [Includes] ==================================
#include          <a_samp>             //Credits to Kalcor/Kye
#include          <SII>                //Credits to [DRuG]Slick
#include          <sscanf2>            //Credits to ******
#include          <zcmd>               //Credits to Zeex
#include          <KickBan>            //Credits to Emmet_
Any of these may conflict with commands ?? i don't think so..