18.02.2013, 19:21
Introduction
Hello everyone I have seen many tutorials on how to make DM most of them were simple
so I decided to make my tutorial
In this tutorial you will learn how to make DM and after you die you will respawn at DM
If you asking "What is DM ?" DM is a Deathmatch between every player
Most Freeroam stunt servers using this mini game
OK let's start
You will only need
I will use lightblue color,
you can use anycolor you want ...
Under it add
now we will make random spawns
Now when the player connect we will set him as not in DM
so he wont get bugged
also when the player disconnect
Now we will make respawn's after death when player is in DM
Under public OnPlayerSpawn(playerid)
add
SetPlayerInterior
SetPlayerVirtualWorld
GivePlayerWeapon
Weapons ID
OK lets continue
now we will make the commands to exit/join DM
that's it ...
also a small Tip:
as you in DM you want to disable other commands
here is how to do it
For example I will do it on (/kill) command as everyone know this command
add
on top of your command
like this
hope I helped
please don't complaint if this tutorial is not good
as it my first tutorial
I want to thank Dr.Papper
I learned this from he's work
if there any bug please tell me
Thanks !
Hello everyone I have seen many tutorials on how to make DM most of them were simple
so I decided to make my tutorial
In this tutorial you will learn how to make DM and after you die you will respawn at DM
If you asking "What is DM ?" DM is a Deathmatch between every player
Most Freeroam stunt servers using this mini game
OK let's start
You will only need
pawn Код:
#include <a_samp>
you can use anycolor you want ...
pawn Код:
#define COLOR_LIGHTBLUE 0x33CCFF19//define for lightblue
pawn Код:
new String[256]; // String for messages
new InDM[MAX_PLAYERS]; // We will use it later to tell the script if the player is in DM or not
pawn Код:
new Float:DMSpawns[][4] = { // Random spawns so players won't spawn at the same place
{609.7040,-586.5684,17.2266,256.8267},
{610.3588,-590.8182,17.2266,263.0453},
{616.1186,-591.2390,17.2330,268.1367}
//I will be using 3 you can add more if you want
};
so he wont get bugged
pawn Код:
public OnPlayerConnect(playerid)
{
InDM[playerid] = 0; // This will set the player as not in DM
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
InDM[playerid] = 0; // Makes the player set as not in the DM
return 1;
}
Under public OnPlayerSpawn(playerid)
add
pawn Код:
public OnPlayerSpawn(playerid)
{
if(InDM[playerid] == 1)//This will tell the script to respawn only the players that inside DM
{
SetPlayerInterior(playerid, 0); // We will set the interior to 0 (you can change it to your own DM)
SetPlayerVirtualWorld(playerid, 10); // and we will make the Virtual World in different world, so we wont mix with other players
new rand = random(sizeof(DMSpawns)); // DM Spawn
SetPlayerPos(playerid, DMSpawns[rand][0], DMSpawns[rand][1], DMSpawns[rand][2]);// we will set the player position at DM
SetPlayerFacingAngle(playerid, DMSpawns[rand][3]); // Also facing Angle
//and we will give him weapons, I will give 2 weapons
GivePlayerWeapon(playerid, 24, 1500); // Desert Eagle
GivePlayerWeapon(playerid, 26, 1500); // Sawnoff Shutgun
//you can edit them, or add more weapons
}
return 1;
}
SetPlayerVirtualWorld
GivePlayerWeapon
Weapons ID
OK lets continue
now we will make the commands to exit/join DM
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/dm", cmdtext, true, 4) == 0) //(/dm) command
{
new PlayerName[MAX_PLAYER_NAME];//Player name
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(InDM[playerid] == 0)//if the player is not in DM
{//then
InDM[playerid] = 1; // Now we will set him in DM so he will respawn at DM
SendClientMessage(playerid, COLOR_LIGHTBLUE , "You have joined /dm, to leave type /dm again");//Message to tell him that he joined DM
format(String, sizeof(String), "Server:{FFFFFF}%s(%d) has joined DM(/dm)", PlayerName, playerid);
SendClientMessageToAll(COLOR_LIGHTBLUE, String);//Message to tell everyone that he joined DM
SetPlayerInterior(playerid, 0); // Just like we did before we will set he's interior to 0
SetPlayerVirtualWorld(playerid, 10); // and same here Virtual World to 10
new rand = random(sizeof(DMSpawns)); // DM Spawn
SetPlayerPos(playerid, DMSpawns[rand][0], DMSpawns[rand][1], DMSpawns[rand][2]);// we will set the player position at DM
SetPlayerFacingAngle(playerid, DMSpawns[rand][3]); // Also facing Angle
//and we will give him weapons, I will give 2 weapons
GivePlayerWeapon(playerid, 24, 1500); // Desert Eagle
GivePlayerWeapon(playerid, 26, 1500); // Sawnoff Shutgun
//you can edit them, or add more weapons if you want
}
else {//if the player is already in DM, he will leave
InDM[playerid] = 0; //So now we will set him as not in DM
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have left /dm to join again type /dm");//We will send him a message to tell him that he left
SpawnPlayer(playerid);//We will spawn the player now
SetPlayerHealth(playerid, 100);//set he's health to 100
ResetPlayerWeapons(playerid);// and reset he's weapons
SetPlayerVirtualWorld(playerid, 0);//we will set he's virtual world to 0
SetPlayerInterior(playerid, 0);//also interior to 0
}
return 1;
}
return 0;
}
also a small Tip:
as you in DM you want to disable other commands
here is how to do it
For example I will do it on (/kill) command as everyone know this command
pawn Код:
if (strcmp("/kill", cmdtext, true, 4) == 0) // Kill command
{
SetPlayerHealth(playerid, 0);//we will set he's health to 0
}
return 0;
pawn Код:
if(InDM[playerid] == 0) //to tell if the player is in DM or not
like this
pawn Код:
if (strcmp("/kill", cmdtext, true, 4) == 0) // Kill command
{
if(InDM[playerid] == 0)//if the player is not in DM
{//then
SetPlayerHealth(playerid, 0);//we will set he's health to 0
}//if he's in DM
else return SendClientMessage(playerid, COLOR_RED, "You cannot use this command in DM minigame !");//we will send him a message that he cannot use this command in DM
}
return 0;
}
please don't complaint if this tutorial is not good
as it my first tutorial
I want to thank Dr.Papper
I learned this from he's work
if there any bug please tell me
Thanks !