[FilterScript] Detectar Rage Quit!
#1

Olб pessoal, bom estava dando uma "bisbiotada" neste topico(Aqui) e tive a ideia de criar algo parecido.. sabe quando vocк estб matando o cara e ele quase morrendo desconecta do servidor? denominado pelo nome RAGE-QUIT.. eu nгo fiz algo contra isso, apenas fiz algo que detecta isso.. ele informa quem cometeu e salva em um arquivo na scriptfiles cujo o nome й "RageQuits.txt".

Cуdigo:
PHP Code:
public OnPlayerDisconnect(playeridreason) {
    if(
reason == 1) {
        static
            
Float:iHealth,
            
Float:iAmour
        
;
        
GetPlayerHealth(playeridFloat:iHealth);
        
GetPlayerArmour(playeridFloat:iAmour);
        if(
GetDistanceBetweenPlayers(GetPVarInt(playerid#issuerid), playerid) < 25.0) {
            
if((gettime() - GetPVarInt(playerid#playerid) < 4 && IsPlayerConnected(GetPVarInt(playerid, #issuerid)) && iHealth < 50.0 && iAmour == 0)) {
                   
static
                    
string[128],
                    
iPlayerid[MAX_PLAYER_NAME],
                    
iRageid[MAX_PLAYER_NAME]
                ;
                
GetPlayerName(playeridiPlayeridMAX_PLAYER_NAME);
                
GetPlayerName(GetPVarInt(playerid#issuerid), iRageid, MAX_PLAYER_NAME);
                
format(string128"\"%s\" cometeu rage quit! quando \"%s\" estava matando ele!"iPlayeridiRageid);
                
                new 
File:iRage fopen(#RageQuits.txt, io_write);
                
fwrite(iRagestring);
                
fclose(iRage);
                return 
SendClientMessageToAll(-1string);
            }
        }
    }
    return 
true;
}
public 
OnPlayerTakeDamage(playeridissueridFloatamountweaponid) {
    if(
issuerid != INVALID_PLAYER_ID) {
        
SetPVarInt(playerid#playerid, gettime());
        
SetPVarInt(playerid#issuerid, issuerid);
        // printf("issuerid: %d atirou em playerid: %d", GetPVarInt(playerid, "issuerid"), GetPVarInt(playerid, "playerid"));
        // printf("playerid: %d levou um tiro do issuerid: %d", GetPVarInt(playerid, "playerid"), GetPVarInt(playerid, "issuerid"));
    
}
    return 
true;
}
forward Float:GetDistanceBetweenPlayers(playeridtargetplayerid);
public 
Float:GetDistanceBetweenPlayers(playeridtargetplayerid) {
    new 
Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
    if(!
IsPlayerConnected(playerid) || !IsPlayerConnected(targetplayerid)) {
        return -
1.00;
     }
     
GetPlayerPos(playerid,x1,y1,z1);
     
GetPlayerPos(targetplayerid,x2,y2,z2);
     return 
floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));

Qualquer bug me contate por MP ou no prуprio topico!

Creditos:
RoacH` - Criador
[FeK]DraKiNs - Lуgica retirado deste topico(Aqui)
SA-MP TEAM - For all
Reply


Messages In This Thread
Detectar Rage Quit! - by RoacH` - 18.06.2012, 22:47
Re: Detectar Rage Quit! - by EditPawn - 18.06.2012, 22:49
Re: Detectar Rage Quit! - by DrTHE - 18.06.2012, 22:51
Re: Detectar Rage Quit! - by EditPawn - 18.06.2012, 22:52
Re: Detectar Rage Quit! - by Ades - 18.06.2012, 22:52
Re: Detectar Rage Quit! - by Diogo123 - 18.06.2012, 23:10
Re: Detectar Rage Quit! - by .FuneraL. - 18.06.2012, 23:14
Re: Detectar Rage Quit! - by paulor - 18.06.2012, 23:25
Re: Detectar Rage Quit! - by Kuddy - 19.06.2012, 00:13
Re: Detectar Rage Quit! - by ViictorDaay- - 19.06.2012, 00:17

Forum Jump:


Users browsing this thread: 2 Guest(s)