SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Scripting Help (https://forum.sa-mp.com/forumdisplay.php?f=12)
-   -   error 004: function "S@@_OnPlayerCommandText" is not implemented (https://forum.sa-mp.com/showthread.php?t=628951)

SH0x 17/02/2017 02:50 PM

error 004: function "S@@_OnPlayerCommandText" is not implemented
 
i get this error when I want ro compile gamemode :

(19972) : error 004: function "S@@_OnPlayerCommandText" is not implemented
(19979) : error 004: function "S@@_OnPlayerCommandText" is not implemented


this is line 19972 and 19979 :
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if( newkeys & KEY_NO )
{
19972: OnPlayerCommandText(playerid, "/lock");
return 0;
}
if(newkeys & KEY_SUBMISSION)
{
if(IsPlayerInAnyVehicle(playerid))
{
19979: OnPlayerCommandText(playerid, "/engine");
return 1;
}
}

Vince 17/02/2017 03:20 PM

Re: error 004: function "S@@_OnPlayerCommandText" is not implemented
 
You shouldn't call a callback like that. Rather you should move the contents of the commands to separate functions and have these functions be called by the command and by the keypress.

SH0x 17/02/2017 03:34 PM

Re: error 004: function "S@@_OnPlayerCommandText" is not implemented
 
Quote:

Originally Posted by Vince (Post 3845556)
You shouldn't call a callback like that. Rather you should move the contents of the commands to separate functions and have these functions be called by the command and by the keypress.

sorry can u give an example for that ?

tekass 05/06/2017 02:03 PM

Re: error 004: function "S@@_OnPlayerCommandText" is not implemented
 
Hi, here is an example of using the OnPlayerCommandText:

Code:

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext,"/lock",true))
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_MSG,"You have to be inside a
vehicle.");
        for(new i=0; i < MAX_PLAYERS; i++)
        {
            if(i == playerid) continue;
            SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,0,1);
        }
        return 1;
    }
    return 0;
}

And for further information you always have the site dedicated to the learning of PAWN:http://wiki.sa-mp.com/wiki/OnPlayerCommandText


All times are GMT. The time now is 03:11 PM.

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