[Tutorial] Creating Basic Deathmatch Command (for Stunt Servers)
#1

Creating Basic Deathmatch Command (for Stunt Servers)
Brought you by Mr.SmileWinky!

Introduction:

Want to create a basic deathmatch command like Stunt Planet system, Xtreme Planet GM?
Well you can this is the right place to create a basic deathmatch

Note: Please read each explanation not just copy-pasting script. or else the result will be showed when you created a tutorial

Step by Step:

First add

pawn Code:
/* Other Includes here */

#include <zcmd>
ZCMD is always recommend and also sscanf because those are fastest command processor ever (thats my taste)
zcmd.inc can be download at Filterscript and Include Section.

pawn Code:
new IsPlayerInDM[MAX_PLAYERS];
when we use this the format is IsPlayerInDM[playerid], this will be used in our command later.
now i'm gonna add the command at the bottom of my script. i put the explanation in each code

pawn Code:
COMMAND:MJDM(playerid, params[])
{
     new string[600],pname[MAX_PLAYER_NAME]; //More High string value more message words can be added. pname[MAX_PLAYER_NAME]; will gonna use by GetPlayerName
     GetPlayerName(playerid, pname, sizeof(pname)); //We will gonna use pname[MAX_PLAYER_NAME]; here.
     if(IsPlayerInDM[playerid] == 1) return SendClientMessage(playerid, MJDM3, "You are already in an deathmatch arena type /leavedm to leave in deathmatch arena"); //Check if player is in dm already if player is in dm the return SendClientMessage will be called
     IsPlayerInDM[playerid] = 1; //will set ISPlayerInDM[playerid] to 1
     format(string, sizeof(string), "%s has goto MasterJoker's Deathmatch Arena, join with him for fun!", pname); //Format String will be used by SendClientMessageToAll. the pname that we define with GetPlayerName last time is used here if you have low string value in new string the message will be cutoff
     SendClientMessageToAll(COLOR_MJDM, string); //Format string above will be sent if you have low string value in new string the message will be cutoff. otherwise this will sent your name saying you enter on MJ's Deathmatch Arena
     SendClientMessage(playerid, COLOR_MJDM2, "You join MasterJoker's Deathmatch Arena, have fun"); //When you type the command this message will be sent
     SetPlayerPosition(playerid, 0, 0, 0); //Example Only no have time to save pos its 10:30PM here
     SetPlayerFacingAngle(playerid, 0); //Example too replace this with your position coordinates.
     return 1;
}

CMD:leavedm(playerid, params[])
{
     new string[600],pname[MAX_PLAYER_NAME]; //More High string value more message words can be added. pname[MAX_PLAYER_NAME]; will gonna use by GetPlayerName
     GetPlayerName(playerid, pname, sizeof(pname)); //We will gonna use pname[MAX_PLAYER_NAME]; here.
     if(IsPlayerInDM[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "You already leave MJ's DM Arena!"); //Checks if player already left MJDM Arena if he is already the return sendclientmessage will be called
     IsPlayerInDM[playerid] = 0; //if the system detect that player are in DM yet the server will set and remove the player in DM
      format(string, sizeof(string), "%s has left MasterJoker's Deathmatch Arena, join with him for fun!", pname); //Format String will be used by SendClientMessageToAll. the pname that we define with GetPlayerName last time is used here if you have low string value in new string the message will be cutoff
     SendClientMessageToAll(COLOR_MJDM, string); //Format string above will be sent if you have low string value in new string the message will be cutoff. otherwise this will sent your name saying you left on MJ's Deathmatch Arena
     SendClientMessage(playerid, COLOR_MJDM2, "You left MasterJoker's Deathmatch Arena, have fun"); //When you type the command this message will be sent
     //Your spawnpoint position code here!
     return 1;
}

//Credits to sansko because i forgot to add /leavedm he reminds me on it look at comment below
I hope i helped

once again brought you by Mr.SmileWinky!
Reply
#2

How do i get out?
Reply
#3

Wow, never use a string size of 600, as maximum that can fit in the screen is 128 !
Reply
#4

Quote:
Originally Posted by sansko
View Post
How do i get out?
ooppss i forgot the leaving command. Thread updated!

Quote:
Originally Posted by CookieJar
View Post
Wow, never use a string size of 600, as maximum that can fit in the screen is 128 !
thats my taste. sorry if you get distruct by my string value

Otherwise thread updated
Reply
#5

thanks MasterJoker u helped me find this cmds..
Reply
#6

Are you serious about string size?
pawn Code:
%s has goto MasterJoker's Deathmatch Arena, join with him for fun!
// Max Player Name lenght is 20
64 is enough and 128 is the max. 600 will cause problems.

Btw: Good tutorial.
Reply
#7

Well thats my taste by the way thanks guys
Reply
#8

Quote:
Originally Posted by MasterJoker
View Post
Well thats my taste by the way thanks guys
Your taste is going to lag your server to hell after like 4 commands.. Jesus christ.
Reply
#9

Thanks for this tut :>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)