SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 21/07/2012, 08:54 AM   #1
Devilxz97
Gangsta
 
Devilxz97's Avatar
 
Join Date: Dec 2011
Location: Malaysia
Posts: 763
Reputation: 37
Default How to make DM minigames

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;
Code:
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 Code:
#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; http://wiki.sa-mp.com/wiki/SetPlayerPos
For SetPlayerInterior; http://wiki.sa-mp.com/wiki/SetPlayerInterior
For SetPlayerMapIcon; http://wiki.sa-mp.com/wiki/SetPlayerMapIcon
For IsPlayerInRangeOfPoint; http://wiki.sa-mp.com/wiki/IsPlayerInRangeOfPoint
For Creating Pickups Tutorial; http://forum.sa-mp.com/showthread.php?t=327953

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


- Skype Name: ejam.blacklistcrew -
- Facebook Acc: http://www.facebook.com/DevConnection -

Selling Gamemode [DRIFT/FREEROAM/ROLEPLAY] for $9.99
Devilxz97 is offline   Reply With Quote
Old 21/07/2012, 09:02 AM   #2
Rudy_
Gangsta
 
Rudy_'s Avatar
 
Join Date: Nov 2011
Location: -Sweet Home- Reputation:9999
Posts: 791
Reputation: 122
Default Re: How to make DM minigames

Nice work
Rudy_ is offline   Reply With Quote
Old 21/07/2012, 09:02 AM   #3
newbienoob
High-roller
 
newbienoob's Avatar
 
Join Date: Jan 2012
Location: Follow the moaning coming from your parents' bedroom
Posts: 1,567
Reputation: 231
Default Re: How to make DM minigames

pawn Code:
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 Code:
if(DmMinigames[playerid] == 1)

Btw, don't forget about OnPlayerDeath
pawn Code:
//OnPlayerDeath
DmMinigames[playerid] = 0;
__________________
Do I look like a Scripting Help forum?

Last edited by newbienoob; 21/07/2012 at 09:08 AM. Reason: typo
newbienoob is offline   Reply With Quote
Old 21/07/2012, 09:09 AM   #4
Devilxz97
Gangsta
 
Devilxz97's Avatar
 
Join Date: Dec 2011
Location: Malaysia
Posts: 763
Reputation: 37
Default Re: How to make DM minigames

Quote:
Originally Posted by Rudy_ View Post
Nice work
Thanks

Quote:
Originally Posted by newbienoob View Post
pawn Code:
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 Code:
if(DmMinigames[playerid] == 1)

Btw, don't forget to about OnPlayerDeath
pawn Code:
//OnPlayerDeath
DmMinigames[playerid] = 0;
okay thanks newbie ,
Quote:
Originally Posted by newbienoob View Post
pawn Code:
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 Code:
if(DmMinigames[playerid] == 1)
^> Im sure about it newbienoob , its works

the thread Edit!
__________________


- Skype Name: ejam.blacklistcrew -
- Facebook Acc: http://www.facebook.com/DevConnection -

Selling Gamemode [DRIFT/FREEROAM/ROLEPLAY] for $9.99
Devilxz97 is offline   Reply With Quote
Old 21/07/2012, 09:11 AM   #5
_Jake_
High-roller
 
_Jake_'s Avatar
 
Join Date: Apr 2012
Location: Land of Ooo
Posts: 2,810
Reputation: 296
Default Re: How to make DM minigames

Not bad great for beginners.
__________________
I stopped playing stunt servers long time ago and decided to enter the RolePlay servers and roleplay with it, You would find me playing in P:LA or in any popular servers, edit or not, My roleplay name would be always Ronald_Lacson.


When on UN-RP servers, My username would be always Jake_Hero, If you want to add me on Skype, the ID would be, spencer_

I need a user who can let me use JakAdmin 3.2.2 on their servers, I am glad if someone will let me, It's not that i will steal anything - You're the one who'll upload the Beta Script.
_Jake_ is offline   Reply With Quote
Old 21/07/2012, 09:12 AM   #6
Devilxz97
Gangsta
 
Devilxz97's Avatar
 
Join Date: Dec 2011
Location: Malaysia
Posts: 763
Reputation: 37
Default Re: How to make DM minigames

Quote:
Originally Posted by Romel View Post
Not bad great for beginners.
yes i hope i help a new scripter
__________________


- Skype Name: ejam.blacklistcrew -
- Facebook Acc: http://www.facebook.com/DevConnection -

Selling Gamemode [DRIFT/FREEROAM/ROLEPLAY] for $9.99
Devilxz97 is offline   Reply With Quote
Old 21/07/2012, 10:39 AM   #7
riezman97
Little Clucker
 
Join Date: Nov 2010
Posts: 12
Reputation: 0
Default Re: How to make DM minigames

Nice job :3
riezman97 is offline   Reply With Quote
Old 21/07/2012, 10:42 AM   #8
Devilxz97
Gangsta
 
Devilxz97's Avatar
 
Join Date: Dec 2011
Location: Malaysia
Posts: 763
Reputation: 37
Default Re: How to make DM minigames

lol thanks dude
__________________


- Skype Name: ejam.blacklistcrew -
- Facebook Acc: http://www.facebook.com/DevConnection -

Selling Gamemode [DRIFT/FREEROAM/ROLEPLAY] for $9.99
Devilxz97 is offline   Reply With Quote
Old 21/07/2012, 01:41 PM   #9
[GF]Logic
Gangsta
 
[GF]Logic's Avatar
 
Join Date: Feb 2012
Posts: 517
Reputation: 27
Default Re: How to make DM minigames

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
__________________
Quote:
If you won't Respect my Religion I won't respect your's
[GF]Logic is offline   Reply With Quote
Old 22/07/2012, 12:33 AM   #10
Devilxz97
Gangsta
 
Devilxz97's Avatar
 
Join Date: Dec 2011
Location: Malaysia
Posts: 763
Reputation: 37
Default Re: How to make DM minigames

yea , example; 1 Match 5minutes
__________________


- Skype Name: ejam.blacklistcrew -
- Facebook Acc: http://www.facebook.com/DevConnection -

Selling Gamemode [DRIFT/FREEROAM/ROLEPLAY] for $9.99
Devilxz97 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] [FS] Minigames DutchDominator Filterscripts 66 25/05/2014 02:18 PM
[GameMode] JFS MiniGames v3.0 JonathanFeitosa Lançamentos/Releases 57 14/09/2011 08:21 PM
Minigames? TheNuttyScientist Help Archive 0 13/07/2010 06:18 PM


All times are GMT. The time now is 01:59 PM.


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