[Tutorial] How to make DM minigames
#1

How To Make
A Simple DM Minigame's
With Pickups & MapIcon


//#Today im gonna show you how to make a simple DM Minigames in your server.
//# This is my First Tutorial , if i make a mistake tell me and Sorry for my bad English
//#In this Tutorial im using "ZCMD"
>> Firstly, run your server as local host then join it , then go to any buildings that u want and /save infront the buildings door
>> Picture:http://i.imgur.com/4iFGP.png

>> and then goto Document/GTA San Andreas User Files/SAMP then open savedpositions.txt

>> It will be like this;
Код:
AddPlayerClass(0,-1782.5405,572.7006,35.1641,303.5150,0,0,0,0,0,0); //Deathmatch Spawn
AddPlayerClass(models,Float:x,Float:y,Float:z,Float:angle,weapon1,ammo1,weapon2,ammo2,weapon3,ammo3);
//>> You will use this 2 times , on CMD:play and CMD:leave;
>> *Let's get started !*;

pawn Код:
#include a_samp //>> Credits to SA-MP Dev Team;
#include zcmd //>> Credits to Zeex

//>> Top of your Script;
new DmMinigames[MAX_PLAYERS]; //>> Variables;

//>> Creating the Pickups
new DmMinigamesPickups;

public OnGameModeInit()
{
    DmMinigamesPickups = CreatePickup(1254, 22, -1784.4821,576.0916,35.1641, -1); //Create the Pickups..
    return 1;
}

public OnPlayerConnect(playerid)
{
    DmMinigames[playerid] = 0; //>> Remove player from the DM Minigames when Reconnect
    SetPlayerMapIcon(playerid, 12, -1784.4821,576.0916,35.1641, 23, 0, MAPICON_LOCAL); //>> Set a Skull icon on the Radar
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    DmMinigames[playerid] = 0; //>> Remove player from the DM Minigames after Disconnect
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    DmMinigames[playerid] = 0; //>> when you death u will be automatically remove from the Match!
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == DmMinigamesPickups) //>> Checked the Pickups
    {
        GameTextForPlayer(playerid, "| /PLAY | DM Minigame's | COST:$20K |", 4000, 3); //>> if player take the pickups then it will show u some Information about the DM Minigames ..
    }
    return 1;
}

//----------------< The Commands To Start Play DM Minigame's >----------------//
CMD:play(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 2.0, -1784.4821,576.0916,35.1641))
  //if(IsPlayerInRangeOfPoint(playerid, Float:range, Float:x,Float:y,Float:z))
    {
        if(GetPlayerMoney(playerid) <20000)
        return SendClientMessage(playerid, COLOR_RED2, "* You dont have enough money to Play DM Minigame's *");
        //>> if(GetPlayerMoney(playerid) <20000)
        //>> return SendClientMessage(playerid, COLOR_RED2, "* You dont have enough money to Play DM Minigame's *");
        //>> Check if the player dont have enough money
        GivePlayerMoney(playerid, -20000); //>> 20k would be taken if you play DM Minigame, u can change the price if you want..
        SetPlayerPos(playerid, 1302.519897,-1.787510,1001.028259); //>> SetPlayerPos
        SetPlayerInterior(playerid, 18); //>> SetPlayerInterior
        SetPlayerVirtualWorld(playerid, -1); //>> -1 means all of "Virtual World"
        SetPlayerArmour(playerid, 100); //>> will SetPlayerArmour to 100%
        SetPlayerHealth(playerid, 100); //>> will SetPlayerHealth to 100%
        GivePlayerWeapon(playerid, 24, 99999); //>> will give the player weapon ..
        DmMinigames[playerid] = 1; //>> 1 to make u join the DM Minigame's
    }
    return 1;
}

CMD:leave(playerid, params[])
{
    if(DmMinigames[playerid] == 0) //Checking;
    {
        SendClientMessage(playerid,COLOR_RED2,"You are not in Deathmatch Minigames to do that."); //>> Checked if u are not in DM
    }
    else
    {
        DmMinigames[playerid] = 0; //>> 0 - Will remove u from the Match
        SetPlayerPos(playerid, -1784.4821,576.0916,35.1641); //>> SetYourPos Infront of the buildings door's
        SetPlayerInterior(playerid, 0); //>> Will set your interior to Normal
        ResetPlayerWeapons(playerid); //>> Will Reset/Remove your weapon
    }
    return 1;
}

//>> You want to disable other Commands when u was in DM Minigames ?
//>> Okay, Example; how to disable Cmd when in DM match

CMD:v(playerid, params[])
{
    if(DmMinigames[playerid]) return SendClientMessage(playerid, COLOR_RED, "[ERROR]:{FFFFFF}You can't use these {FFFF00}commands {FFFFFF}if you are in {FF0000}DM {FFFF00}Minigames");
    //>> Your code here
    return 1;
}

//>> then it will Disable the Cmd when u was in DM Minigame's Match;

//##*** END OF THE SCRIPT ***##//
//>> When it was done it will be like this;
Picture:http://i.imgur.com/Avhpw.png
//>> Information;
For Interior; http://weedarr.wikidot.com/interior
For Setplayerpos; https://sampwiki.blast.hk/wiki/SetPlayerPos
For SetPlayerInterior; https://sampwiki.blast.hk/wiki/SetPlayerInterior
For SetPlayerMapIcon; https://sampwiki.blast.hk/wiki/SetPlayerMapIcon
For IsPlayerInRangeOfPoint; https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
For Creating Pickups Tutorial; https://sampforum.blast.hk/showthread.php?tid=327953

Credits to
Dev Team : a_samp includes
Zeex : ZCMD Commands Processer
Devilxz : For creating this Tutorial
Reply
#2

Nice work
Reply
#3

pawn Код:
if(DmMinigames[playerid]) return SendClientMessage(playerid, COLOR_RED, "[ERROR]:{FFFFFF}You can't use these {FFFF00}commands {FFFFFF}if you are in {FF0000}DM {FFFF00}Minigames");
You sure about that? I thought it should be like this
pawn Код:
if(DmMinigames[playerid] == 1)
Btw, don't forget about OnPlayerDeath
pawn Код:
//OnPlayerDeath
DmMinigames[playerid] = 0;
Reply
#4

Quote:
Originally Posted by Rudy_
Посмотреть сообщение
Nice work
Thanks

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
pawn Код:
if(DmMinigames[playerid]) return SendClientMessage(playerid, COLOR_RED, "[ERROR]:{FFFFFF}You can't use these {FFFF00}commands {FFFFFF}if you are in {FF0000}DM {FFFF00}Minigames");
You sure about that? I thought it should be like this
pawn Код:
if(DmMinigames[playerid] == 1)
Btw, don't forget to about OnPlayerDeath
pawn Код:
//OnPlayerDeath
DmMinigames[playerid] = 0;
okay thanks newbie ,
Quote:
Originally Posted by newbienoob
Посмотреть сообщение
pawn Код:
if(DmMinigames[playerid]) return SendClientMessage(playerid, COLOR_RED, "[ERROR]:{FFFFFF}You can't use these {FFFF00}commands {FFFFFF}if you are in {FF0000}DM {FFFF00}Minigames");
You sure about that? I thought it should be like this
pawn Код:
if(DmMinigames[playerid] == 1)
^> Im sure about it newbienoob , its works

the thread Edit!
Reply
#5

Not bad great for beginners.
Reply
#6

Quote:
Originally Posted by Romel
Посмотреть сообщение
Not bad great for beginners.
yes i hope i help a new scripter
Reply
#7

Nice job :3
Reply
#8

lol thanks dude
Reply
#9

Okay well i took a look on the code it is not bad good for beginners but next time you can just make a timer to make a certain time for the match like that match will take whole day xD But Not bad not bad at all
Reply
#10

yea , example; 1 Match 5minutes
Reply
#11

That's an awsome job Devil, actually i would love to code some DM missions for a DM script i'm making :P, i'm sure this will help alot of peeps ^.^
Reply
#12

yea , i hope so ,
and thanks HarlemSAMP
Reply
#13

when I enter the mingame and leave the minigame my cars have gone how would I respawn the cars under leave function...
Quote:

YCMD:leave(playerid, params[], help)
{
#pragma unused help
#pragma unused params
if(MinigameDM1[playerid] == 0)
{
SendClientMessage(playerid,COLOR_RED2,"You are not in Deathmatch Minigames to do that.");
}
else
{
MinigameDM1[playerid] = 0;
SetPlayerPos(playerid, 2027.8263,1322.6852,10.8203);
SetPlayerInterior(playerid, 0);
ResetPlayerWeapons(playerid);
}

return 1;

Reply
#14

Nice tut
Reply
#15

this is really good tut for beginners. that trying to learn stuff hope more come soon!!! 10/10 very nice and understanding.
Reply
#16

Quote:
Originally Posted by Pillhead2007
Посмотреть сообщение
when I enter the mingame and leave the minigame my cars have gone how would I respawn the cars under leave function...
lolz ? my car wont respawn when i enter and then leave the minigames .

Quote:
Originally Posted by Jeth
Посмотреть сообщение
Nice tut
thanks Jeth

Quote:
Originally Posted by Simplyfrag
Посмотреть сообщение
this is really good tut for beginners. that trying to learn stuff hope more come soon!!! 10/10 very nice and understanding.
thanks alot
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)