#1

Alright so i am working on a server, I made a Anti - C Bug system, that has about a 98% detection rate, The way it works is that every time somebody C bug's they are supposed to lose 10 hp for me when i typed in my line of coding on the filterscript it fully killed the player and set their HP to 0.


Here is my line:
Код:
forward OnPlayerCBug(playerid);
public OnPlayerCBug(playerid) {
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, sizeof(playername));
        CheckCrouch[playerid] = 0;
        SetPlayerHealth(playerid, - 10);
        return 1;
}




p.s: No Opcodes display when compiled, and everything is defined.
Reply
#2

Код:
forward OnPlayerCBug(playerid);
public OnPlayerCBug(playerid) {
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, sizeof(playername));
        CheckCrouch[playerid] = 0;   
        new Float:health;
        GetPlayerHealth(playerid,health);
        SetPlayerHealth(playerid, health - 10);
        return 1;
}
Reply
#3

SetPlayerHealth(playerid, - 10);

It's because you're setting playerid's HP to -10, not subtracting 10.

The guy above me gave you the correct code.
Reply
#4

Hey,
Try This
PHP код:
new cbug[MAX_PLAYERS];
forward OnPlayerCBug(playerid);
public 
OnPlayerCBug(playerid) {
        new 
playername[MAX_PLAYER_NAME];
        new 
Float:Heal;
        
GetPlayerName(playeridplayernamesizeof(playername));
        
CheckCrouch[playerid] = 0;
        
cbug 1;
        
GetPlayerHealth(playeridHeal);
        
SetPlayerHealth(playeridHeal -10);//If Player Use C Bug , Player Health is -10
        //Your Last code is Just Make SetPlayerHeatlh(playerid,-10)== That mean is SetPlayerHealth -10 , Not Player Total Health -10.
        
return 1;
}
/*//Maybe you can use OnPlayerTakeDamage
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    if(cbug[issuerid] == 1)
    {
        new Float:Health;
        GetPlayerHealth(issuerid, Health);
        SetPlayerHealth(issuerid, Health - 10); // -10 per shoot
        SetPlayerHealth(playerid, 100);
        GameTextForPlayer(issuerid,"~r~~h~~h~Stop Using C Bug ~n~ or you will die!",4000,3);
    }
    return 1;
}
*/
/*
public OnPlayerDeath(playerid, killerid, reason)
{
    cbug[playerid] = 0;//To Reset the Function of cbug detect
    return 1;
}
public OnPlayerSpawn(playerid)
{
    cbug[playerid] = 0;//To reset the Function of cbug detect
    return 1;
}
*/ 
Just Give me My Idea
Correct me if i wrong
Reply


Forum Jump:


Users browsing this thread: