13.04.2019, 20:09
Vocк precisa fazer um loop, verificando jogadores online e se tem a permissгo.
Recomendo o uso da funзгo GetPlayerPoolSize para pegar o id mais alto.
Exemplo:
Outra observaзгo nesse comando, й que nгo й necessбrio o uso do sscanf.
Basta usar isnull:
Uso:
Jб respondendo a dъvida sobre o outro tуpico, basta fazer o loop verificar se esta online, e usar a funзгo IsPlayerInRangeOfPoint para verificar se o jogador estб perto de uma coordenada junto com as funзхes GetPlayerInterior e GetPlayerVirtualWorld.
Lembrando que precisa usar a funзгo GetPlayerPos para pegar as coordenadas do jogador que usou o comando.
Recomendo o uso da funзгo GetPlayerPoolSize para pegar o id mais alto.
Exemplo:
PHP Code:
new playerson = 0;
for(new i, j = GetPlayerPoolSize(); i <= j; i++){
//Caso nгo esteja online passa para o prуximo id
if(!IsPlayerConnected(i))
continue;
playerson++;
}
printf("%d jogadores online.", playerson);
Basta usar isnull:
PHP Code:
#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
PHP Code:
CMD:teste(playerid, params[]){
if(isnull(params)){
SendClientMessage(playerid, -1, "Use /teste [texto]");
return 1;
}
SendClientMessage(playerid, -1, params);
return 1;
}
Lembrando que precisa usar a funзгo GetPlayerPos para pegar as coordenadas do jogador que usou o comando.
PHP Code:
new Float: x, Float: y, Float: z;
new vw, interior;
GetPlayerPos(playerid, x,y, z);
interior = GetPlayerInterior(playerid);
vw = GetPlayerVirtualWorld(playerid);
for(new i, j = GetPlayerPoolSize(); i <= j; i++){
if(!IsPlayerConnected(i))
continue;
//Caso o jogador nгo esteja perto, esteja em outro virtual world ou esteja em um interior diferente passa para o prуximo id
if(!IsPlayerInRangeOfPoint(i, 10.0, x, y, z) || vw != GetPlayerVirtualWorld(i) || interior != GetPlayerInterior(i))
continue;
//Caso esteja perto manda a mensagem
SendClientMessage(i, -1, "Teste");
}

