SA-MP Forums Archive
rCmd - Unknown 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)
+--- Thread: rCmd - Unknown command (/showthread.php?tid=344521)



rCmd - Unknown command - miokie - 21.05.2012

I'm having some problems with rCmd, No commands are executing what-so-ever and im getting the '* Unknown Command' message. I'm using this on a near to blank gamemode with no filterscripts. I have no errors either and I downloaded the includes 3 days ago so I know they are up to date.

Heres the relative code with a basic command that doesn't work:
pawn Код:
#include <a_samp>
#include <dini>
#include <DynamicParams>
#include <rCmd>

forward OnPlayerCommandReceived(playerid, cmdtext[]);
forward OnPlayerCommandPerformed(playerid, cmdtext[], success);

rCmd[]->kill(playerid)
{
    SetPlayerHealth(playerid,0.0);
    return 1;
}

public OnPlayerCommandReceived(playerid, cmdtext[])
{
    return 1;
}

public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success)
    {
        return SendClientMessage(playerid, 0xFF0000FF, "* Unknown Command");
    }
    return 1;
}
Any ideas?


Re: rCmd - Unknown command - Xaviour212 - 21.05.2012

Maybe dont use (!succes) in the OnPlayerCommandPerformed

CMIIW


Re: rCmd - Unknown command - miokie - 21.05.2012

Quote:
Originally Posted by Xaviour212
Посмотреть сообщение
Maybe dont use (!succes) in the OnPlayerCommandPerformed

CMIIW
I just tried that, still doesn't work, it just doesn't show a Command error if I take away the Success part.


Re: rCmd - Unknown command - miokie - 21.05.2012

Sly bump after almost 4 hours... Really need some help with this as it's pretty much stopping my progress overall with my gamemode...


Re: rCmd - Unknown command - RyDeR` - 21.05.2012

pawn Код:
#include <a_samp>
//#include <dini>
#include "DynamicParams.inc"
#include "rCmd.inc"

forward OnPlayerCommandReceived(playerid, cmdtext[]);
forward OnPlayerCommandPerformed(playerid, cmdtext[], success);

rCmd[]->kill(playerid)
{
    SetPlayerHealth(playerid,0.0);
    return 1;
}

public OnPlayerCommandReceived(playerid, cmdtext[])
{
    return 1;
}

public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success)
    {
        return SendClientMessage(playerid, 0xFF0000FF, "* Unknown Command");
    }
    return 1;
}

main() {
    AddPlayerClass(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
Fine here.


Re: rCmd - Unknown command - ViniBorn - 21.05.2012

You deleted OnPlayerCommandText?


Re: rCmd - Unknown command - miokie - 21.05.2012

Hmm, I pasted your code into a completely blank pwn document and the command worked.
I've just slowly searched through my whole gamemode commenting out parts until the no parameter commands (/kill and /time for example) worked (Got the gm down to literilly just what you posted above) and made my way through uncommenting everything checking if they still worked each time. And all I have left is the commands commented except /kill and /time. They work, but if I go in game and write an unrecongnised command, they would no longer work either. If I uncomment anymore commands such as /Say for example that command wont work, yet still letting me use those 2 non parameter commands. Just for reference, here's my /say command.
pawn Код:
rCmd[s]->say(playerid,success,text[])
{
    new resStr[128];
    if(!success) return SendClientMessage(playerid,COLOUR_WHITE,"* Usage: /Say [Text]");
    format(resStr,128,"%s says %s",PlayerName(playerid),text);
    ProxDetector(5.0, playerid, resStr,COLOR_GRAD1,COLOR_GRAD2,COLOR_GRAD3,COLOR_GRAD4,COLOR_GRAD5);
    return 1;
}
Any advice?

Edit: To the post above, yes.