If Get Player health >100
#1

Hello , how to make that when someone shoot another one with God mode send GameTextForPlayer "This Player have God Mode"
Or if was afk "This player is AFK"
Thanks!!, +reps!
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerGiveDamage
Reply
#3

OnPlayerClickPlayer ( now goes your new AFK or GetPlayerHealth fuction. ) SendClientMessage (playerid,color, "That player is AFK")
Reply
#4

Godmode:

Top of script:
pawn Код:
new GodMode[MAX_PLAYERS];
An example of how you could do it:

pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
    if(GodMode[damagedid] = 1) // If godmode = true for damagedid (victim)
    {
        GameTextForPlayer(playerid, "~r~This player is godmodded! You can not attack him!", 5000, 0); // Send this message to playerid (attacker)
        return 1;
    }
    return 1;
}
An example of how it could look with zCMD: (Not tested, just done an all nighter so it is most likely messed up, but you get the idea).

pawn Код:
CMD:godmode(playerid, params[])
{
    if(GodMode[playerid] < 1) // checking if godmode is off (left is less than right)
    {
        SendClientMessage(playerid, -1, "Godmode turned on!"); // give them a message
        GodMode[playerid] = 1; // turn it on
        // Code here (for health or w/e)
        return 1; // return 1;
    }
    else if(GodMode[playerid] > 0) // if its more than 0,
    {
        GodMode[playerid] = 0; // set it to 0, so it's turned off
        SendClientMessage(playerid, -1, "Godmode turned off!"); // let them know
        // Remove that code here if you want
        return 1; // return 1;
    }
    return 1;
}
AFK checker:

Top of script:
pawn Код:
new IsAFK[MAX_PLAYERS];
Coming straight from SA-MP wiki:

pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    if(IsAFK[playerid] < 1) // checking if they are AFK
    {
        new message[32]; // new message

        format(message, sizeof(message), "Player %d is AFK!", clickedplayerid); // format so we can display name
        SendClientMessage(playerid, -1, message); // send the above message in "-1" (white)
        return 1; // return 1;
    }
    return 1;
}
zCMD example again:

pawn Код:
CMD:afk(playerid, params[])
{
    if(IsAFK[playerid] < 1) // if left is more than right...
    {
        SendClientMessage(playerid, -1, "You have gone AFK!"); // let them know
        IsAFK[playerid] = 1; // set their variable
        // Code here (for health or w/e)
        return 1; // return 1;
    }
    else if(IsAFK[playerid] > 0) // if right is more than left
    {
        IsAFK[playerid] = 0; // turn it off
        SendClientMessage(playerid, -1, "You have returned!"); // let them know
        // Remove that code here if you want
        return 1; // return 1;
    }
    return 1;
}
Reply
#5

I never understand what to do ? :P, oh thanks i ll try but what about AFK?
Reply
#6

Quote:
Originally Posted by Mionee
Посмотреть сообщение
Godmode:

Top of script:
pawn Код:
new GodMode[MAX_PLAYERS];
An example of how you could do it:

pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
    if(GodMode[damagedid] = 1); // If godmode = true for damagedid (victim)
    {
        GameTextForPlayer(playerid, "~r~This player is godmodded! You can not attack him!", 5000, 0); // Send this message to playerid (attacker)
        return 1;
    }
    return 1;
}
An example of how it could look with zCMD: (Not tested, just done an all nighter so it is most likely messed up, but you get the idea).

pawn Код:
CMD:godmode(playerid, params[])
{
    if(GodMode[playerid] < 1);
    {
        SendClientMessage(playerid, -1, "Godmode turned on!");
        GodMode[playerid] = 1;
        // Code here (for health or w/e)
        return 1;
    }
    else if(GodMode[playerid] > 0);
    {
        GodMode[playerid] = 0;
        SendClientMessage(playerid, -1, "Godmode turned off!");
        // Remove that code here if you want
        return 1;
    }
    return 1;
}
AFK checker:

Top of script:
pawn Код:
new IsAFK[MAX_PLAYERS];
Coming straight from SA-MP wiki:

pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    if(IsAFK[playerid] < 1)
    {
        new message[32];

        format(message, sizeof(message), "Player %d is AFK!", clickedplayerid);
        SendClientMessage(playerid, -1, message);
        return 1;
    }
    return 1;
}
zCMD example again:

pawn Код:
CMD:afk(playerid, params[])
{
    if(IsAFK[playerid] < 1);
    {
        SendClientMessage(playerid, -1, "You have gone AFK!");
        IsAFK[playerid] = 1;
        // Code here (for health or w/e)
        return 1;
    }
    else if(GodMode[playerid] > 0);
    {
        IsAFK[playerid] = 0;
        SendClientMessage(playerid, -1, "You have returned!");
        // Remove that code here if you want
        return 1;
    }
    return 1;
}
Код:
C:\Users\MaHdy\Desktop\SPA Server original\filterscripts\DAdmin2.pwn(5700) : error 017: undefined symbol "GodMode"
C:\Users\MaHdy\Desktop\SPA Server original\filterscripts\DAdmin2.pwn(5700) : warning 215: expression has no effect
C:\Users\MaHdy\Desktop\SPA Server original\filterscripts\DAdmin2.pwn(5700) : error 001: expected token: ";", but found "]"
C:\Users\MaHdy\Desktop\SPA Server original\filterscripts\DAdmin2.pwn(5700) : error 029: invalid expression, assumed zero
C:\Users\MaHdy\Desktop\SPA Server original\filterscripts\DAdmin2.pwn(5700) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#7

Updated my post;

Add at the top of your script (before main() and after includes/defines)

new GodMode[MAX_PLAYERS];

Also, mind showing me line 5700?


EDIT: Jeez, I messed up lol, edited my original post again. Remove the code I gave you and replace it with the new one please, I'm sure it'll work
Reply
#8

Oh it's okay
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
		if(pInfo[damagedid][God] == 1)
	    {
        GameTextForPlayer(playerid, "~r~This player is godmodded! You can not attack him!", 5000, 0); // Send this message to playerid (attacker)
        }
        return 1;
}
This is my GOD CMD:
Код:
CMD:god(playerid,params[])
{
	if(pInfo[playerid][ALevel] >= 2 || IsPlayerAdmin(playerid))
	{
	    if(DMTIME[playerid] == 1)return SendClientMessage(playerid,Red,"[ERROR]:- You cannot use this command in dmtime!");
	    if(pInfo[playerid][VGod] == 1)return SendClientMessage(playerid,Red,"[ERROR]:- {FFFFFF}You Vip God Is On Turn It Off To Use Admin Godmode!");
	    SendCommandToAdmins(playerid,"GOD");

		if(pInfo[playerid][God] == 0)
	    {
			GivePlayerWeapon(playerid,26,99999);
			GivePlayerWeapon(playerid,16,50000);
			SetPlayerHealth(playerid,999999999);
			pInfo[playerid][God] = 1;
			SendClientMessage(playerid,0x00FFFFFF,"|_God Mode On_|");
			AutoR(playerid);
		}
		else
		{
			SetPlayerHealth(playerid,100.0);
			pInfo[playerid][God] = 0;
			SendClientMessage(playerid,0x00FFFFFF,"|_God Mode Off_|");
			return 1;
		}
		return 1;
	}
	else return LevelMSG(playerid,2);
}
About AFK , I meant when someone also shoot another one and if he was afk gamemodetext , But you know player can be afk with out type /afk , by clicking ESC, thanks!!
Reply
#9

You can still use your existing code to make something similar for AFKed players aswell if you want to add it nevertheless
Reply
#10

+Rep anyway
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)