SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 25/01/2012, 11:32 AM   #1
MasterJoker
Big Clucker
 
MasterJoker's Avatar
 
Join Date: Jan 2012
Location: Joker Place
Posts: 150
Reputation: 5
Default Creating Basic Deathmatch Command (for Stunt Servers)

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!
__________________
Scripting Crazy GaGs!, Current finding a partner GM Tester for my GM

Give me some rep+ if i ever helped you

My Works

Last edited by MasterJoker; 26/01/2012 at 07:55 AM.
MasterJoker is offline   Reply With Quote
Old 25/01/2012, 03:33 PM   #2
sansko
Huge Clucker
 
Join Date: Mar 2010
Location: In a random bathroom. Meaby yours... Hehe
Posts: 262
Reputation: 6
Default Re: Creating Basic Deathmatch Command (for Stunt Servers)

How do i get out?
__________________
GENERATION 27: The first time you see this, copy it into your sig on any forum and add 1 to the
generation. Social experiment.
sansko is offline   Reply With Quote
Old 25/01/2012, 03:37 PM   #3
Max_Coldheart
Banned
 
Join Date: Dec 2011
Location: Finland
Posts: 682
Reputation: 88
Default Re: Creating Basic Deathmatch Command (for Stunt Servers)

Wow, never use a string size of 600, as maximum that can fit in the screen is 128 !
Max_Coldheart is offline   Reply With Quote
Old 26/01/2012, 07:49 AM   #4
MasterJoker
Big Clucker
 
MasterJoker's Avatar
 
Join Date: Jan 2012
Location: Joker Place
Posts: 150
Reputation: 5
Default Re: Creating Basic Deathmatch Command (for Stunt Servers)

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
__________________
Scripting Crazy GaGs!, Current finding a partner GM Tester for my GM

Give me some rep+ if i ever helped you

My Works
MasterJoker is offline   Reply With Quote
Old 27/01/2012, 03:44 PM   #5
mature1990
Little Clucker
 
mature1990's Avatar
 
Join Date: Dec 2011
Posts: 19
Reputation: 0
Default Re: Creating Basic Deathmatch Command (for Stunt Servers)

thanks MasterJoker u helped me find this cmds..
mature1990 is offline   Reply With Quote
Old 27/01/2012, 03:51 PM   #6
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,828
Reputation: 1401
Default Re: Creating Basic Deathmatch Command (for Stunt Servers)

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.
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 28/01/2012, 02:19 AM   #7
MasterJoker
Big Clucker
 
MasterJoker's Avatar
 
Join Date: Jan 2012
Location: Joker Place
Posts: 150
Reputation: 5
Default Re: Creating Basic Deathmatch Command (for Stunt Servers)

Well thats my taste by the way thanks guys
__________________
Scripting Crazy GaGs!, Current finding a partner GM Tester for my GM

Give me some rep+ if i ever helped you

My Works
MasterJoker is offline   Reply With Quote
Old 28/01/2012, 04:20 AM   #8
2KY
Gangsta
 
2KY's Avatar
 
Join Date: Jan 2012
Location: United States
Posts: 949
Reputation: 166
Default Re: Creating Basic Deathmatch Command (for Stunt Servers)

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.
__________________
Check out my wiki page
2KY is offline   Reply With Quote
Old 02/02/2012, 09:41 PM   #9
Rokenzio
Little Clucker
 
Rokenzio's Avatar
 
Join Date: Jan 2012
Posts: 12
Reputation: 0
Default Re: Creating Basic Deathmatch Command (for Stunt Servers)

Thanks for this tut :>
__________________
3ажигаем ! ! !
Rokenzio is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 06:40 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.