SA-MP Forums Archive
Small script help - 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: Small script help (/showthread.php?tid=220381)



Small script help - Swiftz - 03.02.2011

This is a script for c4 by hitman
Код:
		if(BombID[playerid] != 0)
		{
		    if(GetPlayerWeapon(playerid) == 0)
		    {
		        if(!IsPlayerInAnyVehicle(playerid))
		        {
			        ClearAnimations(playerid);
			        ApplyAnimation(playerid,"PED","bomber",4.0,0,0,0,0,0);
		        }
		    	new Float:X,Float:Y,Float:Z;
				GetObjectPos(BombID[playerid],X,Y,Z);
				DestroyObject(BombID[playerid]);
				CreateExplosion(X,Y,Z,7,1);
				BombID[playerid] = 0;
				SetPlayerWeapons(playerid);
				new killerid = GoChase[playerid];
                if(IsPlayerInRangeOfPoint(killerid,3,X,Y,Z))
                {
                    if(GoChase[playerid] == killerid)
                    {
                        if(PlayerInfo[killerid][pHeadValue] > 0)
                        {
	                        new string[128];
	                    	new price = PlayerInfo[killerid][pHeadValue];
	                    	new name[MAX_PLAYER_NAME];
							new killa[MAX_PLAYER_NAME];
	                    	GetPlayerName(playerid, name, sizeof(name));
							GetPlayerName(killerid, killa, sizeof(killa));
							PlayerInfo[killerid][pCash] = PlayerInfo[killerid][pCash]-price/2;
							GivePlayerMoney(killerid, -price/2);
	                		PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+price/2;
							GivePlayerMoney(playerid, price/2);
	                    	format(string,128,"Hitman %s has fulfilled the contract on %s and collected $%d.",name,killa,price/2);
							SendFamilyMessage(8, COLOR_YELLOW, string);
							format(string,128,"You have been critically injured by a hitman and lost $%d.",price/2);
							SendClientMessage(killerid, COLOR_YELLOW, string);
							SetPlayerHealth(killerid, 0);
	                        ClearContract(killerid);
	                        GoChase[playerid] = 999;
	                        PlayerInfo[playerid][pCHits]++;
						}
					}
                }
			}
		}
	}
Now i making the c4 can be used by anyone so to decrease misuse or DM so the person (killerid) his id and name should be messaged to the person who had died in that explosion. How can i make it please help


Re: Small script help - Swiftz - 03.02.2011

no one knows?


Re: Small script help - Steven Paul - 03.02.2011

don't bump. You can do it in OnPlayerDeath


Re: Small script help - Swiftz - 03.02.2011

Sorry for bump, on player death how to do it? i have killerid public function and is there any way print the player name who typed /plantbomb after the player is dead after bomb is detonated anyway?