OnPlayerCommandText FR

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 17:08, 5 January 2013
Connor Mead (Talk | contribs)

← Previous diff
Revision as of 12:03, 18 January 2014
Connor Mead (Talk | contribs)

Next diff →
Line 1: Line 1:
-[[Category:Scripting Callbacks_FR]]+{{ScriptingFR}}
 +{{Title}}
 + 
 +{{Description|This callback is called when a player enters a command into the client chat window, e.g. /help.}}
 + 
 +{{ParametersFR|playerid, cmdtext[]}}
 +{{Param|playerid|The ID of the player that executed the command.}}
 +{{Param|cmdtext[]|The command that was executed (including the slash).}}
 + 
 +{{ReturnsFR|'''0''' si aucune commande n'a été exécutée. Sinon '''1'''.}}
 + 
 +<pawn>
 +public OnPlayerCommandText(playerid, cmdtext[])
 +{
 + if(!strcmp(cmdtext, "/help", true))
 + {
 + SendClientMessage(playerid, 0xFFFFFFFF, "SERVEUR: C'est la commande /help !");
 + return 1;
 + // Retourner 1 informe au serveur que la commande a bien été exécutée.
 + // OnPlayerCommandText ne sera pas appelé dans d'autres scripts.
 + }
 + return 0;
 + // Si aucun script ne retourne 1, le message 'SERVER: Unknown Command' sera affiché.
 +}
 +</pawn>
 + 
 +{{RelatedCallbacksFR}}
 +*[OnPlayerText_FR|OnPlayerText]]
 +*[[OnRconCommand_FR|OnRconCommand]]
 + 
 +{{RelatedFunctionsCallback}}
 +{{SendRconCommand}}
 + 
 +[[Category:Scripting Callbacks FR]]

Revision as of 12:03, 18 January 2014




Description:

This callback is called when a player enters a command into the client chat window, e.g. /help.


Paramètres:
(playerid, cmdtext[])
playeridThe ID of the player that executed the command.
cmdtext[]The command that was executed (including the slash).


Retourne:

0 si aucune commande n'a été exécutée. Sinon 1.


public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/help", true))
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "SERVEUR: C'est la commande /help !");
        return 1;
        // Retourner 1 informe au serveur que la commande a bien été exécutée.
        // OnPlayerCommandText ne sera pas appelé dans d'autres scripts.
    }
    return 0;
    // Si aucun script ne retourne 1, le message 'SERVER: Unknown Command' sera affiché.
}

Callback Relatives

Les Callbacks ci dessous sont indirectement ou directement liées à cette Callback.

Related Functions

The following functions might be useful, as they're related to this callback in one way or another.