[Tutorial] Gamemode Tutorial
#1

Gamemode Tutorial [FIXED]
Introduction:
Hi all today i will show you how to make an a easy gamemode tutorial, for newbies , new scripters


First of all
let's use our Base Include "#include <a_samp>"

pawn Code:
#include <a_samp>
We're done of including the base samp include
Ok now let's define our team's
pawn Code:
#define TEAM_USA 1
#define TEAM_COLOR_USA COLOR_BLUE //Defining the COLOUR Of this team
#define TEAM_ARABE 2
#define TEAM_COLOR_ARABE COLOR_GREEN //Defining the COLOUR OF This team
//Let's define the colours:
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_BLUE 0x0000FFFF
#define COLOR_RED 0xFF0000C7
#define COLOR_GREEN 0x00FF00D0
We have finish this step
Now on the top of the script make this little code:
pawn Code:
new gTeam[MAX_PLAYERS];
Now to the next step
Create this lines:
AddPlayerClass(skinid, x, y. z, z_angle, weapon1 ,weapon1_ammo, weapon2, weapon2_ammo);
Go in game make /save TEAM then go to My documents then Gta san andreas files =>SAMP=>savedpostions.txt
Then copy the coordinates and make it
pawn Code:
public OnGameModeInit()
{
    AddPlayerClass(123,435.6286,2541.2283,19.2019,178.5884,0,0,0,0,0,0); // USA
   
    AddPlayerClass(70,-220.9162,2619.3599,62.7527,186.1895,0,0,0,0,0,0); // ARABE
//////////////////Let's set the name of our gamemode////////////////
SetGameModeText("GameMode V0.1");//you can choose the name you want!!
    return 1;
}
Good we've ended of OnGameModeInit();
Now write this script
pawn Code:
SetPlayerTeamFromClass(playerid, classid)//When you connect is show the skin of the player now we are adding the name when you want to choose a team
{
if(classid == 0)
    {
        gTeam[playerid] = TEAM_ARABE;
        GameTextForPlayer(playerid,"~g~Arabe Team",1000,4);//Arabe GameText
    }

    else if(classid == 1)
    {
        gTeam[playerid] = TEAM_USA;
        GameTextForPlayer(playerid,"~b~United States Of America",1000,4);//USA GameText
    }
     return 1;
}
Good now we will set the colour of our TEAMS
pawn Code:
SetPlayerToTeamColour(playerid)
{
    if(gTeam[playerid] == TEAM_USA)
    {
        SetPlayerColor(playerid,TEAM_COLOR_USA);
    }
    else if(gTeam[playerid] == TEAM_ARABE)
    {
        SetPlayerColor(playerid,TEAM_COLOR_ARABE);
    }
  return 1;
}
Now we've end this step
Moving to the next step
Making a view of the player when you are choosing teams
pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
        SetPlayerPos(playerid,220.3261,1822.9734,7.5368);//The Place postion

    SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);//Camera Look at the player

    SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);//Camera Postiion

    SetPlayerFacingAngle(playerid, 270 );//The Facing Angle

    SetPlayerTeamFromClass(playerid, classid);//It set's the player to the choosing team

   
    return 1;
}
Good we've ended
Go in to the next step
When a player connect we will send him a welcome message
pawn Code:
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid,COLOR_RED,"Welcome to X Server");
SendClientMessage(playerid,COLOR_RED,"Type /rules, to see the server rules");
   return 1;

}
Done this step
Now when the player dies we will send him a message and get -500 $ of him and give the killer +1 score and + 500 $
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{    
        SendDeathMessage(killerid, playerid, reason);
    SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
    SendClientMessage(killerid, COLOR_GREEN, "You got +$500 money and +1 score for killing an enemy!");
    GivePlayerMoney(killerid,500);

    GivePlayerMoney(playerid,-500);
    SendClientMessage(playerid, COLOR_RED, "You lost -$500 money for dieing!, BITCH!");
        SendClientMessage(killerid, COLOR_GREEN,"Stats Saved");

    return 1;
}
Done
we've done our GAMEMODE Tutorial
If there's any error or any request please feel free to post!!
Reply
#2

So. Actually this tut is about how to make teams?
Reply
#3

Yes how to make teams with colours and a basic gm for beginners
And The GameText for each team you want to choose and OnPlayerDeath Functions.....
so it's usefull
Reply
#4

Followed your TUT, problem is, when I connect nothing happens?
Reply
#5

Another copy paste tutorial :S
By the way, something like this does already exist: https://sampwiki.blast.hk/wiki/PAWN_tutorial
Reply
#6

This tutorial is a little odd to say at least(no offense).

You are using TEAM_EUROPE, TEAM_ARABE and TEAM_USA. But according to the SetPlayerTeamFromClass and OnGameModeInit part you are only using 2 teams. And you don't define the TEAM_EUROPE, but you do define TEAM_ARABE, but not the Arabe color. This can be really confusing for people that are learning and if they use this tutorial as it is, it won't work. They will get errors when they compile.

And:
pawn Code:
SendClientMessage(killerid, COLOR_GREEN,"Stats Saved");
Where are those stats suppose to save?

Also you should perhaps loose indentations.
I'm no expert, and you probably mean well and you want to help people, but in my opinion you should at least put some effort in making your tutorial.

Edit: And btw, it's easier for people to read the code if you use [pawn] instead of [code].
Reply
#7

yes it is much better
Reply
#8

If i add SetPlayerTeamFromClass(playerid, classid);//It set's the player to the choosing team

I got

C:\Users\Jarek\Desktop\Lukasza Files\TDM\Untitled.pwn(253) : error 017: undefined symbol "gTeam"
C:\Users\Jarek\Desktop\Lukasza Files\TDM\Untitled.pwn(253) : warning 215: expression has no effect
C:\Users\Jarek\Desktop\Lukasza Files\TDM\Untitled.pwn(253) : error 001: expected token: ";", but found "]"
C:\Users\Jarek\Desktop\Lukasza Files\TDM\Untitled.pwn(253) : error 029: invalid expression, assumed zero
C:\Users\Jarek\Desktop\Lukasza Files\TDM\Untitled.pwn(253) : fatal error 107: too many error messages on one line

Line


gTeam[playerid] = TEAM_EUROPE;
Reply
#9

Can any help me ? UP !
Reply
#10

Quote:
Originally Posted by Kwarde
View Post
Another copy paste tutorial :S
By the way, something like this does already exist: https://sampwiki.blast.hk/wiki/PAWN_tutorial
Seen This many times lol people copy the same tutorial from wiki
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)