SetPlayerColor when player select the class -
PabloDiCostanzo - 16.03.2013
Greetings dudes,
I have for example this class:
pawn Код:
//* Grove Street Spawn
AddPlayerClass(105,2513.9976,-1691.0531,14.0460,49.8205,24,300,31,400,32,100);//0
AddPlayerClass(106,2522.5876,-1679.2454,15.4970,78.9608,24,300,31,400,32,100);//1
AddPlayerClass(107,2523.6533,-1658.8998,15.4935,110.5608,24,300,31,400,32,100);//2
AddPlayerClass(105,2513.5066,-1650.2421,14.3557,133.1210,24,300,31,400,32,100);//3
AddPlayerClass(106,2498.2974,-1642.2606,14.1131,172.9147,24,300,31,400,32,100);//4
AddPlayerClass(107,2486.2468,-1644.8748,14.0772,188.8949,24,300,31,400,32,100);//5
AddPlayerClass(105,2469.4922,-1646.3586,13.7801,181.3748,24,300,31,400,32,100);//6
AddPlayerClass(106,2495.3301,-1690.2500,14.7656,0.0000,24,300,31,400,32,100);//7
AddPlayerClass(107,2459.5049,-1691.0745,13.5446,359.1298,24,300,31,400,32,100);//8
And I want when a user select grove steer class it gets green color. I already tried with a lot of things but I don`t catch it.
If some one can el me, thanks.
Regards,
Pablo.
Re: SetPlayerColor when player select the class - Patrick - 16.03.2013
if you can provide us your team variable and team define of grove i can provide you a code.
this is an example that i always do setting color on my server
pawn Код:
stock SetPlayerToTeamColour(playerid)
{
/**
First you need to have a team variable
example to make a colour to a team
if(TEAM == Grove)
{
SetPlayerColor(playerid, COLOR_GREEN);
}
**/
return 1;
}
and to make a player to teamcolor when player spawn
pawn Код:
public OnPlayerSpawn(playerid)
{ SetPlayerToTeamColour(playerid); return 1;}
Re: SetPlayerColor when player select the class -
mineralo - 16.03.2013
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
switch(GetPlayerSkin(playerid))
{
case 105,106,107:SetPlayerColor(playerid,COLOR_GREEN);
}
return 1;
}
try it
Re: SetPlayerColor when player select the class -
[ABK]Antonio - 16.03.2013
pawn Код:
enum { Grove } //You can add more team names to this enum
new Team[MAX_PLAYERS];
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
switch(classid)
{
case 0..8: { Team[playerid]=Grove; GameTextForPlayer(playerid, "Grove Street", 1000, 5); }
}
return 1;
}
public OnPlayerSpawn(playerid)
{
switch(Team[playerid])
{
case Grove: //Set their color here
}
//If you're setting this server up for like TDM..you can use this here and there will be no teamkill (other than knife)
SetPlayerTeam(playerid, Team[playerid]);
}
Adding onto that slighty modified code that I gave you yesterday.
Re: SetPlayerColor when player select the class -
PabloDiCostanzo - 16.03.2013
Quote:
Originally Posted by pds2012
if you can provide us your team variable and team define of grove i can provide you a code.
this is an example that i always do setting color on my server
pawn Код:
stock SetPlayerToTeamColour(playerid) { /** First you need to have a team variable example to make a colour to a team if(TEAM == Grove) { SetPlayerColor(playerid, COLOR_GREEN } **/ return 1; }
and to make a player to teamcolor when player spawn
pawn Код:
public OnPlayerSpawn(playerid) { SetPlayerToTeamColour(playerid); return 1;}
|
pawn Код:
new Teams [] = {
TEAM_GROVE_STREET
TEAM_VAGOS
TEAM_BALLAS
TEAM_ITALIAN_MAFIA
TEAM_LSPD
TEAM_NATIONAL_GUARD
TEAM_BALLAS
Re: SetPlayerColor when player select the class - Patrick - 16.03.2013
here you go. just fill in the color that you want on
/*Put your color define here*/ i prefer to use enum than arrays so just convert all of your teams that uses that array to the enum that i gave you.
here you go
Compiling
pawn Код:
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
Code
pawn Код:
enum
{
TEAM_GROVE_STREET,
TEAM_VAGOS,
TEAM_BALLAS,
TEAM_ITALIAN_MAFIA,
TEAM_LSPD,
TEAM_NATIONAL_GUARD
}
new pTeam[ MAX_PLAYERS ][ TEAM ];
stock SetPlayerToTeamColour(playerid)
{
if(pTeam[ playerid ][ TEAM_GROVE_STREET ])
return SetPlaColor(playerid, /*your color define here*/);
if(pTeam[ playerid ][ TEAM_VAGOS ])
return SetPlaColor(playerid, /*your color define here*/);
if(pTeam[ playerid ][ TEAM_BALLAS ])
return SetPlaColor(playerid, /*your color define here*/);
if(pTeam[ playerid ][ TEAM_ITALIAN_MAFIA ])
return SetPlaColor(playerid, /*your color define here*/);
if(pTeam[ playerid ][ TEAM_LSPD ])
return SetPlaColor(playerid, /*your color define here*/);
if(pTeam[ playerid ][ TEAM_NATIONAL_GUARD ])
return SetPlaColor(playerid, /*your color define here*/);
return 1;
}
Re: SetPlayerColor when player select the class -
PabloDiCostanzo - 16.03.2013
Thanks for all. I`ll give you +rep when my wait time finish (24 Hours)
-Solved
Re: SetPlayerColor when player select the class -
[ABK]Antonio - 16.03.2013
Quote:
Originally Posted by pds2012
here you go. just fill in the color that you want on /*Put your color define here*/ i prefer to use enum than arrays so just convert all of your teams that uses that array to the enum that i gave you.
here you go
Compiling
pawn Код:
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
Code
pawn Код:
enum { TEAM_GROVE_STREET, TEAM_VAGOS, TEAM_BALLAS, TEAM_ITALIAN_MAFIA, TEAM_LSPD, TEAM_NATIONAL_GUARD } new PTeam[ MAX_PLAYERS ][ TEAM ];
stock SetPlayerToTeamColour(playerid) { if(pTeam[ playerid ][ TEAM_GROVE_STREET ]) return SetPlaColor(playerid, /*your color define here*/); if(pTeam[ playerid ][ TEAM_VAGOS ]) return SetPlaColor(playerid, /*your color define here*/); if(pTeam[ playerid ][ TEAM_BALLAS ]) return SetPlaColor(playerid, /*your color define here*/); if(pTeam[ playerid ][ TEAM_ITALIAN_MAFIA ]) return SetPlaColor(playerid, /*your color define here*/); if(pTeam[ playerid ][ TEAM_LSPD ]) return SetPlaColor(playerid, /*your color define here*/); if(pTeam[ playerid ][ TEAM_NATIONAL_GUARD ]) return SetPlaColor(playerid, /*your color define here*/); return 1; }
|
You got that to compile? Using it?
pawn Код:
enum
{
TEAM_GROVE_STREET,
TEAM_VAGOS,
TEAM_BALLAS,
TEAM_ITALIAN_MAFIA,
TEAM_LSPD,
TEAM_NATIONAL_GUARD
}
new PTeam[ MAX_PLAYERS ];
stock SetPlayerToTeamColour(playerid)
{
switch(PTeam[playerid])
{
case TEAM_GROVE_STREET: SetPlayerColor(playerid, /*your color define here*/);
case TEAM_VAGOS: SetPlayerColor(playerid, /*your color define here*/);
case TEAM_BALLAS: SetPlayerColor(playerid, /*your color define here*/);
case TEAM_ITALIAN_MAFIA: SetPlayerColor(playerid, /*your color define here*/);
case TEAM_LSPD: SetPlayerColor(playerid, /*your color define here*/);
case TEAM_NATIONAL_GUARD: SetPlayerColor(playerid, /*your color define here*/);
}
return 1;
}
Yet again, a slighty modified version of pds2012's code lol
Re: SetPlayerColor when player select the class -
PabloDiCostanzo - 16.03.2013
Sorry but I folow this:
Quote:
Originally Posted by [ABK]Antonio
You got that to compile? Using it?
pawn Код:
enum { TEAM_GROVE_STREET, TEAM_VAGOS, TEAM_BALLAS, TEAM_ITALIAN_MAFIA, TEAM_LSPD, TEAM_NATIONAL_GUARD } new PTeam[ MAX_PLAYERS ];
stock SetPlayerToTeamColour(playerid) { switch(PTeam[playerid]) { case TEAM_GROVE_STREET: SetPlayerColor(playerid, /*your color define here*/); case TEAM_VAGOS: SetPlayerColor(playerid, /*your color define here*/); case TEAM_BALLAS: SetPlayerColor(playerid, /*your color define here*/); case TEAM_ITALIAN_MAFIA: SetPlayerColor(playerid, /*your color define here*/); case TEAM_LSPD: SetPlayerColor(playerid, /*your color define here*/); case TEAM_NATIONAL_GUARD: SetPlayerColor(playerid, /*your color define here*/); } return 1; }
Yet again, a slighty modified version of pds2012's code lol
|
But this doesen`t work. I mean I don`t get anything in the complier I jut get this
Код:
C:\Documents and Settings\Administrador\Escritorio\Gang Wars\gamemodes\GangWars.pwn(1171) : warning 203: symbol is never used: "Team"
Look at this
Anyone can help me?
Re: SetPlayerColor when player select the class -
Dubya - 22.03.2013
Quote:
Originally Posted by pds2012
here you go. just fill in the color that you want on /*Put your color define here*/ i prefer to use enum than arrays so just convert all of your teams that uses that array to the enum that i gave you.
here you go
Compiling
pawn Код:
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
Code
pawn Код:
enum { TEAM_GROVE_STREET, TEAM_VAGOS, TEAM_BALLAS, TEAM_ITALIAN_MAFIA, TEAM_LSPD, TEAM_NATIONAL_GUARD } new pTeam[ MAX_PLAYERS ][ TEAM ];
stock SetPlayerToTeamColour(playerid) { if(pTeam[ playerid ][ TEAM_GROVE_STREET ]) return SetPlaColor(playerid, /*your color define here*/); if(pTeam[ playerid ][ TEAM_VAGOS ]) return SetPlaColor(playerid, /*your color define here*/); if(pTeam[ playerid ][ TEAM_BALLAS ]) return SetPlaColor(playerid, /*your color define here*/); if(pTeam[ playerid ][ TEAM_ITALIAN_MAFIA ]) return SetPlaColor(playerid, /*your color define here*/); if(pTeam[ playerid ][ TEAM_LSPD ]) return SetPlaColor(playerid, /*your color define here*/); if(pTeam[ playerid ][ TEAM_NATIONAL_GUARD ]) return SetPlaColor(playerid, /*your color define here*/); return 1; }
|
Alright well, this code is highly ignorant as you are using MULTIPLE variables to store the team.
There are 6 teams, so use one variable, such as "gTeam" or "Team" and set it to 1,2,3,4,5,6 depending on the class setup, and then on onplayerspawn, if the gTeam is 1, it's that team's color. simple.