CMD:fmembers(playerid) { if(fmembro[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "You do not participate in a faction."); new string[30]; new suafacid = fmembro[playerid]; for(new i = 0; i < MAX_PLAYERS; i++) { if(fmembro[playerid] == suafacid) { format(string, sizeof(string), "%s %i", PlayerName(playerid), fcargo[playerid] ); SendClientMessage(playerid, COLOR_WHITE, string); } } return 1; }
CMD:fmembers(playerid) { if(fmembro[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "You do not participate in a faction."); new string[30]; new suafacid = fmembro[playerid]; for(new i = 0; i < MAX_PLAYERS; i++) { if(fmembro[playerid] == suafacid) { format(string, sizeof(string), "%s %i", PlayerName(playerid), fcargo[playerid] ); SendClientMessage(playerid, COLOR_WHITE, string); } } return 1; }
CMD:fmembers(playerid) {
if(fmembro[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "You do not participate in a faction.");
new string[30];
new suafacid = fmembro[playerid];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(fmembro[i] == suafacid) {
format(string, sizeof(string), "%s %i", PlayerName(i), fcargo[i] );
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}
CMD:fmembers(playerid) {
if(fmembro[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "You do not participate in a faction.");
new string[30];
new suafacid = fmembro[playerid];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(fmembro[playerid] == fmembro[i]) {
format(string, sizeof(string), "%s %i", PlayerName(playerid), fcargo[playerid] );
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}
#include <foreach>
CMD:fmembers(playerid)
{
if(fmembro[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "You do not participate in a faction.");
new string[30], suafacid = fmembro[playerid];
foreach(new i: Player)
{
if(fmembro[playerid] != fmembro[i]) continue;
format(string, sizeof(string), "%s %i", PlayerName(playerid), fcargo[playerid] );
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}
pawn Код:
|
CMD:fmembers(playerid){
if(!fmembro[playerid])
return SendClientMessage(playerid, COLOR_RED, "You do not participate in a faction.");
static
string[30], m, i
;
for(m = GetMaxPlayers(), i = 0; i ^ m; ++i){
if(!(fmembro[playerid] ^ fmembro[i])){
SendClientMessage(playerid, -1, (format(string, 30, "%s %i", PlayerName(playerid), fcargo[playerid] ), string));
}
}
return 1;
}
Imbecilidade adicionar uma include dessas para um simples comando.
Se quer otimizaзгo, faзa do modo correcto! pawn Код:
|
Vocк й o ъnico que deve aprender a fazк-lo corretamente.
Atualize-se, hб uma nova funзгo; uma funзгo que vocк claramente nгo saiba. ---> https://sampwiki.blast.hk/wiki/GetPlayerPoolSize <---. Vocк tambйm tem que verificar se um jogador estб conectado ao realizar esse tipo de loops, onde claramente nгo o fazer. Tambйm ' foreach', sendo uma inclusгo que lida com iteradores, й muito mais rбpido do que o seu cуdigo "mais otimizado". |
Nгo entendeu o raciocнnio lуgico?
https://en.wikipedia.org/wiki/Logic_programming OK ok.. Para usar a nossa querida inclusгo "foreach" ele teria que adicionar funзхes no OnPlayerConnect e OnPlayerDisconnect.. teria tambйm que modificar todos os loops do servidor para ter uma rapidez notбvel. Em relaзгo a include GetPlayerPoolSize, й uma funзгo legal e eu nгo sabia. Serб que vale a pena modificar todos os loops por um programa? Forзar alguйm usar uma include por causa de um comando nгo irб ajudar, apenas irб complicar entгo arrume seus argumentos, pense bem e volte aqui quando tiver algo formado. |