SA-MP Forums Archive
Taser System - 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: Taser System (/showthread.php?tid=362733)



Taser System - fury14 - 25.07.2012

Hi, i need somebody to help me with taser system...
Now, look at this code, it is code when player punch other player, player is tazed...
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
	if(TazerAcceso[playerid] == 1)
	{
 	if(GetPlayerWeapon(playerid) == 0)
    {
 			ApplyAnimation(playerid,"KNIFE", "knife_3", 4.0, 0, 1, 1, 1, 1000);
      		SetTimerEx("TimerClear",2000,false,"d",playerid);
      		new victimid = GetClosestPlayer(playerid);
      		new sendername[MAX_PLAYER_NAME];
			if(IsPlayerConnected(victimid))
	     	{
	        	if(GetDistanceBetweenPlayers(playerid,victimid) < 2)
	            {
			GameTextForPlayer(victimid, "~r~Sokiran!", 2500, 3);
	            	new Float:health;
	                GetPlayerHealth(victimid, health);
	                SetPlayerHealth(victimid, health - 5.0);
	                SetTimerEx("TimerFall",300,false,"d",victimid);
					TogglePlayerControllable(victimid, 0);
					SetTimerEx("Untaze", 8000, false, "i", victimid);
	             }
	         }
	      }
    }
    return 1;
}
Now i want, when player taze other player, i want to write these lines in chat:
FOR Suspect: "You are shocked by Name_Surname"
FOR Cop/fbi/Swat "You shocked a Name_Surname"


You understand me?

I just want that you put that in my code... Please help, i need it


Re: Taser System - TheDeath - 25.07.2012

Код:
new tazered_msg[64],tazering_msg[64],name_tazered[MAX_PLAYER_NAME+1]name_tazering[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name_tazering, sizeof(name_tazering));
GetPlayerName(damagedid, name_tazered, sizeof(name_tazered));
format(tazered_msg,sizeof(tazered_msg), "You have been tazered by %s(ID:%d)",name_tazering,playerid);
format(tazering_msg,sizeof(tazering_msg), "You have tazered %s(ID:%d)" ,name_tazered , damagedid);
SendClientMessage(playerid, -1 , tazering_msg); //CHANGE -1 TO THE COLOR YOU WANT
SendClientMessage(damagedid, -1 , tazered_msg); //CHANGE -1 TO THE COLOR YOU WANT
This might work


Re: Taser System - fury14 - 25.07.2012

Quote:
Originally Posted by TheDeath
Посмотреть сообщение
Код:
new tazered_msg[64],tazering_msg[64],name_tazered[MAX_PLAYER_NAME+1]name_tazering[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name_tazering, sizeof(name_tazering));
GetPlayerName(damagedid, name_tazered, sizeof(name_tazered));
format(tazered_msg,sizeof(tazered_msg), "You have been tazered by %s(ID:%d)",name_tazering,playerid);
format(tazering_msg,sizeof(tazering_msg), "You have tazered %s(ID:%d)" ,name_tazered , damagedid);
SendClientMessage(playerid, -1 , tazering_msg); //CHANGE -1 TO THE COLOR YOU WANT
SendClientMessage(damagedid, -1 , tazered_msg); //CHANGE -1 TO THE COLOR YOU WANT
This might work
I got these errors when i copied your code:
Код:
C:\Users\Komp\Desktop\ToXic RolePlay\gamemodes\CLRP.pwn(4368) : error 001: expected token: ";", but found "-identifier-"
C:\Users\Komp\Desktop\ToXic RolePlay\gamemodes\CLRP.pwn(4368) : error 017: undefined symbol "name_tazering"
C:\Users\Komp\Desktop\ToXic RolePlay\gamemodes\CLRP.pwn(4368) : warning 215: expression has no effect
C:\Users\Komp\Desktop\ToXic RolePlay\gamemodes\CLRP.pwn(4368) : error 001: expected token: ";", but found "]"
C:\Users\Komp\Desktop\ToXic RolePlay\gamemodes\CLRP.pwn(4368) : fatal error 107: too many error messages on one line
EDIT: It's working now... Thank you very much...