Godmode message
#1

hi all...
  1. 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?
  2. 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
Reply
#2

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;
}
Reply
#3

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?
Reply
#4

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)