[Tutorial] How to make a DM zone
#1

DM Zones

Hello guys , in this tutorial i'm going to show you how to make a DM ( Death match ) zone
It is so simple , you must follow some steps

Step I:
New variable

We must create a new variable who's gonna verify if the player is in a DM or not
pawn Код:
new
     DM [ MAX_PLAYERS ]
;
You must create a variable with [ MAX_PLAYERS ]because it must be a variable for a player not a global variable
Step II:
Making a DM Zone by command
If you wanna to make a DM zone available you must set the variable which we created to 1
pawn Код:
DM [ playerid ] = 1 ;

Ex:
pawn Код:
CMD:gotodm ( playerid , params [ ] )
{
     DM [ playerid ] = 1 ;
     return 1 ;
}
Step III:
Verification
In this step , i'll show you how to verify if the player is in a DM or not
We must use if to verify if the player is in a DM or NOT

pawn Код:
if ( DM [ playerid ] == 1 ) return SendClientMessage ( playerid , -1 , " You can't use this command in a DM " ) ;
With the upper code the script will verify if the player is in a DM
if DM is set to 1 he'll can't use a command , if DM is set to 0 he'll can use the command
What SendClientMessage mean ?
Well , SendClientMessage send a message to player who try to use a command or make a action
SendClientMessage ( playerid , color , message [ ] ) ;

playerid - The player who the message will be send
color - the text color
message - the text who will be sent to a player

Ex:
pawn Код:
CMD:gotodm ( playerid , params [ ] )
{
     if ( DM [ playerid ] == 1 ) return SendClientMessage ( playerid , -1 , " You can't use this command in a DM " ) ;
     else
     {
          SetPlayerPos ( playerid , 0.0 , 0.0 , 0.0 );
     }
     return 1 ;
}
I hope i helped you
If i wrong something reply xD
Sorry for my bad english
Reply
#2

Nicely done, but what's up with all the spaces between the ( & )'s and stuff?
Reply
#3

Quote:
Originally Posted by NL-Sultan
Посмотреть сообщение
Nicely done, but what's up with all the spaces between the ( & )'s and stuff?
That's my style xD
Thanks
Reply
#4

Good Job!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)