Teams.
#1

I'm kind of new to scripting and want to edit this current Jefferson TDM Gamemode for my liking, Deleted most of the usless stuff in there, but I've left two teams which from there im gonna work from and build up the script.

If someone can provide me with a code with Teams in different cases, Say like I click "Next" on the class selection and different location for the Camera View & PlayerPosition, with some Gametext displaying the team name and setting to my defined team colors on spawn.

I'd be hugely greatful and I MAY reward you with a small budget of like a dollar or something lol, thanks for helping guys and heres the codes and information.


Код:
#include <a_samp>
#include <YSI\y_ini>
#include <sscanf2>
#include <zcmd>


//Color defines
#define COLOR_GREY          0xAD9797FF
#define COLOR_GREEN         0x58AB54FF
#define COLOR_PURPLE        0x963A99FF
#define COLOR_YELLOW        0xEAFF03FF
#define COLOR_LIGHTBLUE     0x7ED5F2FF
#define COLOR_RED           0xFF0D1DFF
#define COLOR_WHITE         0xFFFFFFFF

//Defines regarding teams
#define TEAM_GROVE 			1
#define TEAM_BALLAS 		2
#define TEAM_GROVE_COLOR 	0x00FF00AA // Bright Green
#define TEAM_BALLAS_COLOR 	0x963A99FF // Blue

//defines regarding all dialogs dialogs


main()
{
	print("\n----------------------------------");
	print(" Jefferson Motel DeathMatch 9.5 by Blunt");
	print("----------------------------------\n");
}

public OnGameModeInit()
{
	SetGameModeText("JM-TDM 9.5");
	ShowNameTags(1);
	SetWorldTime(0);
	DisableInteriorEnterExits();

	//Grove street skins
	AddPlayerClass(105,2194.1116,-1146.9642,1033.7969,279.8350,22,51,32,300,4,1);
	AddPlayerClass(106,2194.1116,-1146.9642,1033.7969,279.8350,22,51,32,300,5,1);
	AddPlayerClass(107,2194.1116,-1146.9642,1033.7969,279.8350,22,51,32,300,1,1);
	AddPlayerClass(102,2194.1116,-1146.9642,1033.7969,279.8350,22,51,32,300,1,1);
	AddPlayerClass(103,2194.1116,-1146.9642,1033.7969,279.8350,22,51,32,300,1,1);
	AddPlayerClass(104,2194.1116,-1146.9642,1033.7969,279.8350,22,51,32,300,1,1);

	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 259.2184,-41.4297,1002.0234);
	SetPlayerFacingAngle(playerid, 89.9766);
	SetPlayerInterior(playerid, 14);
	SetPlayerCameraPos(playerid, 254.9213,-39.8146,1002.0234);
	SetPlayerCameraLookAt(playerid, 259.2184,-41.4297,1002.0234);
	return 1;
}

public OnPlayerConnect(playerid)
{
	//Functions here
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
 	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	return 0;
}
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=281300

Follow that tutorial it can be shortend but its a ideal tutorial for a newbie. PM me for direct help or if you want help as requested my skype is below
Reply
#3

Yeah, I've read it all, but the thing is I need this done quickly as possible, could someone just take the time and help me, I like learning from other peoples scripting methods, I analyse there codes and use there type of scripting in mine.
Reply
#4

You need to declare that after your main() function: gTeam[MAX_PLAYERS];

Now OnPlayerRequestClass(), you will have to setup the two teams.

pawn Код:
OnPlayerRequestClass()
{
    switch(classid) // Switch for the skins
    {  
        case 0..1: // In case that the player is gonna choose the first or second
        {
            gTeam[playerid] = TEAM_GROVE; // Will affect the player to the team 'TEAM_GROVE'
            GameTextForPlayer(playerid, "~g~GROVE ~w~TEAM", 2000, 5); // We show the player the message
        }
        case 2..3: // In case that the player is gonna choose the third or fourth skin
        {
            gTeam[playerid] = TEAM_BALLAS; //  Will affect the player to the team 'TEAM_BALLAS
            GameTextForPlayer(playerid, "~r~BALLAS ~w~TEAM", 2000, 5); // We show the player the message
        }
Now we will be setting the anti-teamkill, and give weapons

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(gTeam[playerid] == TEAM_RED) // If the player team is TEAM_RED
    {
        SetPlayerTeam(playerid, 1); // We set his team to 1 for the script, to be sure that a player of the team 1 cannot kill a player of the team 1
        SetPlayerColor(playerid, COLOR_RED); // We set his color to red
        GivePlayerWeapon(playerid, 5, 1); // We give the player's weapon
        }
    if(gTeam[playerid] == TEAM_GREEN)
   {
            SetPlayerTeam(playerid, 2);      
            SetPlayerColor(playerid, COLOR_GREEN);
            GivePlayerWeapon(playerid, 5, 1);
        }
}
Sorry for my indentation, Tab hasn't got the same function on Firefox, just don't forget to indent your code :P
Reply
#5

I got these errors when compiling.

C:\Users\MIKE\Desktop\Working\gamemodes\JMDM.pwn(2 9) : error 003: declaration of a local variable must appear in a compound block
C:\Users\MIKE\Desktop\Working\gamemodes\JMDM.pwn(5 2) : error 017: undefined symbol "classid"
C:\Users\MIKE\Desktop\Working\gamemodes\JMDM.pwn(5 6) : error 017: undefined symbol "gTeam"
C:\Users\MIKE\Desktop\Working\gamemodes\JMDM.pwn(5 6) : error 017: undefined symbol "playerid"
C:\Users\MIKE\Desktop\Working\gamemodes\JMDM.pwn(5 6) : error 029: invalid expression, assumed zero
C:\Users\MIKE\Desktop\Working\gamemodes\JMDM.pwn(5 6) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)