Team Colors
#1

I need help guys with creating teams colors.I am trying to make a zombie server.I have 2 teams humans and zombies.
Reply
#2

Something like this?
pawn Код:
if(gTeam[playerid] == Team_Humans)
    {
        SetPlayerColor(playerid, White);
    }
    else if(gTeam[playerid] == Team_Zombies)
    {
        SetPlayerColor(playerid, Zombie_Color); //change the Color to your liking
    }
Reply
#3

You can put theses on player spawn or onplayerrequestclass


example

GameTextForPlayer(playerid, "~g~example - ~w~ass-sss", 5000, 5); //game text (better than sendclientmessage
SetPlayerTeam(playerid, TEAM_GROVE); //to set player team
SetPlayerSkin(playerid,105); //to set player skin
SetPlayerColor(playerid,COLOR_GROVES); // the main thing you want (set player color)
GivePlayerWeapon(playerid,22,500); //to give weapon
GivePlayerWeapon(playerid,31,500); // ^
SetPlayerPos(playerid, 2514.8130,-1674.3113,13.7020); //self understandable
SetPlayerFacingAngle(playerid, 66.7092); //self understandable
SetPlayerCameraPos(playerid, 2510.4692,-1671.6757,13.4205); //self understandable
SetPlayerCameraLookAt(playerid, 2514.8130,-1674.3113,13.7020); // self understandable
ApplyAnimation( playerid, "BEACH", "ParkSit_M_loop", 4.1, 1, 1, 1, 1, 1 ); //to apply annimton if you want (note you need switch class or it will not work)


note COLOR_GROVe etc will be defined at the top of script

Код:
#define COLOR_GROVE FF000 // color code
Reply
#4

Use native functions:

AddPlayerClassEx
SetPlayerTeam
GetPlayerTeam
Reply
#5

Garfield I dont get the AddPlayerClassEx and the GetPlayerTeam

This what I have

public OnPlayerSpawn(playerid)
{
// Set a player's team to 4 when they spawn
SetPlayerTeam(playerid, 4);
return 1;
}
new xp[MAX_PLAYERS];
Reply
#6

This is what I use to set Teams colours, edit it to your script.
Код:
#define TEAMA 0
#define TEAMB 1

public OnGameModeInit()
{

AddPlayerClassEx(0, 15, 1979.1917, -1222.0964, 25.1824, 97.3597, 0, 0, 0, 0, 0, 0); //TEAMA

AddPlayerClassEx(1, 14 1979.1917, -1222.0964, 25.1824, 97.3597, 0, 0, 0, 0, 0, 0); //TEAMB

	return 1;
}

forward SetPlayerTeamFromClass(playerid, classid);
   public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}


public SetPlayerTeamFromClass(playerid, classid)

{

if(classid == 0) //TEAM A
    {
        gTeam[playerid] = TEAMA;
      		SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); // position of the player in the class selection
		SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); // Cameraposition
		SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);//Camera Look at position
		SetPlayerFacingAngle(playerid,122.4500); //Facing Angle
		SetPlayerColor(playerid,BLUE); // Teamcolor
		PlayerInfo[playerid][PlayerClass] = TEAMA;

    }
if(classid == 1) //TEAMB
    {
        gTeam[playerid] = TEAMB;
        	SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); // position of the player in the class selection
		SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); // Cameraposition
		SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
		SetPlayerFacingAngle(playerid,122.4500);
		SetPlayerColor(playerid,ORANGE); // Teamcolor
		PlayerInfo[playerid][PlayerClass] = TEAMB;
    }
}
Reply
#7

Quote:
Originally Posted by guitarmandanny
Посмотреть сообщение
This is what I use to set Teams colours, edit it to your script.
Код:
#define TEAMA 0
#define TEAMB 1

public OnGameModeInit()
{

AddPlayerClassEx(0, 15, 1979.1917, -1222.0964, 25.1824, 97.3597, 0, 0, 0, 0, 0, 0); //TEAMA

AddPlayerClassEx(1, 14 1979.1917, -1222.0964, 25.1824, 97.3597, 0, 0, 0, 0, 0, 0); //TEAMB

	return 1;
}

forward SetPlayerTeamFromClass(playerid, classid);
   public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}


public SetPlayerTeamFromClass(playerid, classid)

{

if(classid == 0) //TEAM A
    {
        gTeam[playerid] = TEAMA;
      		SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); // position of the player in the class selection
		SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); // Cameraposition
		SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);//Camera Look at position
		SetPlayerFacingAngle(playerid,122.4500); //Facing Angle
		SetPlayerColor(playerid,BLUE); // Teamcolor
		PlayerInfo[playerid][PlayerClass] = TEAMA;

    }
if(classid == 1) //TEAMB
    {
        gTeam[playerid] = TEAMB;
        	SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); // position of the player in the class selection
		SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); // Cameraposition
		SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
		SetPlayerFacingAngle(playerid,122.4500);
		SetPlayerColor(playerid,ORANGE); // Teamcolor
		PlayerInfo[playerid][PlayerClass] = TEAMB;
    }
}
Don't need use gTeam !


Use native functions
pawn Код:
// Definitions (on top of gamemode)
#define COPS_TEAM           (0)
#define SWAT_TEAM           (1)


// On GameModeInit
AddPlayerClassEx(  COPS_TEAM, SKIN_ID, POS_SPAWN_X, POS_SPAWN_Y, POS_SPAWN_Z, POS_ANGLE,  WEAPON1, WEAPON1_AMMO, WEAPON2, WEAPON2_AMMO, WEAPON3, WEAPON3_AMMO) // Classid 0
AddPlayerClassEx(  SWAT_TEAM, SKIN_ID, POS_SPAWN_X, POS_SPAWN_Y, POS_SPAWN_Z, POS_ANGLE,  WEAPON1, WEAPON1_AMMO, WEAPON2, WEAPON2_AMMO, WEAPON3, WEAPON3_AMMO) // Classid 1
AddPlayerCLassEx( parameters ); // Classid 2... etc..



// On: (OnRequestClass)
switch(classid){
    case 0: SetPlayerTeam(playerid, COPS_TEAM); // Cops team (Classid 0)
    case 1: SetPlayerTeam(playerid, SWAT_TEAM); // Swat Team (classid 1)
}


// shows player team:
switch(GetPlayerTeam(playerid)){
    case COPS_TEAM: SendClientMessage(playerid, -1, "Your team is COPS");
    case SWAT_TEAM: SendClientMessage(playerid, -1, "Your team is Swat");
}
Reply
#8

I got errors for this

// On GameModeInit
AddPlayerClassEx( COPS_TEAM, SKIN_ID, POS_SPAWN_X, POS_SPAWN_Y, POS_SPAWN_Z, POS_ANGLE, WEAPON1, WEAPON1_AMMO, WEAPON2, WEAPON2_AMMO, WEAPON3, WEAPON3_AMMO) // Classid 0
AddPlayerClassEx( SWAT_TEAM, SKIN_ID, POS_SPAWN_X, POS_SPAWN_Y, POS_SPAWN_Z, POS_ANGLE, WEAPON1, WEAPON1_AMMO, WEAPON2, WEAPON2_AMMO, WEAPON3, WEAPON3_AMMO) // Classid 1
AddPlayerCLassEx( parameters ); // Classid 2... etc..



// On: (OnRequestClass)
switch(classid){
case 0: SetPlayerTeam(playerid, COPS_TEAM); // Cops team (Classid 0)
case 1: SetPlayerTeam(playerid, SWAT_TEAM); // Swat Team (classid 1)
}


// shows player team:
switch(GetPlayerTeam(playerid)){
case COPS_TEAM: SendClientMessage(playerid, -1, "Your team is COPS");
case SWAT_TEAM: SendClientMessage(playerid, -1, "Your team is Swat");
Reply
#9

Quote:
Originally Posted by nicholas1
Посмотреть сообщение
I got errors for this

// On GameModeInit
AddPlayerClassEx( COPS_TEAM, SKIN_ID, POS_SPAWN_X, POS_SPAWN_Y, POS_SPAWN_Z, POS_ANGLE, WEAPON1, WEAPON1_AMMO, WEAPON2, WEAPON2_AMMO, WEAPON3, WEAPON3_AMMO) // Classid 0
AddPlayerClassEx( SWAT_TEAM, SKIN_ID, POS_SPAWN_X, POS_SPAWN_Y, POS_SPAWN_Z, POS_ANGLE, WEAPON1, WEAPON1_AMMO, WEAPON2, WEAPON2_AMMO, WEAPON3, WEAPON3_AMMO) // Classid 1
AddPlayerCLassEx( parameters ); // Classid 2... etc..



// On: (OnRequestClass)
switch(classid){
case 0: SetPlayerTeam(playerid, COPS_TEAM); // Cops team (Classid 0)
case 1: SetPlayerTeam(playerid, SWAT_TEAM); // Swat Team (classid 1)
}


// shows player team:
switch(GetPlayerTeam(playerid)){
case COPS_TEAM: SendClientMessage(playerid, -1, "Your team is COPS");
case SWAT_TEAM: SendClientMessage(playerid, -1, "Your team is Swat");
}

This is simply exemple,

pawn Код:
#include a_samp

#define COPS_TEAM           0
#define SWAT_TEAM           1




public OnGameModeInit(){
    AddPlayerClassEx(  COPS_TEAM, 100,      1958.37831343.157215.3746,    0.0,  0, 0, 0, 0, 0, 0); // Classid 0
    AddPlayerClassEx(  SWAT_TEAM, 0  ,      2199.65311393.367810.8203,    0.0,  0, 0, 0, 0, 0, 0); // Classid 1
    return true;
}


public OnPlayerRequestClass(playerid, classid){
    switch(classid){
        case 0: SetPlayerTeam(playerid, COPS_TEAM); // Cops team (Classid 0)
        case 1: SetPlayerTeam(playerid, SWAT_TEAM); // Swat Team (classid 1)
    }
   
   
   
    SetPlayerInterior(playerid,14);
    SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
    SetPlayerFacingAngle(playerid, 270.0);
    SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
    SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
    return true;
}


public OnPlayerSpawn(playerid){

    switch(GetPlayerTeam(playerid)){
        case COPS_TEAM: SendClientMessage(playerid, -1, "Your team is COPS");
        case SWAT_TEAM: SendClientMessage(playerid, -1, "Your team is Swat");
    }
   
    return true;
}
Reply
#10

K I did it I had 2 error's but I found them out I just had to change the cops and swat on this too zombies and humans THANKS GARFIELD AND REST OF YOU
C:\Documents and Settings\Owner\My Documents\GTA - San Andreas\Server\gamemodes\Z#.pwn(210) : error 017: undefined symbol "COPS_TEAM"
C:\Documents and Settings\Owner\My Documents\GTA - San Andreas\Server\gamemodes\Z#.pwn(211) : error 017: undefined symbol "SWAT_TEAM"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)