SA-MP Forums Archive
auto disable god - 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: auto disable god (/showthread.php?tid=583190)



auto disable god - suni - 26.07.2015

hey how to I script an auto disable god for when a player type /godmode and they shoot/punch the the player it will disable godmode for them?
Код:
if(PlayerAcc[playerid][God] == 1)



Re: auto disable god - SickAttack - 26.07.2015

pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    if(PlayerAcc[playerid][God] == 1) PlayerAcc[playerid][God] = 0;
    return 1;
}



Re: auto disable god - Moudix - 26.07.2015

Use this callback.
PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
 if(
PlayerAcc[playerid][God] == 1)
 {
 
PlayerAcc[playerid][God] = 0;
SetPlayerHealth(playerid100);
 }
return 
1;




Re: auto disable god - suni - 26.07.2015

thanks you all +rep


Re: auto disable god - suni - 26.07.2015

I also need help with this code, I cant fix it
Код:
public OnPlayerTakeDamage( playerid, issuerid, Float:amount, weaponid )
{
	new Float:h;
	GetPlayerHealth(playerid, h);
	if (PlayerAcc[playerid][God] == 1 && h == FLOAT_INFINITY)
	{
	GameTextForPlayer(playerid, "~r~The player you're trying to hit has ~g~god mode activated~r~!", 5000, 5);
	}
	return 1;
}



Re: auto disable god - youssefehab500 - 26.07.2015

PHP код:
GameTextForPlayer(issuerid"~r~The player you're trying to hit has ~g~god mode activated~r~!"50005); 
I'm guessing you need this game text to be shown for the shooter; therefor you need to use issuerid instead of playerid.


Re: auto disable god - suni - 26.07.2015

Quote:
Originally Posted by youssefehab500
Посмотреть сообщение
PHP код:
GameTextForPlayer(issuerid"~r~The player you're trying to hit has ~g~god mode activated~r~!"50005); 
I'm guessing you need this game text to be shown for the shooter; therefor you need to use issuerid instead of playerid.
thx man +rep


Re: auto disable god - suni - 28.07.2015

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    if(PlayerAcc[playerid][God] == 1) PlayerAcc[playerid][God] = 0;
    return 1;
}
it's saying
Quote:

error 025: function heading differs from prototype




Re: auto disable god - jamesmith12 - 28.07.2015

Cool Idea bro gonna use this on my gamemode work in progress