[Off] Variбvel[MAX_PLAYERS]
#9

Quote:
Originally Posted by Fel486
Посмотреть сообщение
Boa noite .

PHP код:
new variavel[MAX_PLAYERS]; 
й um array com MAX_PLAYERS de capacidade, o qual hoje й 500, definido no a_samp.inc. Isso quer dizer que atй 500 utilizadores podem utilizar tal variбvel (0 ao 499), ou seja, cada um dos 500 jogadores terб um valor pessoal, e o modo de identificar o usuбrio й pelo 'playerid', que й o ID do jogador no server.

Esse tipo de coisa й utilizado porque Pawno nгo й orientado a objetos, entгo, por exemplo, cada jogador (objeto) nгo pode ter, por exemplo, dinheiro desta forma:

PHP код:
Jogador j = new Jogador();
j.dinheiro = GetPlayerMoney(playerid); 
Jб uma variбvel comum й apenas uma variбvel, ъnica ....

PHP код:
new teste = 5;
new 
valor[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
     
valor[playerid] = 5 + playerid;
} 
Cada jogador terб um nъmero como valor, sendo seu ID + 5 o valor a ser atribuido. Cada jogador tem um nъmero exclusivo, jб a variбvel 'teste' serб a mesma, sempre continuarб 5.

Perfeita explicaзгo. Entendi certinho. Obrigado
Reply


Messages In This Thread
Variбvel[MAX_PLAYERS] - by RafaelOsio - 21.04.2015, 03:39
Re: Variбvel[MAX_PLAYERS] - by Lуs - 21.04.2015, 03:41
Re: Variбvel[MAX_PLAYERS] - by RafaelOsio - 21.04.2015, 03:44
Re: Variбvel[MAX_PLAYERS] - by Lуs - 21.04.2015, 03:46
Re: Variбvel[MAX_PLAYERS] - by JonathanFeitosa - 21.04.2015, 03:46
Re: Variбvel[MAX_PLAYERS] - by Dolby - 21.04.2015, 03:47
Re: Variбvel[MAX_PLAYERS] - by Fel486 - 21.04.2015, 03:52
Re: Variбvel[MAX_PLAYERS] - by RafaelOsio - 21.04.2015, 03:58
Re: Variбvel[MAX_PLAYERS] - by RafaelOsio - 21.04.2015, 04:00

Forum Jump:


Users browsing this thread: 1 Guest(s)