SA-MP Forums Archive
Commands problem. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Commands problem. (/showthread.php?tid=599616)



Commands problem. - KnowNN - 28.01.2016

Hi, I using LIFE-CMD, I added in my gamemode 2-3 commands, working, but server says "SERVER: Unknown command.".
1. I put commands at gm finish.
2. I put "return 1;" at each command.
3. I try with another command processor but only time, the same problem.

So, what is the problem?
Example of command of my gamemode:
Код:
CMD:jobs(playerid, params[])
{
    new string[100];
    strcat(string, "Trucker\t$$$\n");
    ShowPlayerDialog(playerid, DIALOG_JOBS, DIALOG_STYLE_LIST, "Jobs", string, "Select", "Exit");

    return 1;
}



Re: Commands problem. - Lucky13 - 28.01.2016

If you have ZCMD, add anywhere this in your script:

Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    return 1;
}



Re: Commands problem. - Weponz - 28.01.2016

Both the script and I are asking "what is string" ?


Re: Commands problem. - KnowNN - 28.01.2016

@Lucky13 I tried this, not working.
@Weaponz What do you mean?

I haven't errors/warnings.


Re: Commands problem. - Lucky13 - 28.01.2016

Well Weaponz is right. strcat is to combine 2 string together. And your defined new string[100]; is simply empty.

Maybe make it like this?

Код:
CMD:jobs(playerid, params[])
{
    ShowPlayerDialog(playerid, DIALOG_JOBS, DIALOG_STYLE_LIST, "Jobs", "Trucker\t$$$\n", "Select", "Exit");
    return 1;
}



Re: Commands problem. - KnowNN - 28.01.2016

Quote:
Originally Posted by Lucky13
Посмотреть сообщение
If you have ZCMD, add anywhere this in your script:

Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    return 1;
}
Quote:
Originally Posted by Weponz
Посмотреть сообщение
Both the script and I are asking "what is string" ?
Quote:
Originally Posted by Lucky13
Посмотреть сообщение
Well Weaponz is right. strcat is to combine 2 string together. And your defined new string[100]; is simply empty.

Maybe make it like this?

Код:
CMD:jobs(playerid, params[])
{
    ShowPlayerDialog(playerid, DIALOG_JOBS, DIALOG_STYLE_LIST, "Jobs", "Trucker\t$$$\n", "Select", "Exit");
    return 1;
}
I posted an example of command, all commands not working.
# I try and this, same thing ...

http://www.girlshare.ro/3489208028.9 - This is my gamemode.


Re: Commands problem. - Lucky13 - 28.01.2016

Maybe if you add this anywhere in your script it will work?

Код:
public OnPlayerCommandFinish(playerid, cmdtext[], success) 
{ 
    //playerid - ID Player | cmdtext - You Command | success - returns true or false, that is, whether there is a command or not 
    return true; 
}
Took it from LIFE-CMD.


Re: Commands problem. - KnowNN - 28.01.2016

Quote:
Originally Posted by Lucky13
Посмотреть сообщение
Maybe if you add this anywhere in your script it will work?

Код:
public OnPlayerCommandFinish(playerid, cmdtext[], success) 
{ 
    //playerid - ID Player | cmdtext - You Command | success - returns true or false, that is, whether there is a command or not 
    return true; 
}
Took it from LIFE-CMD.
This is added in gamemode.


Re: Commands problem. - Lucky13 - 28.01.2016

So your command works, just that at the end appears: Server: Unknown Command?


Re: Commands problem. - KnowNN - 28.01.2016

Quote:
Originally Posted by Lucky13
Посмотреть сообщение
So your command works, just that at the end appears: Server: Unknown Command?
Yes.

Thanks for help, but I found the solution, I forgot to make "return 1;" at public "OnPlayerCommandText", sorry for my mistake.

Thnaks Lucky13 because you want to help me.