Help - 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: Help (
/showthread.php?tid=599365)
Help -
Champagne - 24.01.2016
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.
Re: Help -
Trucido - 25.01.2016
Код:
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;
}
Re: Help -
Padevex - 25.01.2016
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.
Re: Help -
Amunra - 25.01.2016
Hey,
Try This
PHP код:
new cbug[MAX_PLAYERS];
forward OnPlayerCBug(playerid);
public OnPlayerCBug(playerid) {
new playername[MAX_PLAYER_NAME];
new Float:Heal;
GetPlayerName(playerid, playername, sizeof(playername));
CheckCrouch[playerid] = 0;
cbug = 1;
GetPlayerHealth(playerid, Heal);
SetPlayerHealth(playerid, Heal -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