DM Minigames ?
#1

Hi Guys,

Nowadays I have been working on a DM minigame with the weapon Minigun. I have created the mapping but I am having problems while creating /leave command and also disabling commands in DM e.t.c. Can anybody help me with my problems ?

Regards,
Compiler.
Reply
#2

Hello there,

Yeah it's quite simple. Whenever you make a player enter the DM Minigame, just assign a value to the player, e.g

- On top of your script:

Define a global variable (like, Minigun, etc) for each player, such as

Quote:

new Minigun[MAX_PLAYERS];

Reason: This will declare a global variable, which can be used for each player id.


- Setting value to 0 in OnPlayerConnect:


Quote:

Minigun[playerid] = 0;


- Using it in the script:



When you are teleporting a player to the DM Minigame: (means, when you are using the SetPlayerPos function to teleport a player)

Quote:

Minigun[playerid] = 1;

When you are teleporting back a player from the DM Minigame: (means do this in your /leave command)

Quote:

Minigun[playerid] = 0;

- How to prevent the players from using cmds in the DM Minigame

This can be done by two methods:

1. If you're using OnPlayerCommandText, then just simply do this:

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
if(Minigun[playerid] == 1) return SendClientMessage(playerid, -1, "You can't use commands in DM Minigame!");
// your commands here
return 0;
}

2. If you're using the ZCMD include then, you can use it's default (ZCMD) call back known as

Quote:

OnPlayerCommandReceived(playerid, cmdtext[])

>> Ask if you need info about the second method.


- Note: I've used the global variable, as it is much a lot easier than using the function " SetPVarInt ". But if you want to use that instead, I can guide you in that too.




"Sorry about my bad English n if you find this good, don't forget to give me +1. Also, this is my first time, guiding someone!"

Regards, - Noob Programmer Akbaig. (Started programming one year ago)
Reply
#3

Thanks
Reply
#4

Quote:
Originally Posted by Akbaig
Посмотреть сообщение
Hello there,

Yeah it's quite simple. Whenever you make a player enter the DM Minigame, just assign a value to the player, e.g

- On top of your script:

Define a global variable (like, Minigun, etc) for each player, such as



Reason: This will declare a global variable, which can be used for each player id.


- Setting value to 0 in OnPlayerConnect:





- Using it in the script:



When you are teleporting a player to the DM Minigame: (means, when you are using the SetPlayerPos function to teleport a player)



When you are teleporting back a player from the DM Minigame: (means do this in your /leave command)




- How to prevent the players from using cmds in the DM Minigame

This can be done by two methods:

1. If you're using OnPlayerCommandText, then just simply do this:



2. If you're using the ZCMD include then, you can use it's default (ZCMD) call back known as



>> Ask if you need info about the second method.


- Note: I've used the global variable, as it is much a lot easier than using the function " SetPVarInt ". But if you want to use that instead, I can guide you in that too.




"Sorry about my bad English n if you find this good, don't forget to give me +1. Also, this is my first time, guiding someone!"

Regards, - Noob Programmer Akbaig. (Started programming one year ago)
What's up in zcmd?
He could have simply done in zcmd as

Код:
CMD:any(playerid, params[])
{
    if(Minigun[playerid] == 1)
     return SendClientMessage(playerid, -1, "yo in dm event cunt, /leave to use these shit");
   // command continues
 return 1;
}
Reply
#5

Quote:
Originally Posted by Compiler
Посмотреть сообщение
Thanks
No problem!

Quote:
Originally Posted by [ND]xXZeusXx.
Посмотреть сообщение
What's up in zcmd?
He could have simply done in zcmd as

Код:
CMD:any(playerid, params[])
{
    if(Minigun[playerid] == 1)
     return SendClientMessage(playerid, -1, "yo in dm event cunt, /leave to use these shit");
   // command continues
 return 1;
}
It's better to use the ZCMD call back, or otherwise, you will have to put that in every single command!




+1 rep, if you think I've helped, n explained what was needed.
Reply
#6

Guys What is the zcmd formula?
Reply
#7

Formula?
Reply
#8

The way to disable commands in DMs or Races using zcmd.
Reply
#9

Put this under your script with other call backs:

Quote:

public OnPlayerCommandReceived(playerid, cmdtext[])
{
if(Minigun[playerid] == 1) return SendClientMessage(playerid, -1, "You can't use commands in DM Minigame!");
return 1;
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)