Comments (12)
Since YSI 4.0, this function accepts different arguments, and returns different ones:
forward e_COMMAND_ERRORS:OnPlayerCommandPerformed(playerid, cmdtext[], e_COMMAND_ERRORS:success);
//(...)
enum e_COMMAND_ERRORS
{
// The majority of these are even - odd numbers return "1" not "0".
COMMAND_ZERO_RET = 0 , // The command returned 0.
COMMAND_OK = 1 , // Called corectly.
COMMAND_UNDEFINED = 2 , // Command doesn't exist.
COMMAND_DENIED = 3 , // Can't use the command.
COMMAND_HIDDEN = 4 , // Can't use the command don't let them know it exists.
COMMAND_NO_PLAYER = 6 , // Used by a player who shouldn't exist.
COMMAND_DISABLED = 7 , // All commands are disabled for this player.
COMMAND_BAD_PREFIX = 8 , // Used "/" instead of "#", or something similar.
COMMAND_INVALID_INPUT = 10, // Didn't type "/something".
}
from ysi-includes.
I can't get it working, can you give me some example ?
from ysi-includes.
Sure:
public e_COMMAND_ERRORS:OnPlayerCommandPerformed(playerid, cmdtext[], e_COMMAND_ERRORS:success)
{
if (success != COMMAND_OK) {
printf("The command was not successful for player %d", playerid);
return success;
}
return COMMAND_OK;
}
from ysi-includes.
I still can't get it working, where im failing ?
public e_COMMAND_ERRORS:OnPlayerCommandPerformed(playerid, cmdtext[], e_COMMAND_ERRORS:success)
{
if(success == COMMAND_UNDEFINED)
{
new string[128];
format(string, sizeof(string), "{030CDE}[SM] {FF0000}Command %s doesn't exist !", cmdtext);
SendClientMessage(playerid,-1, string);
return success;
}
return COMMAND_OK;
}
Im still getting default sa-mp's "SERVER: Uknown Command!" message ...
from ysi-includes.
Is the "Command %s doesn't exist" sent?
from ysi-includes.
Nope. just default sa-mp uknown command ...
from ysi-includes.
Ok, change success == COMMAND_UNDEFINED
to success != COMMAND_OK
, and return COMMAND_OK
instead of success
.
from ysi-includes.
Nope, still not working ... Still getting sa-mp default one ...
public e_COMMAND_ERRORS:OnPlayerCommandPerformed(playerid, cmdtext[], e_COMMAND_ERRORS:success)
{
if(success != COMMAND_OK)
{
new string[128];
format(string, sizeof(string), "{030CDE}[SM] {FF0000}Command %s doesn't exist !", cmdtext);
SendClientMessage(playerid,-1, string);
return COMMAND_OK;
}
return COMMAND_OK;
}
from ysi-includes.
Ok, the cause might be a little different then - it usually happens when runtime error occurs. If you don't have crashdetect plugin, get it now. Also, it would be helpful if you could paste here your command code.
from ysi-includes.
Yes, i have crashdetect alredy ... It doesn't showing anything.
Example of my cmd
YCMD:testcmd(playerid,params[],help)
{
SendClientMessage(playerid, -1, "Test cmd called and its working ?");
return 1;
}
and it's printing me the "Test cmd called and its working ?" but when i call /testnone (a command that doesn't exist in Gamemode) im getting "SERVER: Unknown command."
And my OnPlayerCommandPerformed is
public e_COMMAND_ERRORS:OnPlayerCommandPerformed(playerid, cmdtext[], e_COMMAND_ERRORS:success)
{
if(success != COMMAND_OK)
{
new string[128];
format(string, sizeof(string), "{030CDE}[SM] {FF0000}Command %s doesn't exist !", cmdtext);
SendClientMessage(playerid,-1, string);
return COMMAND_OK;
}
return COMMAND_OK;
}
Just run this gm and it will give same message ... I think thath there is some bug in YSI ...
https://gist.github.com/m0k1/82f6d8bd6e7e69bee5d1
from ysi-includes.
I don't have time to check that now, but it seems what you need is e_COMMAND_ERRORS:OnPlayerCommandReceived(playerid, cmdtext[], e_COMMAND_ERRORS:success)
, not OnPlayerCommandPerfomed, as the second one is run only when command is... well, performed.
from ysi-includes.
Yeah, that fixed issuse ! Thanks.
btw, on old YSI 3.1 it was working under OnPlayerCommandPerfomed
from ysi-includes.
Related Issues (20)
- va_args stopped working after update HOT 6
- What does callbackfix.amx do? HOT 1
- (error) undefined symbol "Dialog_ShowPlayerNative HOT 2
- Error when using y_commands HOT 1
- Error when updating YSI HOT 2
- Long callback execution detected (hang or performance issue) or DDoS Attack HOT 1
- Issues with using y_iterator HOT 1
- y_inline_timers calling the timer function twice HOT 1
- AMX Size HOT 1
- Can't include y_races
- error complil HOT 1
- Y_Hooks not called with 3.10.11 Compiler and Open.MP HOT 2
- y_functional_funcs.inc(1154) : error 017: undefined symbol "j"
- bcrypt_delete File or function is not found since last YSI Update. HOT 4
- \pawno\include\YSI_Data\y_foreach\y_foreach_entry.inc(137) : fatal error 111: user error: Old <foreach.inc> found - delete it.
- Unable to compile with y_zonenames and y_races
- pawn.cc crashes when i use the last version of ysi includes
- helpp me YSI HOT 1
- Where is the documentation for y_unique ?? quick-start.md is empty file HOT 1
- foreach prob HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ysi-includes.