Samp or scripting bug? -
Roko_foko - 25.07.2012
When I type in game /std it shows me 'SERVER: Unknown command.' message, even though it should print 'Server: That command doesn't exist. For list of commands /commands.'
But, once I rename the command in the script as '/abc' it works fine.
I have also a command that does all same as /std( /selecttextdraw) and it works fine.
pawn Код:
if(!strcmp(cmdtext,"/std",true,4) && !cmdtext[4])
{
CancelSelectTextDraw(playerid);
SelectTextDraw(playerid, COLOR_YELLOW);
return 1;
}
if(!strcmp(cmdtext,"/selecttextdraw",true,15) && !cmdtext[15] )
{
CancelSelectTextDraw(playerid);
SelectTextDraw(playerid, COLOR_YELLOW);
return 1;
}
//...
SendClientMessage(playerid,COLOR_GREEN2,"Server: That command doesn't exist. For list of commands /commands.");
return 1;
Maybe usefull notes:
- this command worked fine for me before 3 weeks. Since then I didn't use it and now found it doesn't work.
- there is not any other command that starts with /std..
- there is no 'return 0' in OnCommandText
- when I putted printf("Hi"); inside /std it didn't show.
- if I type any other commands that doesn't exist it will show "Server: That command doesn't exist. For list of commands /commands.", but if I type /std it shows SERVER: Unknown command".
- Tried, not work:
pawn Код:
if( (!strcmp(cmdtext,"/selecttextdraw",true,15) && !cmdtext[15] ) || (!strcmp(cmdtext,"/std",true,4) && !cmdtext[4]) )
{
CancelSelectTextDraw(playerid);
SelectTextDraw(playerid, COLOR_YELLOW);
return 1;
}
//...
SendClientMessage(playerid,COLOR_GREEN2,"Server: That command doesn't exist. For list of commands /commands.");
return 1;
Re: Samp or scripting bug? -
DeathOnaStick - 25.07.2012
Quote:
Originally Posted by Roko_foko
When I type in game /std it shows me 'SERVER: Unknown command.' message, even though it should print 'Server: That command doesn't exist. For list of commands /commands.'
But, once I rename the command in the script as '/abc' it works fine.
I have also a command that does all same as /std( /selecttextdraw) and it works fine.
pawn Код:
if(!strcmp(cmdtext,"/std",true,4) && !cmdtext[4]) { CancelSelectTextDraw(playerid); SelectTextDraw(playerid, COLOR_YELLOW); return 1; } if(!strcmp(cmdtext,"/selecttextdraw",true,15) && !cmdtext[15] ) { CancelSelectTextDraw(playerid); SelectTextDraw(playerid, COLOR_YELLOW); return 1; } //... SendClientMessage(playerid,COLOR_GREEN2,"Server: That command doesn't exist. For list of commands /commands."); return 1;
Maybe usefull notes:
- this command worked fine for me before 3 weeks. Since then I didn't use it and now found it doesn't work.
- there is not any other command that starts with /std..
- there is no 'return 0' in OnCommandText
- when I putted printf("Hi"); inside /std it didn't show.
|
I think I don't understand your problem completely. So you have this /std command and if you delete it temporally, then the stuff with the commands works?
Re: Samp or scripting bug? -
TheDeath - 25.07.2012
So if you want to show "Server: That command doesn't exist. For list of commands /commands"
Код:
if(!strcmp(cmdtext,"/std",true,4) && !cmdtext[4])
{
CancelSelectTextDraw(playerid);
SelectTextDraw(playerid, COLOR_YELLOW);
return 1;
}
if(!strcmp(cmdtext,"/selecttextdraw",true,15) && !cmdtext[15] )
{
CancelSelectTextDraw(playerid);
SelectTextDraw(playerid, COLOR_YELLOW);
return 1;
}
return SendClientMessage(playerid,COLOR_GREEN2,"Server: That command doesn't exist. For list of commands /commands.");;
I think this might work
Re: Samp or scripting bug? -
Roko_foko - 25.07.2012
Quote:
Originally Posted by DeathOnaStick
I think I don't understand your problem completely. So you have this /std command and if you delete it temporally, then the stuff with the commands works?
|
No, only that command doesn't work. All other commands do.
I can't use that command in game, but other commands I can.
Also, if I rename /std to /abc, I am able to use command /abc.
Quote:
Originally Posted by TheDeath
So if you want to show "Server: That command doesn't exist. For list of commands /commands"
Код:
if(!strcmp(cmdtext,"/std",true,4) && !cmdtext[4])
{
CancelSelectTextDraw(playerid);
SelectTextDraw(playerid, COLOR_YELLOW);
return 1;
}
if(!strcmp(cmdtext,"/selecttextdraw",true,15) && !cmdtext[15] )
{
CancelSelectTextDraw(playerid);
SelectTextDraw(playerid, COLOR_YELLOW);
return 1;
}
return SendClientMessage(playerid,COLOR_GREEN2,"Server: That command doesn't exist. For list of commands /commands.");;
I think this might work
|
This is completly same as I put. If I type any other commands that doesn't exist it will show "Server: That command doesn't exist. For list of commands /commands.", but if I type /std it shows SERVER: Unknown command".
Re: Samp or scripting bug? -
DeathOnaStick - 25.07.2012
Hmm. What is this cmdtext[4] actually for? For me it kinda seems useless but I don't think the problem is going to be fixed by that. But who knows?
Well in my opinion your script should work fine, if it's not that cmdtext-part.
Re: Samp or scripting bug? -
Roko_foko - 25.07.2012
Quote:
Originally Posted by DeathOnaStick
Hmm. What is this cmdtext[4] actually for? For me it kinda seems useless but I don't think the problem is going to be fixed by that. But who knows?
Well in my opinion your script should work fine, if it's not that cmdtext-part.
|
Yea it worked fine before, but now? what the hell.
!cmdtext[4] is same as cmdtext[4]==0 and that is same as cmdtext[4]='\0' ( or cmdtext[4]=EOS, EndOfString).
In this case:
pawn Код:
if(!cmdtext[4]) /*is same as */ if(strlen(cmdtext)==strlen("/std"))
Re: Samp or scripting bug? -
DeathOnaStick - 25.07.2012
Quote:
Originally Posted by Roko_foko
Yea it worked fine before, but now? what the hell.
!cmdtext[4] is same as cmdtext[4]==0 and that is same as cmdtext[4]='\0' ( or cmdtext[4]=EOS, EndOfString).
In this case:
pawn Код:
if(!cmdtext[4]) /*is same as */ if(strlen(cmdtext)==strlen("/std"))
|
Alright I see, shouldn't be a prob here. Possible it has a problem with the name "std", due to the fact that this a
namespace in C++. Probably this is why it does not want to see "std" in your strings. Although this is just an idea.