/bite command
#1

Hello guys I am truing to make a command /bite and I want when a player use it ton some other player it looses the otherplayer health but in my script it reduces my health.

pawn Код:
{
    if (strcmp("/bite", cmdtext, true, 10) == 0)
    {
    Setplayerhealth(player,-5);
        return 1;
    }
Reply
#2

Try to use sscanf and zcmd makes it a whole lot more easy
pawn Код:
CMD:bite(playerid, params[])
{
    new id;
    if(sscanf(params,"u",id)) return SendClientMessage(playerid, -1, "USAGE: /bite <id/name>");
    SetPlayerHealth(id, -20);
    return 1;
}
Reply
#3

Computers can't read your mind. How are you detecting what player's health to set? How are you detecting what to subtract twenty from? The computer doesn't know what you want to do so you need to give it specific actions. Think about what you're doing before complaining that it won't work.
Reply
#4

@ SuperViper your right you need to make the action you making it so when he bites him his hp dies out to -20 you need to make actions...i dont know howto make em so i cant help oyu...
Reply
#5

Код:
CMD:bite(playerid, cmdtext[])
{
	new TargetID, Float:pos[3];
	GetPlayerPos(TargetID, pos[0], pos[1], pos[2]);
	if(IsPlayerInRangeOfPoint(playerid, 5, pos[0], pos[1], pos[2])) {
		new str[185], name[MAX_PLAYER_NAME];
		GetPlayerName(playerid, name, MAX_PLAYER_NAME);
		format(str, 184, "%s Has bitten you!, and have just started pouring your blood!", name);
		SetPlayerHealth(TargetID, -10);
		SetTimerEx("LessBlood", (1000*60)*1, true, "d", TargetID);
		SetPVarInt(TargetID, "Injured", 1);
	}
	else SendClientMessage(playerid, -1, "You are not near to any one");
	return 1;
}

forward LessBlood(playerid);
public LessBlood(playerid)
{
	if(GetPVarInt(playerid, "Injured"))
	{
		SetPlayerHealth(playerid, -20);
	}
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	if(GetPVarInt(playerid, "Injured"))
	{
		DeletePVar(playerid, "Injured");
	}
	return 1;
}
hope it works with you : D
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)