Godmode message - 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: Godmode message (
/showthread.php?tid=520744)
-[SOLVED]- Godmode message -
AiRaLoKa - 20.06.2014
hi all...
- i have some question here, if i use SetPVarInt to make a godmode 3D text label, will the 3D text label removed too if i use DeletePVar?
- what is the best callback to be used if i want to show the player a message if he is shoot somebody that use godmode?
*sorry for my bad english
Re: Godmode message -
Haydz - 20.06.2014
1. You need to delete the 3d text label as well, SetPVarInt simply stores the ID of the 3d label so you can use that ID to delete it later with Delete3DTextLabel -
https://sampwiki.blast.hk/wiki/Delete3DTextLabel
- E.G Delete3DTextLabel(GetPVarInt(playerid,"GodMode_Lab el")); //Or whatever you set your pvar to.
2) You could use OnPlayerGiveDamage, detect when a player has given somebody damage then heal them back to full health once you've sent the message.
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
if(GetPVarInt(playerid,"Using_GodMode") == 1) //You'll have to edit this to show how you define if a player is using godmode or not.
{
new string[128],dName[MAX_PLAYER_NAME];
GetPlayerName(damagedid, dName, sizeof(dName));
format(string,sizeof(string),"The player %s(%d) is using god mode, your bullets wont affect him.",dName,damagedid);
SendClientMessage(playerid, 0xFFFFFFFF, string);
}
return 1;
}
Re: Godmode message -
AiRaLoKa - 20.06.2014
Quote:
Originally Posted by Haydz
1. You need to delete the 3d text label as well, SetPVarInt simply stores the ID of the 3d label so you can use that ID to delete it later with Delete3DTextLabel - https://sampwiki.blast.hk/wiki/Delete3DTextLabel
- E.G Delete3DTextLabel(GetPVarInt(playerid,"GodMode_Lab el")); //Or whatever you set your pvar to.
2) You could use OnPlayerGiveDamage, detect when a player has given somebody damage then heal them back to full health once you've sent the message.
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart) { if(GetPVarInt(playerid,"Using_GodMode") == 1) //You'll have to edit this to show how you define if a player is using godmode or not. { new string[128],dName[MAX_PLAYER_NAME]; GetPlayerName(damagedid, dName, sizeof(dName)); format(string,sizeof(string),"The player %s(%d) is using god mode, your bullets wont affect him.",dName,damagedid); SendClientMessage(playerid, 0xFFFFFFFF, string); } return 1; }
|
ah thanks

+REP
EDIT:
do the
OnPlayerGiveDamage will called when the target has infinite health?
Re: Godmode message -
Haydz - 20.06.2014
I can't say for sure but I'll assume so as you'll still being hit. You'll have to test it in-game and see if the function gets called though