Command does nothing
#1

Hey guys,

i'm actually making my own gamemode and i don't know why but when i type a commande it does nothing

Example :

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/test", cmdtext, true, 10) == 0)
	{
 	SendClientMessage(playerid, COLOR_LIGHTRED, "Test OK");
		// Do something here
	return 1;
	}
	return 0;
}
Nothing appears

Thanks for your help
Reply
#2

Quote:
Originally Posted by falor
Посмотреть сообщение
Hey guys,

i'm actually making my own gamemode and i don't know why but when i type a commande it does nothing

Example :

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/test", cmdtext, true, 10) == 0)
	{
 	SendClientMessage(playerid, COLOR_LIGHTRED, "Test OK");
		// Do something here
	return 1;
	}
	return 0;
}
Nothing appears

Thanks for your help
Make sure that you are not using the Zcmd Command processor with it. Secondly,

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/help", true))
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: This is the /help command!");
        return 1;
        // Returning 1 informs the server that the command has been processed.
        // OnPlayerCommandText won't be called in other scripts.
    }
    return 0;
    // Returning 0 informs the server that the command hasn't been processed by this script.
    // OnPlayerCommandText will be called in other scripts until one returns 1.
    // If no scripts return 1, the 'SERVER: Unknown Command' message will be shown.
}
Use this command and check if it works. Because this is a good way of making the commands on strcmp. I would suggest you to use Zcmd as it's the FASTEST command processor, but since you are a newbie scripter strcmp is ok for you.

I hope this helps.

-FalconX
Reply
#3

Thanks for your reply

It still doesn't work

And ZCMD is not used
Код:
//#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//#include <zcmd>
I don't understand the source of the problem

((BTW : If i use ZCMD how to use the givemoney for exemple if it isn't /givemoney ? ))
Reply
#4

You've got the include "//#include <zcmd>" that is ZCMD, If you use ZCMD you just have to change the format,

Add me on skype danieldavis95 for further help.
Reply
#5

Quote:
Originally Posted by falor
Посмотреть сообщение
Thanks for your reply

It still doesn't work

And ZCMD is not used
Код:
//#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//#include <zcmd>
I don't understand the source of the problem

((BTW : If i use ZCMD how to use the givemoney for exemple if it isn't /givemoney ? ))
I think there is something which is making problem for your commands, will you mind sharing the OnPlayerCommandText whole callback here

You can use this for giving a player some money:-

pawn Код:
GivePlayerMoney(playerid, 10000); // 10000 is the amount of money.
-FalconX
Reply
#6

Here it is

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/help", true))
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: This is the /help command!");
        return 1;
        // Returning 1 informs the server that the command has been processed.
        // OnPlayerCommandText won't be called in other scripts.
    }
    return 0;
    // Returning 0 informs the server that the command hasn't been processed by this script.
    // OnPlayerCommandText will be called in other scripts until one returns 1.
    // If no scripts return 1, the 'SERVER: Unknown Command' message will be shown.
}
Reply
#7

Solved

Conflict with one of this fs "car tkadmin objects gl_realtime intmenu"
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)