SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 15/01/2011, 11:38 AM   #1
XoX
Huge Clucker
 
XoX's Avatar
 
Join Date: Jun 2010
Location: Germany
Posts: 228
Reputation: 0
Default Help with using zcmd

Hey Guys,

i'm a bit confused with using zcmd.

In the description it's said that zcmd uses OnPlayerCommandText().
If i add f.ex
Code:
if(COMMAND:TEST(playerid, params[]) // or CMD:mycommand(playerid, params[])
{
SendClientMessage(playerid, COLOR_RED, "This is a test cmd");
return 1;
}
I get "error 017: undefined symbol "cmd_TEST""

If i change OnPlayerCommandText(playerid,cmdtext[]) to OnPlayerCommandText(playerid,params[]) it says:
"error 025: function heading differs from prototype"

What i'm doing wrong?
__________________
XoX is offline  
Old 15/01/2011, 12:26 PM   #2
Stylock
Huge Clucker
 
Stylock's Avatar
 
Join Date: Dec 2010
Posts: 342
Reputation: 137
Default Re: Help with using zcmd

You can just delete OnPlayerCommandText from your script and add two new callbacks instead.

pawn Code:
/*
this callback is called when someone sends a command.
if you return 0 here, the command won't be performed.
*/

public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if(GetPlayerState(playerid) == PLAYER_STATE_WASTED) //if wasted, can't perform commands
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "Commands are temporary disabled.");
        return 0;
    }
    return 1;
}

/*
this callback gets called after command execution, here if you do
"return 0" the player will see standard "Unknown command" message.
*/

public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(success)
    {
        return 1;
    }
    return 0;
}

//your command is here
CMD:test(playerid, params[])
{
    #pragma unused params
    SendClientMessage(playerid, COLOR_RED, "This is a test cmd");
    return 1;
}
But note that you don't need to add those callbacks, if you don't use them.
Stylock is offline  
Old 15/01/2011, 12:45 PM   #3
XoX
Huge Clucker
 
XoX's Avatar
 
Join Date: Jun 2010
Location: Germany
Posts: 228
Reputation: 0
Default Re: Help with using zcmd

Thank you very much.
__________________
XoX is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Q] ZCMD XePloiT Help Archive 5 30/11/2010 12:26 AM
ZCMD Help [UG]Scripter Help Archive 12 23/11/2010 02:11 AM
ZCMD? DarrenReeder Help Archive 2 11/09/2010 03:48 PM
/me in ZCMD newarvuti Help Archive 6 11/05/2010 04:48 PM
[help] cmd to zcmd whitedragon Help Archive 1 13/03/2010 12:41 PM


All times are GMT. The time now is 06:22 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.