Commands, some small help ...
#1

Hi all!

I do some areas for block commands in gang teritories. But i have problem with commands.

I make this:
Код:
public OnPlayerCommandReceived( playerid, cmdtext[ ] )
{
if ( IsPlayerInAnyDynamicArea( playerid ) )
	{
	    if ( !strcmp( cmdtext, "/god", true ) ||
			 !strcmp( cmdtext, "/goto", true ) ||
			 !strcmp( cmdtext, "/car", true ) ||
			 !strcmp( cmdtext, "/v", true ) ||
			 !strcmp( cmdtext, "/get", true ) ||
			 !strcmp( cmdtext, "/arme", true ) ||
			 !strcmp( cmdtext, "/s", true ) ||
			 !strcmp( cmdtext, "/l", true ) ||
			 !strcmp( cmdtext, "/wgm", true ) ||
			 !strcmp( cmdtext, "/rw", true ) ||
			 !strcmp( cmdtext, "/ww", true ) ||
			 !strcmp( cmdtext, "/lweaps", true ) )
		return 0;
	}
return 1;
}
Ok, if i type for exemple: /ww, the command won't execute, but if I use /ww(Space) the command will execute ... what can i do? I use ZCMD ...
Reply
#2

Oh my. Youre using strcmp to make ZCMD based commands ?
Reply
#3

Just i want to know, how can i block if the player type /ww(Space)(Space) command, or others that i typed on that function!
Reply
#4

I don't understand what you telling.. I think you want to make commands like /givecash spacebar (id) spacebar (amount)

Here is an example
Код:
dcmd_givecash(playerid,params[])
{
	new string[128];
	new ID, amount;
    if(sscanf(params, "ui", ID, amount))
	SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Money Given_]]");
	format(string,sizeof(string),"You have given $%d of your own money to %s(%d).",amount,PlayerName(ID),ID);
	SendClientMessage(playerid,COLOR_YELLOW,string);
	GivePlayerMoney(playerid,-amount);

	SendClientMessage(ID,COLOR_DEADCONNECT,"[[_Money Received_]]");
	format(string,sizeof(string),"You have been given $%d by %s(%d). Make sure you thank them.",amount,PlayerName(playerid),playerid);
	SendClientMessage(ID,COLOR_YELLOW,string);
	GivePlayerMoney(ID,amount);

	format(string,sizeof(string),"2[CASH GIVEN] %s(%d) has given $%d to %s(%d).",PlayerName(playerid),playerid,amount,PlayerName(ID),ID);
	IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
	return 1;
}
Reply
#5

maybe don't use strcmp D:

i will write something. i don't know if it will work
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(success) // this check if the command is right.
    {
        if(IsPlayerInAnyDynamicArea(playerid)) return 0; // if player in any dynamic area , the command fail
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by MichaelProPlayer
Посмотреть сообщение
I don't understand what you telling.. I think you want to make commands like /givecash spacebar (id) spacebar (amount)

Here is an example
Код:
dcmd_givecash(playerid,params[])
{
	new string[128];
	new ID, amount;
    if(sscanf(params, "ui", ID, amount))
	SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Money Given_]]");
	format(string,sizeof(string),"You have given $%d of your own money to %s(%d).",amount,PlayerName(ID),ID);
	SendClientMessage(playerid,COLOR_YELLOW,string);
	GivePlayerMoney(playerid,-amount);

	SendClientMessage(ID,COLOR_DEADCONNECT,"[[_Money Received_]]");
	format(string,sizeof(string),"You have been given $%d by %s(%d). Make sure you thank them.",amount,PlayerName(playerid),playerid);
	SendClientMessage(ID,COLOR_YELLOW,string);
	GivePlayerMoney(ID,amount);

	format(string,sizeof(string),"2[CASH GIVEN] %s(%d) has given $%d to %s(%d).",PlayerName(playerid),playerid,amount,PlayerName(ID),ID);
	IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
	return 1;
}
no. he wants to prevent players to write commands while they are in some Dynamic Areas.
Reply
#7

Quote:
Originally Posted by kirollos
Посмотреть сообщение
maybe don't use strcmp D:

i will write something. i don't know if it will work
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(success) // this check if the command is right.
    {
        if(IsPlayerInAnyDynamicArea(playerid)) return 0; // if player in any dynamic area , the command fail
    }
    return 1;
}
Yes, but i don't want to be allowed that commands ... .

The commands don't execute if i type /vw and i am in a dynamic area for exemple ... but if i type /vw(Space) the command will execute ... and this think i don't want
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)