18.06.2012, 22:47
(
Last edited by RoacH`; 23/10/2012 at 07:51 PM.
)
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:
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
Cуdigo:
PHP Code:
public OnPlayerDisconnect(playerid, reason) {
if(reason == 1) {
static
Float:iHealth,
Float:iAmour
;
GetPlayerHealth(playerid, Float:iHealth);
GetPlayerArmour(playerid, Float: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(playerid, iPlayerid, MAX_PLAYER_NAME);
GetPlayerName(GetPVarInt(playerid, #issuerid), iRageid, MAX_PLAYER_NAME);
format(string, 128, "\"%s\" cometeu rage quit! quando \"%s\" estava matando ele!", iPlayerid, iRageid);
new File:iRage = fopen(#RageQuits.txt, io_write);
fwrite(iRage, string);
fclose(iRage);
return SendClientMessageToAll(-1, string);
}
}
}
return true;
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid) {
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(playerid, targetplayerid);
public Float:GetDistanceBetweenPlayers(playerid, targetplayerid) {
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));
}
Creditos:
RoacH` - Criador
[FeK]DraKiNs - Lуgica retirado deste topico(Aqui)
SA-MP TEAM - For all