SA-MP Forums Archive
{HELP} I'm in need of a /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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: {HELP} I'm in need of a /bite command (/showthread.php?tid=99262)



{HELP} I'm in need of a /bite command - Alex_Grant - 26.09.2009

Okay, well maybe you guys heard about a command which when you use it, it's like you bite a guy and he loses health, for exemple a /bite command. I need that command for the Zombie Faction on ma' server . Silly of course, but i really need it please! If you have this command or you know how to make it, please i would be thankful if someone helped me


Re: {HELP} I'm in need of a /bite command - Desert - 26.09.2009

Havent tested this or checked if it worked. But i think its something close to like that


Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(bite,4,cmdtext);
	return 0;
}
dcmd_bite(playerid,params[])
{
	new tmp[4],idx;
	tmp = strtok(params,idx);
	if(!strval(tmp))
	{
	  SendClientMessage(playerid,COLOUR_RED,"USAGE: /bite [ID]");
	  return 1;
	  }
	else
	{
	  new pid,string[34],string1[30];
	  pid = strval(tmp);
		SetPlayerHealth(pid,GetPlayerHealth(pid)-25);
		format(string),sizeof(string),"You have succesfully bitten %s",pid);
		format(string1),sizeof(string1),"You have been bitten by %s",playerid);
		SendClientMessage(playerid,COLOUR_YELLOW,string);
		SendClientMessage(pid,COLOUR_RED,string1);
		return 1;
		}
	return 1;
	}



Re: {HELP} I'm in need of a /bite command - ded - 26.09.2009

I think you'd probably need some kind of proximity code to check if someone is near ... obviously you can't bite someone if he/she is far away or that would just be stupid.


Re: {HELP} I'm in need of a /bite command - Desert - 26.09.2009

O yeah didnt think of that

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(bite,4,cmdtext);
	return 0;
}
dcmd_bite(playerid,params[])
{
	new tmp[4],idx;
	tmp = strtok(params,idx);
	new Float:X,Float:Y,Float:Z;
	GetPlayerPos(strval(tmp),X,Y,Z);
	if(!strval(tmp))
	{
	  SendClientMessage(playerid,COLOUR_RED,"USAGE: /bite [ID]");
	  return 1;
	  }
	else if(!IsPlayerInRangeOfPoint(playerid,5,X,Y,Z);
	{
	  SendClientMessage(playerid,COLOUR_RED,"You are not close enough to the targeted ID");
	  return 1;
	  }
	else
	{
	  new pid,string[34],string1[30];
	  pid = strval(tmp);
		SetPlayerHealth(pid,GetPlayerHealth(pid)-25);
		format(string),sizeof(string),"You have succesfully bitten %s",pid);
		format(string1),sizeof(string1),"You have been bitten by %s",playerid);
		SendClientMessage(playerid,COLOUR_YELLOW,string);
		SendClientMessage(pid,COLOUR_RED,string1);
		return 1;
		}
	return 1;
	}
Tho this code would only work on version 0.3 since it uses IsPlayerInRangeOfPoint


Re: {HELP} I'm in need of a /bite command - ded - 26.09.2009

Nice


Re: {HELP} I'm in need of a /bite command - Alex_Grant - 27.09.2009

Quote:
Originally Posted by Desert
O yeah didnt think of that

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(bite,4,cmdtext);
	return 0;
}
dcmd_bite(playerid,params[])
{
	new tmp[4],idx;
	tmp = strtok(params,idx);
	new Float:X,Float:Y,Float:Z;
	GetPlayerPos(strval(tmp),X,Y,Z);
	if(!strval(tmp))
	{
	  SendClientMessage(playerid,COLOUR_RED,"USAGE: /bite [ID]");
	  return 1;
	  }
	else if(!IsPlayerInRangeOfPoint(playerid,5,X,Y,Z);
	{
	  SendClientMessage(playerid,COLOUR_RED,"You are not close enough to the targeted ID");
	  return 1;
	  }
	else
	{
	  new pid,string[34],string1[30];
	  pid = strval(tmp);
		SetPlayerHealth(pid,GetPlayerHealth(pid)-25);
		format(string),sizeof(string),"You have succesfully bitten %s",pid);
		format(string1),sizeof(string1),"You have been bitten by %s",playerid);
		SendClientMessage(playerid,COLOUR_YELLOW,string);
		SendClientMessage(pid,COLOUR_RED,string1);
		return 1;
		}
	return 1;
	}
Tho this code would only work on version 0.3 since it uses IsPlayerInRangeOfPoint
Dude, that's nice, but can you please make it for 0.2? I mean like you don't have to do it, but i'm atleast asking you kindly


Re: {HELP} I'm in need of a /bite command - XCultz - 27.09.2009

lol thats awesome


Re: {HELP} I'm in need of a /bite command - coole210 - 27.09.2009

You can make it so if the person gets hit by knife they become zombie, ive seen it before, i used to script for the server..


Re: {HELP} I'm in need of a /bite command - Alex_Grant - 27.09.2009

Quote:
Originally Posted by [TPG
Coole210 ]
You can make it so if the person gets hit by knife they become zombie, ive seen it before, i used to script for the server..
Yeah i saw a GameMode like that here on these forums, but nah, i want it when you type a command even for exemple /tazer, only i want the guy to be infected not tazed, so yeah..


Re: {HELP} I'm in need of a /bite command - Calgon - 27.09.2009

When they're infected, what will they do? Switch teams? Die? Be teleported?