[Tutorial] Creating a simple death match mini game
#1

Hey guys i would just want to make this tutorial for the newbies...

ok.. open pawno and start fresh

First we add
pawn Code:
#include <a_samp>
i believe that this is to read your filter script.

pawn Code:
#define FILTERSCRIPT
this allows your server to read this 'as' a filterscript.

pawn Code:
public OnFilterScriptInit()
        {
    print("\n--------------------------------------");
    print(" Death match mini game by yourname");
    print("--------------------------------------\n");

        CreateObject(14671, -3.83, -26.47, 1004.53,   0.00, 0.00, 0.00);
        CreateObject(14671, -3.83, -26.47, 1004.53,   0.00, 0.00, 0.00);
        CreateObject(1561, 4.59, -32.16, 1002.55,   0.00, 0.00, 0.00);
        CreateObject(14671, -3.83, -26.47, 1004.53,   0.00, 0.00, 0.00);
    return 1;
        }
this will print your credits in the console, and also creates a zone for your death match.


pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/minideathmatch", cmdtext, true, 10) == 0)
    {
                SendClientMessage(playerid, 0xFF0000FF, "You have entered the death match arena");
        SetPlayerPos(playerid, -3.16, -6.56, 1002.75,   0.00, 0.00, 0.00);
                GivePlayerWeapon(playerid, 28, 600);//Micro SMG/Uzi
        return 1;
    }
    return 0;
}
Now this is the command, it teleports player to spawn zone of arena, gives player a message and supplies the player with a uzi

Overall it should look like this!
pawn Code:
#include <a_samp>

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Death match mini game by yourname");
    print("--------------------------------------\n");
}
CreateObject(14671, -3.83, -26.47, 1004.53,   0.00, 0.00, 0.00);
CreateObject(14671, -3.83, -26.47, 1004.53,   0.00, 0.00, 0.00);
CreateObject(1561, 4.59, -32.16, 1002.55,   0.00, 0.00, 0.00);
CreateObject(14671, -3.83, -26.47, 1004.53,   0.00, 0.00, 0.00);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/minideathmatch", cmdtext, true, 10) == 0)
    {
                SendClientMessage(playerid, 0xFF0000FF, "You have entered the death match arena");
        SetPlayerPos(playerid, -3.16, -6.56, 1002.75,   0.00, 0.00, 0.00);
                GivePlayerWeapon(playerid, 28, 600);//Micro SMG/Uzi
        return 1;
    }
    return 0;
}
This is very simple!

--------------------------------------------------------------------------------------------

now to make a team, this must be in a Gamemode!!

pawn Code:
#define TEAM_A ( 0 )
#define TEAM_B ( 1 )
add this under
pawn Code:
#include <a_samp>
Well i do not want to go in details of making a Gamemode... this is generally a tutorial for a FS

now put this in your gamemode as it seems that you would need teams

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/minideathmatch", cmdtext, true, 10) == 0)
    {
                SendClientMessage(playerid, 0xFF0000FF, "You have entered the death match arena");
    if ( GetPlayerTeam( TEAM_A ) == GetPlayerTeam( playerid ) )
    {
    SetPlayerPos(playerid, -3.16, -6.56, 1002.75,   0.00, 0.00, 0.00);
    GivePlayerWeapon(playerid, 28, 600);//Micro SMG/Uzi
    }
    else
    if ( GetPlayerTeam( TEAM_B ) == GetPlayerTeam( playerid ) )
    {
    SetPlayerPos(playerid, 2396.20, -1886.59, 17.07,   91.00, 0.00, 191.00);
    GivePlayerWeapon(playerid, 28, 600);//Micro SMG/Uzi
    }
        return 1;
    }
    return 0;
}

Credits to me for all of this, i script this from my mind within 30 minutes including finding spawn zone... i moved a bit slow, i could have done faster

soon enough ill make it more advanced

+rep if you like!
Reply


Messages In This Thread
Creating a simple death match mini game - by Abhishek. - 24.06.2013, 00:46

Forum Jump:


Users browsing this thread: 1 Guest(s)