DM Minigames ? -
Compiler - 27.12.2015
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.
Re: DM Minigames ? -
Akbaig - 28.12.2015
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:
- 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:
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)
Re: DM Minigames ? -
Compiler - 28.12.2015
Thanks
Re: DM Minigames ? -
Ritzy2K - 28.12.2015
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;
}
Re: DM Minigames ? -
Akbaig - 28.12.2015
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.
Re: DM Minigames ? -
Compiler - 29.12.2015
Guys What is the zcmd formula?
Re: DM Minigames ? -
Ritzy2K - 29.12.2015
Formula?
Re: DM Minigames ? -
Compiler - 29.12.2015
The way to disable commands in DMs or Races using zcmd.
Re: DM Minigames ? -
Akbaig - 30.12.2015
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;
}
|