[Plugin] DC_CMD - command engine written in pure ASM
#31

Quote:
Originally Posted by Mister0
Посмотреть сообщение
Have a callback? like OnPlayerCommandReceived or wher I need to put the code from OnPlayerCommandReceived?
Callbacks OnPlayerCommandReceived and OnPlayerCommandPerformed.

OnPlayerCommandReceived:
PHP код:
OnPlayerCommandReceived(playeridcmdtext[]) 
Called before processing the command. It is possible to specify the conditions of the command.
At the same time using the return 1/0 can enable/disable the command.

Example:
PHP код:
public OnPlayerCommandReceived(playeridcmdtext[])
{
    if(
PlayerInfo[playerid][pMute] == 1// if player have a mute (/mute)
    
{
        
SendClientMessage(playerid, -1"You have a mute, wait!");
        return 
0// transmit information for plugin, to not he execute command
    
}
    return 
1// allow command execution

OnPlayerCommandPerformed:
PHP код:
OnPlayerCommandPerformed(playeridcmdtext[], success); 
Called after the command.
Moreover, if 'success = 1' - the team is successful, 'success = 0' - error, 'success = -1' - command not found.
This way you can make independently support for standard commands:
PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if(
success == -1// if command not found
    
{
        return 
OnPlayerCommandText(playeridcmdtext);
    }
    return 
1// allow command execution

Or you can make a report about the nonexistent command:
PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if(
success == -1// if command not found
    
{
        return 
SendClientMessage(playerid, -1"This command not found on the server, please use /help.");
    }
    return 
1;

Taken from the official theme in Russian forum, translated by me.

Latest version plugin v2.8

Link: https://www.dropbox.com/s/3s7kjp5ipn..._v2.8.zip?dl=0
Reply


Messages In This Thread
DC_CMD command engine - by DanielCortez - 22.04.2013, 02:19
Re: DC_CMD - command engine written in pure ASM - by tboysamp - 22.04.2013, 02:40
Re: DC_CMD - command engine written in pure ASM - by Pottus - 22.04.2013, 02:43
Re: DC_CMD - command engine written in pure ASM - by Fredrick - 22.04.2013, 03:00
Re: DC_CMD - command engine written in pure ASM - by Ryan_Obeles - 22.04.2013, 03:13
Re: DC_CMD - command engine written in pure ASM - by Pottus - 22.04.2013, 03:28
Re: DC_CMD - command engine written in pure ASM - by Fredrick - 22.04.2013, 03:56
Re: DC_CMD - command engine written in pure ASM - by Ryan_Obeles - 22.04.2013, 04:03
Re: DC_CMD - command engine written in pure ASM - by Dzines4SAMP - 22.04.2013, 05:45
Re: DC_CMD - command engine written in pure ASM - by greentarch - 22.04.2013, 07:33
Re: DC_CMD - command engine written in pure ASM - by Fredrick - 22.04.2013, 08:29
Re: DC_CMD - command engine written in pure ASM - by steki. - 22.04.2013, 10:29
Re: DC_CMD - command engine written in pure ASM - by Rock - 22.04.2013, 10:40
Re: DC_CMD - command engine written in pure ASM - by ahmad95 - 22.04.2013, 11:05
Re: DC_CMD - command engine written in pure ASM - by DanielCortez - 22.04.2013, 11:53
Re: DC_CMD - command engine written in pure ASM - by Dan.. - 22.04.2013, 12:48
Re: DC_CMD - command engine written in pure ASM - by Fredrick - 22.04.2013, 13:09
Re: DC_CMD - command engine written in pure ASM - by DanielCortez - 22.04.2013, 14:44
Re: DC_CMD - command engine written in pure ASM - by Pottus - 22.04.2013, 15:18
Re: DC_CMD - command engine written in pure ASM - by Scenario - 22.04.2013, 15:32
Re: DC_CMD - command engine written in pure ASM - by Michael@Belgium - 22.04.2013, 17:10
Re: DC_CMD - command engine written in pure ASM - by Dan.. - 22.04.2013, 18:33
Re: DC_CMD - command engine written in pure ASM - by dudaefj - 22.04.2013, 21:56
Re: DC_CMD - command engine written in pure ASM - by Fredrick - 23.04.2013, 10:18
Re : DC_CMD - command engine written in pure ASM - by white_energy - 18.12.2013, 22:59
Re: Re : DC_CMD - command engine written in pure ASM - by Pottus - 18.12.2013, 23:53
Re: Re : DC_CMD - command engine written in pure ASM - by Emmet_ - 19.12.2013, 01:24
Re: DC_CMD - command engine written in pure ASM - by Pottus - 19.12.2013, 01:40
Re: DC_CMD - command engine written in pure ASM - by Gambit26 - 16.08.2015, 22:38
Re: DC_CMD - command engine written in pure ASM - by Mister0 - 20.02.2016, 08:46
Re: DC_CMD - command engine written in pure ASM - by FanHamMer - 26.02.2016, 16:50
Re: DC_CMD - command engine written in pure ASM - by Chaprnks - 28.06.2016, 13:08

Forum Jump:


Users browsing this thread: 1 Guest(s)