[Ajuda] Seleзгo de class -
Jason_King - 06.04.2012
Olб galera do samp, depois de muito tempo voltei aqui para pedir ajuda com um problema. Quero fazer algo que se uma equiper jб tiver mais membros que outra, nгo ter como entrar nela, eu jб andei meio caminho, mas nгo consigo terminar. Seguinte:
Eu coloquei no inнcio:
pawn Код:
new MembrosP;
new MembrosB;
Coloquei pra quando o GM fechar
pawn Код:
public OnGameModeExit()
{
MembrosP = 0;
MembrosB = 0;
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
MembrosP --;
MembrosB --;
return 1;
}
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
SetupPlayerForClassSelection(playerid);
SetPlayerTeamFromClass(playerid,classid);
if(classid == 0 || classid == 1) {
GameTextForPlayer(playerid,"~b~PESCADORES ~w~TEAM",1000,5);
if(MembrosP > MembrosB) return SetPlayerHealth(playerid, 0), ForceClassSelection(playerid);
} else if(classid == 2 || classid == 3 || classid == 4 || classid == 5) {
GameTextForPlayer(playerid,"~r~BIKERS ~w~TEAM",1000,5);
if(MembrosB > MembrosP) return SetPlayerHealth(playerid, 0), ForceClassSelection(playerid);
}
return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
SetPlayerToTeamColor(playerid);
if(gTeam[playerid] == TEAM_PESCADORES) {
MembrosP ++;
if(MembrosP > MembrosB) return ForceClassSelection(playerid), SetPlayerHealth(playerid, 0),SendClientMessage(playerid, COLOR_YELLOW, "Escolha outra equipe!");
Objetivo1 = TextDrawCreate(8.0000,140.0000,"Os Bikers estao chegando. Proteja nosso precioso Vortex!");
TextDrawUseBox(Objetivo1, 1);
TextDrawBoxColor(Objetivo1,0x0F0000FF);
TextDrawTextSize(Objetivo1, 228.0000, 122.0000);
TextDrawAlignment(Objetivo1, 1);
TextDrawColor(Objetivo1,0xFAFAFAFF);
TextDrawFont(Objetivo1, 1);
TextDrawSetProportional(Objetivo1, 1);
TextDrawLetterSize(Objetivo1, 0.5099,1.5000);
TextDrawShowForPlayer(playerid, Objetivo1);
SetTimer("Pescador", 7000, false);
}
else if(gTeam[playerid] == TEAM_BIKERS) {
MembrosB ++;
if(MembrosB > MembrosP) return ForceClassSelection(playerid), SetPlayerHealth(playerid, 0), SendClientMessage(playerid, COLOR_YELLOW, "Escolha outra equipe!");
Objetivo2 = TextDrawCreate(8.0000,140.0000,"Roube o Vortex dos inocentes pescadores e o traga para o galpao secreto.");
TextDrawUseBox(Objetivo2, 1);
TextDrawBoxColor(Objetivo2,0x0F0000FF);
TextDrawTextSize(Objetivo2, 201.0000, 122.0000);
TextDrawAlignment(Objetivo2, 1);
TextDrawColor(Objetivo2,0xFAFAFAFF);
TextDrawFont(Objetivo2, 1);
TextDrawSetProportional(Objetivo2, 1);
TextDrawLetterSize(Objetivo2, 0.5099,1.5000);
TextDrawShowForPlayer(playerid, Objetivo2);
SetTimer("Biker", 7000, false);
//SetPlayerWorldBounds(playerid,2444.4185,1687.5696,631.2963,-454.9898);
}
return 1;
}
Ta beleza, checa de boa quando o player escolhe a class e quando spawn, mas quando ele morrer e spawnar de novo, vai novamente setar a variavйl pra "+1".
Como eu arrumo isso?
A partir de agora jб agradeзo!
Re: [Ajuda] Seleзгo de class -
Hiuship - 06.04.2012
PHP код:
public OnPlayerSpawn(playerid)
{
SetPlayerToTeamColor(playerid);
if(PlayerSpawnado[playerid == 1) return 1;
if(gTeam[playerid] == TEAM_PESCADORES) {
MembrosP ++;
if(MembrosP > MembrosB) return ForceClassSelection(playerid), SetPlayerHealth(playerid, 0),SendClientMessage(playerid, COLOR_YELLOW, "Escolha outra equipe!");
Objetivo1 = TextDrawCreate(8.0000,140.0000,"Os Bikers estao chegando. Proteja nosso precioso Vortex!");
TextDrawUseBox(Objetivo1, 1);
TextDrawBoxColor(Objetivo1,0x0F0000FF);
TextDrawTextSize(Objetivo1, 228.0000, 122.0000);
TextDrawAlignment(Objetivo1, 1);
TextDrawColor(Objetivo1,0xFAFAFAFF);
TextDrawFont(Objetivo1, 1);
TextDrawSetProportional(Objetivo1, 1);
TextDrawLetterSize(Objetivo1, 0.5099,1.5000);
TextDrawShowForPlayer(playerid, Objetivo1);
SetTimer("Pescador", 7000, false);
}
else if(gTeam[playerid] == TEAM_BIKERS) {
MembrosB ++;
if(MembrosB > MembrosP) return ForceClassSelection(playerid), SetPlayerHealth(playerid, 0), SendClientMessage(playerid, COLOR_YELLOW, "Escolha outra equipe!");
Objetivo2 = TextDrawCreate(8.0000,140.0000,"Roube o Vortex dos inocentes pescadores e o traga para o galpao secreto.");
TextDrawUseBox(Objetivo2, 1);
TextDrawBoxColor(Objetivo2,0x0F0000FF);
TextDrawTextSize(Objetivo2, 201.0000, 122.0000);
TextDrawAlignment(Objetivo2, 1);
TextDrawColor(Objetivo2,0xFAFAFAFF);
TextDrawFont(Objetivo2, 1);
TextDrawSetProportional(Objetivo2, 1);
TextDrawLetterSize(Objetivo2, 0.5099,1.5000);
TextDrawShowForPlayer(playerid, Objetivo2);
SetTimer("Biker", 7000, false);
//SetPlayerWorldBounds(playerid,2444.4185,1687.5696,631.2963,-454.9898);
}
PlayerSpawnado[playerid] = 1;
return 1;
}
E no topo do gm:
PHP код:
new PlayerSpawnado[MAX_PLAYERS] = 0;
Na public onplayerdisconnect:
PHP код:
PlayerSpawnado[playerid] = 0;
Re: [Ajuda] Seleзгo de class -
Jason_King - 06.04.2012
Estranho, o bug ainda continua.
Eu abro o servidor, entro eu escolho um time soma ++ na variбvel, mas ao morrer soma a variбvel de novo e como a variбvel estб maior que a outra equipe, eu volto novamente para a seleзгo de class.
Nгo estou entendo muito bem o que estб acontecendo.
@Edit
Tipo, eu tambйm assim que abro o servidor, eu escolho a equipe e meu personagem suicida e volta pra seleзгo de class novamente. Ta uma confussгo, to meio confusso.
@Edit 2
Terminei de arrumar. Valeu pelo apoio man.
+Rep