SA-MP Forums Archive
[Tutorial] How to make a DM zone - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to make a DM zone (/showthread.php?tid=437593)



How to make a DM zone - Rimmon - 16.05.2013

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



Re: How to make a DM zone - NL-Sultan - 16.05.2013

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


Re: How to make a DM zone - Rimmon - 16.05.2013

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


Re: How to make a DM zone - Alex Magaсa - 16.05.2013

Good Job!