[AJUDA] Variavel String -
Hunter_Xtreme - 26.06.2012
Pessoal, й o seguinte, eu to querendo criar 3 strings:
-Vencedor1
-Vencedor2
-Vencedor3
Esses sгo de um evento de corrida.
Eles devem comeзar com uma letra qualquer como por exemplo 'a'. (pra servir como comparaзгo)
E Como eu faзo pras variaveis receberem o nome do player
Ex: if(Vencedor1 == 'A') Vencedor1=NomeDoPlayer ----- Ai saberemos quem chegou em primeiro lugar
Ex: if(Vencedor1 != 'A') Vencedor2=NomeDoPlayer ----- Ai saberemos quem chegou em segundo lugar
Ex: if(Vencedor1 != 'A' && Vencedor2 != 'A') Vencedor3=NomeDoPlayer ----- Ai saberemos quem chegou em terceiro lugar
So que eu nao sei como declarar essas variaveis e nem acrescentar o nome do player a elas. me ajudem ae =D
Respuesta: [AJUDA] Variavel String -
zSuYaNw - 26.06.2012
pawn Код:
new Corriada;
// QUando INICIAR A CORRIDA
Corrida = 0;
// Quando o Player Ganhar:
// 1:
static Nom[24], Str[30];
GetPlayerName(playerid, Nom, 24);
if(Corrida == 0){
format(Str, sizeof(Str), "[A]%s", Nom);
SetPlayerNome(playerid, Str);
Corrida ++;
}
if(Corrida == 1){
format(Str, sizeof(Str), "[B]%s", Nom);
SetPlayerNome(playerid, Str);
Corrida ++;
}
if(Corrida == 2){
format(Str, sizeof(Str), "[C]%s", Nom);
SetPlayerNome(playerid, Str);
Corrida ++;
}
Re: [AJUDA] Variavel String -
ViictorDaay- - 26.06.2012
So pra corrigir
Respuesta: Re: [AJUDA] Variavel String -
zSuYaNw - 26.06.2012
Quote:
Originally Posted by ViictorDaay-
So pra corrigir 
|
Thx por corrigir, eu estava destraido quando eu havia criado.
Re: [AJUDA] Variavel String -
Hunter_Xtreme - 26.06.2012
pawn Код:
SetPlayerName(playerid, Str); // Pra Corrigir tambem
Vou testar aki e ver se ta certo
Re: Respuesta: [AJUDA] Variavel String -
Hunter_Xtreme - 26.06.2012
Quote:
Originally Posted by [Full]Garfield[XDB]
pawn Код:
new Corriada;
// QUando INICIAR A CORRIDA Corrida = 0;
// Quando o Player Ganhar: // 1: static Nom[24], Str[30]; GetPlayerName(playerid, Nom, 24); if(Corrida == 0){ format(Str, sizeof(Str), "[A]%s", Nom); SetPlayerNome(playerid, Str); Corrida ++; }
if(Corrida == 1){ format(Str, sizeof(Str), "[B]%s", Nom); SetPlayerNome(playerid, Str); Corrida ++; } if(Corrida == 2){
format(Str, sizeof(Str), "[C]%s", Nom); SetPlayerNome(playerid, Str); Corrida ++; }
|
Cara, sabia que nao ia funcionar
pawn Код:
if(Corrida == 0){
format(Str, sizeof(Str), "[A]%s", Nom);
SetPlayerNome(playerid, Str);
Corrida ++;//aqui ta o problema, pois o se o player ficar em primeiro lugar, os proximos ifs nao deverao funcionar!
}
if(Corrida == 1){
format(Str, sizeof(Str), "[B]%s", Nom);
SetPlayerNome(playerid, Str);
Corrida ++;
}
if(Corrida == 2){
format(Str, sizeof(Str), "[C]%s", Nom);
SetPlayerNome(playerid, Str);
Corrida ++;
}
Respuesta: [AJUDA] Variavel String -
zSuYaNw - 26.06.2012
Tente isto:
pawn Код:
new str[100], Nom[24];
GetPlayerName(playerid, Nom, 24);
switch(Corrida)
{
case 0: format(str, sizeof(str),"[A]%s", Nom);
case 1: format(str, sizeof(str),"[B]%s", Nom);
case 2: format(str, sizeof(str),"[C]%s", Nom);
}
SetPlayerNome(playerid, str);
Corrida++;
Re: [AJUDA] Variavel String -
Hunter_Xtreme - 26.06.2012
ta funcionado sim, mas nao entendi o porque desse GetPlayerName '-'
Respuesta: [AJUDA] Variavel String -
zSuYaNw - 26.06.2012
pawn Код:
// Cria as arrays necessбrias
new str[100], Nom[24];
// Pegamos o nome do player para depois renomea-lo
GetPlayerName(playerid, Nom, 24);
switch(Corrida)
{
// De acordo com a posiзгo, ele formata a string
case 0: format(str, sizeof(str),"[A]%s", Nom);
case 1: format(str, sizeof(str),"[B]%s", Nom);
case 2: format(str, sizeof(str),"[C]%s", Nom);
}
// A string formatada й colocado como nome do player
SetPlayerNome(playerid, str);
// Variбvel para incrementar +1.
Corrida++;
=)
Re: [AJUDA] Variavel String -
Hunter_Xtreme - 26.06.2012
A entendi, mas eu nao queria mudar o nome do player, intao nem vai precisar disso, ja consegui aqui, deu certo o sisteminha, valeu por tudo ae =D