SA-MP Forums Archive
doubt - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: doubt (/showthread.php?tid=386817)



doubt - Rodrigo. - 21.10.2012

Hey guys!
this command is optimized?
PHP код:
CMD:procurar(playerid, params[]) {
    if(
PlayerInfo[playerid][pOrg] != org@Federal) {
        return 
SendClientMessage(playerid,-1,"SERVER: Vocк nгo й um membro da Organizaзгo de Polнcia Federal");
    } else {
        new
            
targetid,
            
motivo[40],
            
Float:p[3],
            
i
        
;
        if(
sscanf(params,"is[40]",targetid, motivo)) {
            return 
SendClientMessage(playerid,-1,"SERVER: ERRO DE SINTAXE! /procurar [targetid][motivo]");
        } else {
            if(!
IsPlayerConnected(targetid)) {
                return 
SendFormattedMessage(playerid, -1,"SERVER: O id %i nгo estб conectado", targetid);
            } else {
                
GetPlayerPos(targetid, p[0], p[1], p[2]);
                if(!
IsPlayerInRangeOfPoint(playerid, 5.0, p[0], p[1], p[2])) {
                    return 
SendFormattedMessage(playerid, -1,"SERVER: Vocк nгo estб perto do jogador id %i", targetid);
                } else {
                    
SetPlayerWantedLevel(targetid, GetPlayerWantedLevel(targetid)+1);
                    
PlayerInfo[playerid][pProcurado] = true;
                    
SendFormattedMessage(targetid, -1,"PROCURADO: O policial %s colocou vocк na lista de procurados por %s",replace(playerid), motivo);
                    
SendFormattedMessage(playerid, -1,"SUCESSO: Vocк colocou o jogador %s na lista de procurados por %s",replace(targetid),motivo);
                    for( ; 
i < MAX_PLAYERS; ++i) {
                        if(
IsPlayerConnected(i) && PlayerInfo[playerid][pAdmin] >= 1) {
                            
SendFormattedMessage(i, COLOR_BLUE,"ALERTA: O policial %s(%i) colocou o jogador %s(%i) na lista de procurados por %s",replace(playerid),playerid,replace(targetid),targetid, motivo);
                        }
                        if(
IsPlayerConnected(i) && PlayerInfo[playerid][pOrg] == org@Federal) {
                            
SendFormattedMessage(i, COLOR_BLUE,"RADIO POLICIAL: O policial %s colocou o jogador %s na lista de procurados por %s",replace(playerid),replace(targetid),motivo);
                        }
                    }
                }
            }
        }
    }
    return 
1;
} 



Re: doubt - ThePhenix - 21.10.2012

I think so.