Command Block - Small Help.
#1

Hi

The problem is, when i am inside Deathmatch arena i can use any command like /sf /lv /sfa but when i type it i want it say you can't do this right now. So only when i quit deathmatch arena i will be able to use this commands. How to do it ?

- Is there any way to do it instead of spamming on each command If(InsideDM bla bla bla ) ?

Tnx
Reply
#2

If you are not using y_commands then yes, you have to "spam" each command with that check.

#e: Though, it might be possible with ZCMD "OnCommandReceived" or something like this, I don't use ZCMD so I'm not certain
Reply
#3

Any example ?
Reply
#4

you can just make a variable named
Код:
indm[MAX_PLAYERS];
and when they enter dm set their
Код:
indm[10]=1; //(i just gave an example as 10 think of it like playerid)
and add in to your /ls /sf commands like
Код:
if(indm[playerid]==1) return SendClientMessage(playerid,-1,"You are in dm bro just leave dm first");
Reply
#5

Have you even read what i say in my first post....
Reply
#6

yes i did but i wrote it because its the only way to do it. if you dont want to use a number for indm try bool. if this is the black way. bool is the blue of it. well if your dm arenas are far from where your actual game is you can set area for them but will not work properly
Reply
#7

I know it's posible but i don't know how....
Reply
#8

as i said you can define areas like if a player between some x to x y to y and z to z area you wil STILL set a variable as
Код:
InArea[playerid]
you cant carry something out of one thing to another thing without a variable. computer is just a machine it cant guess what other element holds it cant do telepathy. but if you really find something like that please pm me about it. i really would like to know because im sure it would be so useful.

also oncommandrecieved in zcmd will require a variable too as it cant guess if you are in dm out of its ass
Reply
#9

in Zcmd it's super easy just add this to the bottom of the script
Ycmd, This wont work, So i suggest using ZCMD

PHP код:
public OnPlayerPerformCommand(playeridcmdtext[], success) {
      if(
InsideDM(playerid) && !strcmp(cmdtext"/leavedm"true)) return SendClientMessage(playeridCOLOR_RED"You can't use commands as you are in a DM!");
      
//change /leavedm to the command you use to leave the dm arena
      
return 1;

Reply
#10

http://forum.sa-mp.com/showpost.php?...44&postcount=9

PHP код:
SetPVarInt(playerid"/sf"1),
SetPVarInt(playerid"/lv"1),
SetPVarInt(playerid"/sfa"1); 
To enable use:
PHP код:
SetPVarInt(playerid"/sf"0),
SetPVarInt(playerid"/lv"0),
SetPVarInt(playerid"/sfa"0); 
Or (preferred and recommended method):
PHP код:
DeletePVar(playerid"/sf"),
DeletePVar(playerid"/lv"),
DeletePVar(playerid"/sfa"); 
Done
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)