All pastes #568955 Raw Edit

MTA DM - Desert Eagle Wars

public lua v1 · immutable
·published 2007-06-15 22:22 UTC
rendered paste body
-- Desert Eagle Wars-- Coded by Franc[e]scoroot = getRootElement ()kills = {}addEventHandler ("onResourceLoad", getRootElement(), "OnGameModeInit") -- Defining OnGameModeInitfunction OnGamemodeInit ( resource ) -- Calling OnGameModeInit	if ( resource == getThisResource() ) then		outputChatBox ( "** Desert Eagle Wars - coded by Franc[e]sco", root, 255, 100, 100 ) -- GameModeText		createObject ( 17559, 3080.839844, -1585.569580, 3.472107, 0.000000, 0.000000, 0.000000 ) -- object		createObject ( 17559, 3080.808350, -1585.591187, 15.672592, 0.000000, 0.000000, 0.000000 ) -- object1		createObject ( 17559, 3080.425781, -1585.581909, 27.073311, 0.000000, 0.000000, 0.000000 ) -- object2		createObject ( 17559, 3062.362793, -1586.856201, 12.960262, 0.000000, 1.574999, 0.000000 ) -- object3		createObject ( 17559, 3098.446289, -1585.684204, 12.640127, 0.000000, -1.574999, 0.000000 ) -- object4		createObject ( 17559, 3075.816895, -1602.277466, 16.091927, -1.574999, -1.574999, 0.000000 ) -- object5		createObject ( 17559, 3085.214844, -1557.273560, 16.140100, -1.574999, -1.574999, 0.000000 ) -- object6		createObject ( 1225, 3096.333984, -1559.466064, 29.593409, 0.000000, 0.000000, 0.000000 ) -- object7		createObject ( 1225, 3065.398682, -1600.072998, 29.018503, 0.000000, 0.000000, 0.000000 ) -- object8		createObject ( 1225, 3065.272461, -1559.742188, 29.025940, 0.000000, 0.000000, 0.000000 ) -- object9		createObject ( 1225, 3095.603516, -1600.250000, 29.025940, 0.000000, 0.000000, 0.000000 ) -- object10		createObject ( 987, 3061.874756, -1559.723633, 32.686623, 0.000000, 0.000000, 0.000000 ) -- object11		createObject ( 987, 3073.703857, -1559.676270, 32.686699, 0.000000, 0.000000, 0.000000 ) -- object12		createObject ( 987, 3085.571533, -1559.705688, 32.685822, 0.000000, 0.000000, 0.000000 ) -- object13		createObject ( 987, 3100.639648, -1599.960327, 32.563065, 3.135000, 0.000000, 0.000000 ) -- object14		createObject ( 987, 3089.220703, -1599.913086, 32.637558, 3.135000, 0.000000, 0.000000 ) -- object15		createObject ( 987, 3077.622559, -1599.870972, 32.639465, 3.135000, 0.000000, 0.000000 ) -- object16		createObject ( 987, 3070.732422, -1599.869629, 32.639893, 3.135000, 0.000000, 0.000000 ) -- object17		createObject ( 987, 3096.900391, -1558.723022, 28.620186, 4.710003, 0.000000, 0.000000 ) -- object18		createObject ( 987, 3096.858154, -1570.679565, 28.637878, 4.710003, 0.000000, 0.000000 ) -- object19		createObject ( 987, 3096.835449, -1582.630127, 28.638201, 4.710003, 0.000000, 0.000000 ) -- object20		createObject ( 987, 3096.819092, -1594.634644, 28.620186, 4.710003, 0.000000, 0.000000 ) -- object21		createObject ( 987, 3063.808350, -1570.898193, 28.620186, 1.576813, 0.000000, 0.000000 ) -- object22		createObject ( 987, 3063.884277, -1582.865356, 28.616028, 1.576813, 0.000000, 0.000000 ) -- object23		createObject ( 987, 3063.990234, -1594.880859, 28.616375, 1.576813, 0.000000, 0.000000 ) -- object24		createObject ( 987, 3064.014648, -1601.803345, 28.620186, 1.576813, 0.000000, 0.000000 ) -- object25		createObject ( 18059, 3080.535400, -1588.273682, 29.941744, 3.120001, 0.015000, 1.547999 ) -- object26		createObject ( 18059, 3080.207275, -1567.100830, 29.887705, 0.016814, -0.015000, 1.547999 ) -- object27		createObject ( 931, 33073.587646, -1568.941040, 18.272045, 0.000000, 0.000000, 0.000000 ) -- object28		createObject ( 931, 3082.362793, -1571.329590, 18.261818, 0.000000, 0.000000, 0.000000 ) -- object29		createObject ( 931, 3090.188477, -1566.770020, 18.281372, 0.000000, 0.000000, 0.000000 ) -- object30		createObject ( 931, 3077.755615, -1578.640991, 18.264442, 0.000000, 0.000000, 0.000000 ) -- object31		createObject ( 931, 3071.379639, -1588.855957, 18.262592, 0.000000, 0.000000, 0.000000 ) -- object32		createObject ( 931, 3083.007324, -1582.473877, 18.248566, 0.000000, 0.000000, 0.000000 ) -- object33		createObject ( 931, 3089.307373, -1587.688232, 18.266483, 0.000000, 0.000000, 0.000000 ) -- object34		createObject ( 930, 3096.232422, -1578.851807, 17.695343, 0.000000, 0.000000, 0.000000 ) -- object35		createObject ( 1685, 3066.415283, -1588.878052, 5.761435, 0.000000, 0.000000, 0.000000 ) -- object36		createObject ( 1685, 3074.447510, -1583.628174, 5.751237, 0.000000, 0.000000, 0.000000 ) -- object37		createObject ( 1685, 3080.859131, -1586.320435, 5.734767, 0.000000, 0.000000, 0.000000 ) -- object38		createObject ( 1685, 3090.560547, -1588.100342, 5.759761, 0.000000, 0.000000, 0.000000 ) -- object39		createObject ( 1685, 3089.415527, -1574.631348, 5.758776, 0.000000, 0.000000, 0.000000 ) -- object40		createObject ( 1685, 3077.942139, -1570.809692, 5.753178, 0.000000, 0.000000, 0.000000 ) -- object41		createObject ( 1685, 3069.874512, -1564.598877, 5.768981, 0.000000, 0.000000, 0.000000 ) -- object42		hshot = textCreateDisplay ()		local txthshot = textCreateTextItem ( "BOOOM! Head Shot!!", 0.5, 0.204, "medium", 188, 20, 0, 255, 3.0 )		textDisplayAddText ( hshot, txthshot )		ashot = textCreateDisplay ()		local txtashot = textCreateTextItem ( "OUCH! Ass Shot!!", 0.5, 0.204, "medium", 188, 20, 0, 255, 3.0 )		textDisplayAddText ( hshot, txthshot )		monsterkill = textCreateDisplay ()		local txtmonsterkill = textCreateTextItem ( getClientName(killer)..": monsterkill!", 0.5, 0.204, "medium", 188, 20, 0, 255, 3.0 )		textDisplayAddText ( monsterkill, txtmonsterkill )		dominating = textCreateDisplay ()		local txtdominating = textCreateTextItem ( getClientName(killer).." is dominating!", 0.5, 0.204, "medium", 188, 20, 0, 255, 3.0 )		textDisplayAddText ( dominating, txtdominating )		godlike = textCreateDisplay ()		local txtgodlike = textCreateTextItem ( getClientName(killer).." is godlike!", 0.5, 0.204, "medium", 188, 20, 0, 255, 3.0 )		textDisplayAddText ( godlike, txtgodlike )		for index, player in getElementsByType ( "player" ) do -- for all the players			bindKey ( source, "t", "down", "tdown" )			bindKey ( source, "t", "up", "tup" )		end		floor1up = createMarker ( 3081.829102, -1597.984253, 9.168586, "corona", 2, 0, 255, 0, 50 )		setElementData ( floor1up, "type", "teleport" )		floor2up = createMarker ( 3081.205566, -1597.315308, 22.281012, "corona", 2, 0, 255, 0, 50 )		setElementData ( floor2up, "type", "teleport" )		floor2down = createMarker ( 3079.900391, -1560.759277, 21.883965, "corona", 2, 0, 255, 0, 50 )		setElementData ( floor2down, "type", "teleport" )		floor3down = createMarker ( 3080.171387, -1561.150146, 33.186592, "corona", 2, 0, 255, 0, 50 )		setElementData ( floor3down, "type", "teleport" )	endend-- ##################################################################################################################addEventHandler ( "onPlayerSpawn", getRootElement(), "OnPlayerSpawn" ) -- Defining OnPlayerSpawnfunction OnPlayerSpawn ( player ) -- Calling OnPlayerSpawn	outputChatBox ( "Use t when you're in a checkpoint to teleport.", player, 255, 115, 0 )	giveWeapon ( player, 24, 5000 )	giveWeapon ( player, 4, 1 )end-- ##################################################################################################################addEventHandler ( "onPlayerJoin", getRootElement(), "OnPlayerJoin" ) -- Defining OnPlayerJoinfunction OnPlayerJoin ( player ) -- Calling OnpPlayerJoin	kills[player] = 0	istdown[player] = 0	bindKey ( source, "t", "down", "tdown" )	bindKey ( source, "t", "up", "tup" )end-- ##################################################################################################################function tdown ( source, key, keyState )	istdown[source] = 1end-- ##################################################################################################################function tup ( source, key, keyState )	istdown[source] = 0end-- ##################################################################################################################addEventHandler ( "onPlayerWasted", getRootElement(), "OnPlayerDied" ) -- Defining OnPlayerDiedfunction OnPlayerDied ( totalammo, killer, killerweapon, bodypart ) -- Calling OnPlayerDied	-- Obtaining nick and color of the killed player	local playerid = getClientName ( source )	local r,g,b = getPlayerNametagColor ( source )	if bodypart == 9 then -- Checking if you made a headshot		textDisplayAddObserver ( hshot, killer ) -- Boom! headshot :D		setTimer ( "textDisplayRemoveObserver", 3000, 1, hshot, killer )		outputMessage ( getClientName(killer).." headshot!", 255, 100, 100 )	end	if bodypart == 4 then -- Checking if you made an ass shot		textDisplayAddObserver ( ashot, killer ) -- Boom! AssShot :D		setTimer ( "textDisplayRemoveObserver", 3000, 1, ashot, killer )		outputMessage ( getClientName(killer).." ass shot!", 255, 100, 100 )	end	if ( killer ) then		kills[source] = 0		-- Checking if the player suicided		if (source == killer) then			playerid = "himself"		else			kills[killer] = kills[killer] + 1		end		if (kills[killer] == 5) then			textDisplayAddObserver ( monsterkill, root ) -- Monsterkill! :O			setTimer ( "textDisplayRemoveObserver", 3000, 1, monsterkill, root )		end		if (kills[killer] == 10) then			textDisplayAddObserver ( dominating, root ) -- Dominating! ^_^			setTimer ( "textDisplayRemoveObserver", 3000, 1, dominating, root )		end		if (kills[killer] == 15) then			textDisplayAddObserver ( godlike, root ) -- GodLike! O_O			setTimer ( "textDisplayRemoveObserver", 3000, 1, godlike, root )		end		-- Formatting a message like -a has killed b using weaponname-		local killtext = getClientName(killer).." has killed "..playerid		-- Obtaining killer's weapon		local wnKiller = getWeaponNameFromID ( killerweapon )		-- Sending the message		if ( wnKiller ) then			outputMessage( killtext.." using a "..wnKiller..".",  r, g, b, 255 )		else			outputMessage( killtext, r, g, b, 255 )		end	else		outputMessage( playerid.." died.", r, g, b, 255 )	endend-- ##################################################################################################################addEventHandler ( "onMarkerHit", floor1up, "gotoFloor2" )addEventHandler ( "onMarkerHit", floor2up, "gotoFloor3" )addEventHandler ( "onMarkerHit", floor3down, "gotoFloor2" )addEventHandler ( "onMarkerHit", floor2down, "gotoFloor1" )-- ##################################################################################################################function gotoFloor1	if ( istdown[source] == 1 ) then		local x, y, z = getElementPosition ( floor1up )		setElementPosition ( player, x, y, z )	endend-- ##################################################################################################################function gotoFloor2	if ( istdown[source] == 1 ) then		local x, y, z = getElementPosition ( floor2up )		setElementPosition ( player, x, y, z )	endend-- ##################################################################################################################function gotoFloor3	if ( istdown[source] == 1 ) then		local x, y, z = getElementPosition ( floor3down )		setElementPosition ( player, x, y, z )	endend