SA-MP Forums Archive
/bite command - 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: /bite command (/showthread.php?tid=361621)



/bite command - Dare Devil..... - 21.07.2012

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;
    }



Re: /bite command - thefatshizms - 21.07.2012

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;
}



Re: /bite command - SuperViper - 21.07.2012

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.


Re: /bite command - [A]ndrei - 21.07.2012

@ 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...


Re: /bite command - Youice - 21.07.2012

Код:
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