☻ᶠᶸᶜᵏᵧₒᵤ☻ Posted June 28, 2013 Share Posted June 28, 2013 I am creating a gamemode zombies and I have a problem, I have a script that serves to change the skin to the player when he dies. The only problem is that after dying and respawnato no longer has the skin changed, but the one before, for example I want my character after being dead and appeared to have the skin 237, as I do? Will you help me? Link to comment
fmj02 Posted June 28, 2013 Share Posted June 28, 2013 Your english is not understandable, you mean that your script changes the skin when specified player dies only once? For now not your code is a secret but your problem. Link to comment
☻ᶠᶸᶜᵏᵧₒᵤ☻ Posted June 28, 2013 Author Share Posted June 28, 2013 I'm Italian I want to ask, how do I do that once the character dies change skin in 137?? Sorry for my bad inglish! Link to comment
fmj02 Posted June 28, 2013 Share Posted June 28, 2013 You better show your code instead of ineffective trying to describe this problem. Link to comment
☻ᶠᶸᶜᵏᵧₒᵤ☻ Posted June 28, 2013 Author Share Posted June 28, 2013 okok This is the script : addEventHandler ( "onPlayerWasted", root, function ( ) setPedSkin ( source, 137 ) outputChatBox ( "You are now a Zombie.", source, 255, 0, 0 ) end ) Link to comment
denny199 Posted June 28, 2013 Share Posted June 28, 2013 use spawnPlayer with onPlayerWasted Link to comment
☻ᶠᶸᶜᵏᵧₒᵤ☻ Posted June 28, 2013 Author Share Posted June 28, 2013 Can you help me to apply SpawnPlayer with OnPlayerWasted?? Please! Link to comment
fmj02 Posted June 28, 2013 Share Posted June 28, 2013 addEventHandler ( "onPlayerWasted", root, function ( ) local x,y,z = 0,0,0 -- your position to spawn player spawnPlayer( source, x, y, z, 0, 137 ) outputChatBox ( "You are now a Zombie.", source, 255, 0, 0 ) end ) Link to comment
☻ᶠᶸᶜᵏᵧₒᵤ☻ Posted June 28, 2013 Author Share Posted June 28, 2013 thx! But don't work! LOOL, does nothing can you help me another thing too? I have a problem with a gamemode Here is a map of the gamemode: With this options, the weapons the weapons have been chosen for all groups, how do I put the group zombies have a knife and that humans have a Deagle? if you need the code for the gamemode, just ask! Link to comment
fmj02 Posted June 28, 2013 Share Posted June 28, 2013 Your gamemode is simple, just make two teams named humans and zombies or whatever and use the setPlayerTeam to assign new player to humans when he/she dies then onPlayerWasted is called, so just change the team on zombies, make a table containing the weapons and skins for each team and assign them inside onPlayerSpawn checking the team with getPlayerTeam, to make a round system just make a function named endRound and set the timer to call it after some time. You don't need a map for that, if you want to disallow zombies picking some pickup just use cancelEvent in OnPickupHit also using getPlayerTeam. It's all possible with just few functions. Don't go off the deep end, it's hard to make own gamemode if it's your first language ever. Link to comment
☻ᶠᶸᶜᵏᵧₒᵤ☻ Posted June 28, 2013 Author Share Posted June 28, 2013 this map is for the gamemode "aa" Download : https://community.multitheftauto.com/in ... ils&id=478 In this gamemode there is one team "Survivals" and a weapons for this team, but i have modified this gamamode and I put two teams "Survivals" and "Zombies". how do I put weapons for zombies? Thnx Gamemode aa CODE : local aa_root = getRootElement() teamSurvivor = createTeam ( "Humans", 0, 255, 0 ) teamZombies = createTeam ( "Zombies", 255, 0, 0 ) function loadmap(startmap, player) mapRoot = getResourceRootElement(startmap) local plrs = getElementsByType( "player" ); for i, plr in pairs( plrs ) do setElementData( plr, "Deaths", 0 ) -- ////////////////// MISION \\\\\\\\\\\\\\\\\\ local total_markers = getElementChildrenCount( getElementByID( "markers" ) ) local num = math.random( 0, total_markers - 1 ) local marker_spawn = getElementChild ( getElementByID( "markers" ), num) local mx = getElementData ( marker_spawn, "posX" ) local my = getElementData ( marker_spawn, "posY" ) local mz = getElementData ( marker_spawn, "posZ" ) setPlayerTeam ( plr, teamSurvivor ) objectiveMarker = createMarker(mx, my, mz) -- ///////////////// SPAWN \\\\\\\\\\\\\\\\\\\\ local total_spawns = getElementChildrenCount( getElementByID( "spawns" ) ) local num = math.random( 0, total_spawns - 1 ) local spawn_random = getElementChild ( getElementByID( "spawns" ), num ) local x = getElementData ( spawn_random, "posX" ) local y = getElementData ( spawn_random, "posY" ) local z = getElementData ( spawn_random, "posZ" ) local rot = getElementData ( spawn_random, "rot" ) setTimer( setPedSkin , 500 , 1 , plr, math.random(9,288)) spawnPlayer( plr, x, y, z, rot); setCameraTarget ( plr, plr ); fadeCamera( plr, true ); for k,v in ipairs( getElementChildren( getElementByID( "armas" ) ) ) do giveWeapon( plr, tonumber( getElementData( v, "id" ) ), getElementData( v, "ammo" ) ) end end end addEventHandler("onGamemodeMapStart", aa_root, loadmap) function aa_onResourceStart( resourcename, res ) setTeamFriendlyFire(teamSurvivor , false ) if ( resourcename == getThisResource () ) then local plrs = getElementsByType( "player" ); for i, plr in pairs( plrs ) do setElementData( plr, "Deaths", 0 ) end setTimer( call, 1000, 1, getResourceFromName ("scoreboard"), "addScoreboardColumn", "Deaths" ) end if resourceName == 'mapmanager' then mapmanager = createResourceCallInterface ('mapmanager') end end addEventHandler( "onResourceStart", aa_root, aa_onResourceStart ) function joinHandler() local total_spawns = getElementChildrenCount( getElementByID( "spawns" ) ) local num = math.random( 0, total_spawns - 1 ) local spawn_random = getElementChild ( getElementByID( "spawns" ), num ) local x = getElementData ( spawn_random, "posX" ) local y = getElementData ( spawn_random, "posY" ) local z = getElementData ( spawn_random, "posZ" ) local rot = getElementData ( spawn_random, "rot" ) setElementData( source, "inmarker", false ); setPlayerTeam ( source, teamSurvivor ) spawnPlayer( source, x, y, z, rot ) setTimer( setPedSkin , 500 , 1 , source, math.random (9,288)) outputChatBox("< Welcome To Against All By CHAOS_IS_ME>", source, 255, 138, 0, true) outputChatBox("< Current Version: #00FF00 1.0>", source, 255, 138, 0, true) setCameraTarget ( source, source ) setElementData( source, "Deaths", 0 ) fadeCamera(source, true) for k,v in ipairs( getElementChildren( getElementByID( "armas" ) ) ) do giveWeapon( source, tonumber( getElementData( v, "id" ) ), getElementData( v, "ammo" ) ) end end addEventHandler("onPlayerJoin", aa_root, joinHandler) function aa_playerWasted( totalAmmo, killer ) local playerdeaths = getElementData ( source, "Deaths" ) setElementData ( source, "Deaths", playerdeaths+1 ) local total_spawns = getElementChildrenCount( getElementByID( "spawns" ) ) local num = math.random( 0, total_spawns - 1 ) local skin = math.random(9,288) local spawn_random = getElementChild ( getElementByID( "spawns" ), num ) local x = getElementData ( spawn_random, "posX" ) local y = getElementData ( spawn_random, "posY" ) local z = getElementData ( spawn_random, "posZ" ) local rot = getElementData ( spawn_random, "rot" ) setPlayerTeam ( source, teamSurvivor ) setTimer( spawnPlayer , 5000 , 1 , source, x, y, z, rot) setTimer( setPedSkin , 5000 , 1 , source, math.random (128,161)) setCameraTarget ( source, source ) fadeCamera(source, true) for k,v in ipairs( getElementChildren( getElementByID( "armas" ) ) ) do setTimer( giveWeapon, 5000 , 1 , source, tonumber( getElementData( v, "id" ) ), getElementData( v, "ammo" ) ) end end addEventHandler ( "onPlayerWasted", aa_root, aa_playerWasted ) local localPlayerName = getPlayerName(aa_root) -- misiones function MarkerHit1 ( hitPlayer, matchingDimension ) local plrs = getElementsByType( "player" ); for i, plr in pairs( plrs ) do WinDisplay = textCreateDisplay () setTimer( textDisplayAddText, 800, 1, WinDisplay, WinText ) -- textDisplayAddText ( WinDisplay, WinText ) WinText = textCreateTextItem ( getPlayerName(hitPlayer) .. " WIN! Next Map In 10 Seconds", 0.5, 0.5, "low", 255, 0, 0, 255, 2, "center" ) textDisplayAddObserver ( WinDisplay, plr) setElementData( hitPlayer, "inmarker", true ) setTimer( textDestroyTextItem, 5000, 1, WinText ) setTimer(StartNextMap,10000,1) setPedFrozen ( aa_root, true ) setTimer( setPedFrozen, 10000, 1, aa_root, false ) end end addEventHandler("onMarkerHit", aa_root, MarkerHit1) function StartNextMap () exports.mapmanager:changeGamemode( getResourceFromName ('aa') ) end --[[function unassignTeam2 ( source, commandName ) -- this player is on a team, so we can remove them from it setPlayerTeam ( source, teamHuwmans ) -- remove the player from the current team end addCommandHandler ( "team3", unassignTeam2 ) function unassignTeam1 ( source, commandName ) -- this player is on a team, so we can remove them from it setPlayerTeam ( source, "Survivors" ) -- remove the player from the current team end addCommandHandler ( "team2", unassignTeam1 ) function unassignTeam ( source, commandName ) -- this player is on a team, so we can remove them from it setPlayerTeam ( source, Survivors ) -- remove the player from the current team end addCommandHandler ( "team1", unassignTeam ) ]]-- -- misiones addEventHandler ( "onPlayerWasted", root, function ( ) local humans = getTeamFromName ( "Humans" ) if ( getTeamName ( getPlayerTeam ( source ) ) == "Humans" ) then setPlayerTeam ( source, getTeamFromName ( "Zombies" ) ) else return end end ) addEventHandler ( "onPlayerWasted", root, function ( ) setPedSkin ( source, 137 ) setPedHeadless ( source, true ) outputChatBox ( "You are now a Zombie.", source, 255, 0, 0 ) end ) addEventHandler ( "onPlayerDamage", getRootElement(), rewardOnWasted ) infection = createPickup (-1, 1, 3.11, 3, 1275, 15000 ) function infected ( thePlayer ) setPlayerTeam ( thePlayer, teamZombies ) setPedSkin ( thePlayer, 13 ) setPedHeadless ( thePlayer, true ) end addEventHandler ( "onPickupUse", infection, infected ) Link to comment
fmj02 Posted June 28, 2013 Share Posted June 28, 2013 There is a loop in this code which gives weapons to elements with id "armas", the id of those elements was set with setElementID, so just set the id and make same loop. That could be done easier, the code of this gamemode is ugly. Link to comment
☻ᶠᶸᶜᵏᵧₒᵤ☻ Posted June 28, 2013 Author Share Posted June 28, 2013 Would you help me to put the weapons for the group zombies? Please! Link to comment
fmj02 Posted June 28, 2013 Share Posted June 28, 2013 Sets a skin and gives knife. addEventHandler("onPlayerSpawn", root, function() if(getPlayerTeam(source) == teamZombies) then local weaponsToGive = { { id = 4, ammo = 30, setAsCurrent = true }, -- your knife } for _, v in ipairs(weaponsToGive) do giveWeapon(source, v.id, v.ammo, v.setAsCurrent) end setElementModel(source, 137) end end ) Link to comment
☻ᶠᶸᶜᵏᵧₒᵤ☻ Posted June 28, 2013 Author Share Posted June 28, 2013 Where do I copy the code? Link to comment
fmj02 Posted June 28, 2013 Share Posted June 28, 2013 It doesn't matter, even at the bottom. Link to comment
☻ᶠᶸᶜᵏᵧₒᵤ☻ Posted June 28, 2013 Author Share Posted June 28, 2013 ok, I put it no longer works the gamemode Link to comment
fmj02 Posted June 28, 2013 Share Posted June 28, 2013 It works 100%, you had to make something wrong. Please upload somewhere your code because it's too big to post it here. Link to comment
☻ᶠᶸᶜᵏᵧₒᵤ☻ Posted June 28, 2013 Author Share Posted June 28, 2013 Now I'll show you the code that you think should work: local aa_root = getRootElement() teamSurvivor = createTeam ( "Humans", 0, 255, 0 ) teamZombies = createTeam ( "Zombies", 255, 0, 0 ) function loadmap(startmap, player) mapRoot = getResourceRootElement(startmap) local plrs = getElementsByType( "player" ); for i, plr in pairs( plrs ) do setElementData( plr, "Deaths", 0 ) -- ////////////////// MISION \\\\\\\\\\\\\\\\\\ local total_markers = getElementChildrenCount( getElementByID( "markers" ) ) local num = math.random( 0, total_markers - 1 ) local marker_spawn = getElementChild ( getElementByID( "markers" ), num) local mx = getElementData ( marker_spawn, "posX" ) local my = getElementData ( marker_spawn, "posY" ) local mz = getElementData ( marker_spawn, "posZ" ) setPlayerTeam ( plr, teamSurvivor ) objectiveMarker = createMarker(mx, my, mz) -- ///////////////// SPAWN \\\\\\\\\\\\\\\\\\\\ local total_spawns = getElementChildrenCount( getElementByID( "spawns" ) ) local num = math.random( 0, total_spawns - 1 ) local spawn_random = getElementChild ( getElementByID( "spawns" ), num ) local x = getElementData ( spawn_random, "posX" ) local y = getElementData ( spawn_random, "posY" ) local z = getElementData ( spawn_random, "posZ" ) local rot = getElementData ( spawn_random, "rot" ) setTimer( setPedSkin , 500 , 1 , plr, math.random(9,288)) spawnPlayer( plr, x, y, z, rot); setCameraTarget ( plr, plr ); fadeCamera( plr, true ); for k,v in ipairs( getElementChildren( getElementByID( "armas" ) ) ) do giveWeapon( plr, tonumber( getElementData( v, "id" ) ), getElementData( v, "ammo" ) ) end end end addEventHandler("onGamemodeMapStart", aa_root, loadmap) function aa_onResourceStart( resourcename, res ) setTeamFriendlyFire(teamSurvivor , false ) if ( resourcename == getThisResource () ) then local plrs = getElementsByType( "player" ); for i, plr in pairs( plrs ) do setElementData( plr, "Deaths", 0 ) end setTimer( call, 1000, 1, getResourceFromName("scoreboard"), "addScoreboardColumn", "Deaths" ) end if resourceName == 'mapmanager' then mapmanager = createResourceCallInterface('mapmanager') end end addEventHandler( "onResourceStart", aa_root, aa_onResourceStart ) function joinHandler() local total_spawns = getElementChildrenCount( getElementByID( "spawns" ) ) local num = math.random( 0, total_spawns - 1 ) local spawn_random = getElementChild ( getElementByID( "spawns" ), num ) local x = getElementData ( spawn_random, "posX" ) local y = getElementData ( spawn_random, "posY" ) local z = getElementData ( spawn_random, "posZ" ) local rot = getElementData ( spawn_random, "rot" ) setElementData( source, "inmarker", false ); setPlayerTeam ( source, teamSurvivor ) spawnPlayer( source, x, y, z, rot ) setTimer( setPedSkin , 500 , 1 , source, math.random(9,288)) outputChatBox("< Welcome To Against All By CHAOS_IS_ME>", source, 255, 138, 0, true) outputChatBox("< Current Version: #00FF00 1.0>", source, 255, 138, 0, true) setCameraTarget ( source, source ) setElementData( source, "Deaths", 0 ) fadeCamera(source, true) for k,v in ipairs( getElementChildren( getElementByID( "armas" ) ) ) do giveWeapon( source, tonumber( getElementData( v, "id" ) ), getElementData( v, "ammo" ) ) end end addEventHandler("onPlayerJoin", aa_root, joinHandler) function aa_playerWasted( totalAmmo, killer ) local playerdeaths = getElementData ( source, "Deaths" ) setElementData ( source, "Deaths", playerdeaths+1 ) local total_spawns = getElementChildrenCount( getElementByID( "spawns" ) ) local num = math.random( 0, total_spawns - 1 ) local skin = math.random(9,288) local spawn_random = getElementChild ( getElementByID( "spawns" ), num ) local x = getElementData ( spawn_random, "posX" ) local y = getElementData ( spawn_random, "posY" ) local z = getElementData ( spawn_random, "posZ" ) local rot = getElementData ( spawn_random, "rot" ) setPlayerTeam ( source, teamSurvivor ) setTimer( spawnPlayer , 5000 , 1 , source, x, y, z, rot) setTimer( setPedSkin , 5000 , 1 , source, math.random(128,161)) setCameraTarget ( source, source ) fadeCamera(source, true) for k,v in ipairs( getElementChildren( getElementByID( "armas" ) ) ) do setTimer( giveWeapon, 5000 , 1 , source, tonumber( getElementData( v, "id" ) ), getElementData( v, "ammo" ) ) end end addEventHandler ( "onPlayerWasted", aa_root, aa_playerWasted ) local localPlayerName = getPlayerName(aa_root) -- misiones function MarkerHit1 ( hitPlayer, matchingDimension ) local plrs = getElementsByType( "player" ); for i, plr in pairs( plrs ) do WinDisplay = textCreateDisplay () setTimer( textDisplayAddText, 800, 1, WinDisplay, WinText ) -- textDisplayAddText ( WinDisplay, WinText ) WinText = textCreateTextItem ( getPlayerName(hitPlayer) .. " WIN! Next Map In 10 Seconds", 0.5, 0.5, "low", 255, 0, 0, 255, 2, "center" ) textDisplayAddObserver ( WinDisplay, plr) setElementData( hitPlayer, "inmarker", true ) setTimer( textDestroyTextItem, 5000, 1, WinText ) setTimer(StartNextMap,10000,1) setPedFrozen ( aa_root, true ) setTimer( setElementFrozen, 10000, 1, aa_root, false ) end end addEventHandler("onMarkerHit", aa_root, MarkerHit1) function StartNextMap () exports.mapmanager:changeGamemode( getResourceFromName('aa') ) end --[[function unassignTeam2 ( source, commandName ) -- this player is on a team, so we can remove them from it setPlayerTeam ( source, teamHuwmans ) -- remove the player from the current team end addCommandHandler ( "team3", unassignTeam2 ) function unassignTeam1 ( source, commandName ) -- this player is on a team, so we can remove them from it setPlayerTeam ( source, "Survivors" ) -- remove the player from the current team end addCommandHandler ( "team2", unassignTeam1 ) function unassignTeam ( source, commandName ) -- this player is on a team, so we can remove them from it setPlayerTeam ( source, Survivors ) -- remove the player from the current team end addCommandHandler ( "team1", unassignTeam ) ]]-- -- misiones addEventHandler ( "onPlayerWasted", root, function ( ) local humans = getTeamFromName ( "Humans" ) if ( getTeamName ( getPlayerTeam ( source ) ) == "Humans" ) then setPlayerTeam ( source, getTeamFromName ( "Zombies" ) ) else return end end ) addEventHandler ( "onPlayerWasted", root, function ( ) setPedSkin ( source, 137 ) setPedHeadless ( source, true ) outputChatBox ( "You are now a Zombie.", source, 255, 0, 0 ) end ) addEventHandler ( "onPlayerDamage", getRootElement(), rewardOnWasted ) infection = createPickup (-1, 1, 3.11, 3, 1275, 15000 ) function infected ( thePlayer ) setPlayerTeam ( thePlayer, teamZombies ) setPedSkin ( thePlayer, 13 ) setPedHeadless ( thePlayer, true ) end addEventHandler ( "onPickupUse", infection, infected ) addEventHandler("onPlayerSpawn", root, function() if(getPlayerTeam(source) == teamZombies) then local weaponsToGive = { { id = 4, ammo = 30, setAsCurrent = true }, -- your knife } for _, v in ipairs(weaponsToGive) do giveWeapon(source, v.id, v.ammo, v.setAsCurrent) end setElementModel(source, 137) end end ) I do not work, why? Link to comment
fmj02 Posted June 28, 2013 Share Posted June 28, 2013 You haven't even set zombie team, why do you expect it to work? Now when you die, you are zombie and after 5 seconds you get spawned with the knife and new skin. If it doesn't work just check error logs, I just modified few lines. local aa_root = getRootElement() teamSurvivor = createTeam ( "Humans", 0, 255, 0 ) teamZombies = createTeam ( "Zombies", 255, 0, 0 ) function loadmap(startmap, player) mapRoot = getResourceRootElement(startmap) local plrs = getElementsByType( "player" ); for i, plr in pairs( plrs ) do setElementData( plr, "Deaths", 0 ) -- ////////////////// MISION \\\\\\\\\\\\\\\\\\ local total_markers = getElementChildrenCount( getElementByID( "markers" ) ) local num = math.random( 0, total_markers - 1 ) local marker_spawn = getElementChild ( getElementByID( "markers" ), num) local mx = getElementData ( marker_spawn, "posX" ) local my = getElementData ( marker_spawn, "posY" ) local mz = getElementData ( marker_spawn, "posZ" ) setPlayerTeam ( plr, teamSurvivor ) objectiveMarker = createMarker(mx, my, mz) -- ///////////////// SPAWN \\\\\\\\\\\\\\\\\\\\ local total_spawns = getElementChildrenCount( getElementByID( "spawns" ) ) local num = math.random( 0, total_spawns - 1 ) local spawn_random = getElementChild ( getElementByID( "spawns" ), num ) local x = getElementData ( spawn_random, "posX" ) local y = getElementData ( spawn_random, "posY" ) local z = getElementData ( spawn_random, "posZ" ) local rot = getElementData ( spawn_random, "rot" ) setTimer( setPedSkin , 500 , 1 , plr, math.random(9,288)) spawnPlayer( plr, x, y, z, rot); setCameraTarget ( plr, plr ); fadeCamera( plr, true ); for k,v in ipairs( getElementChildren( getElementByID( "armas" ) ) ) do giveWeapon( plr, tonumber( getElementData( v, "id" ) ), getElementData( v, "ammo" ) ) end end end addEventHandler("onGamemodeMapStart", aa_root, loadmap) function aa_onResourceStart( resourcename, res ) setTeamFriendlyFire(teamSurvivor , false ) if ( resourcename == getThisResource () ) then local plrs = getElementsByType( "player" ); for i, plr in pairs( plrs ) do setElementData( plr, "Deaths", 0 ) end setTimer( call, 1000, 1, getResourceFromName("scoreboard"), "addScoreboardColumn", "Deaths" ) end if resourceName == 'mapmanager' then mapmanager = createResourceCallInterface('mapmanager') end end addEventHandler( "onResourceStart", aa_root, aa_onResourceStart ) function joinHandler() local total_spawns = getElementChildrenCount( getElementByID( "spawns" ) ) local num = math.random( 0, total_spawns - 1 ) local spawn_random = getElementChild ( getElementByID( "spawns" ), num ) local x = getElementData ( spawn_random, "posX" ) local y = getElementData ( spawn_random, "posY" ) local z = getElementData ( spawn_random, "posZ" ) local rot = getElementData ( spawn_random, "rot" ) setElementData( source, "inmarker", false ); setPlayerTeam ( source, teamSurvivor ) spawnPlayer( source, x, y, z, rot ) setTimer( setPedSkin , 500 , 1 , source, math.random(9,288)) outputChatBox("< Welcome To Against All By CHAOS_IS_ME>", source, 255, 138, 0, true) outputChatBox("< Current Version: #00FF00 1.0>", source, 255, 138, 0, true) setCameraTarget ( source, source ) setElementData( source, "Deaths", 0 ) fadeCamera(source, true) for k,v in ipairs( getElementChildren( getElementByID( "armas" ) ) ) do giveWeapon( source, tonumber( getElementData( v, "id" ) ), getElementData( v, "ammo" ) ) end end addEventHandler("onPlayerJoin", aa_root, joinHandler) function aa_playerWasted( totalAmmo, killer ) local playerdeaths = getElementData ( source, "Deaths" ) setElementData ( source, "Deaths", playerdeaths+1 ) local total_spawns = getElementChildrenCount( getElementByID( "spawns" ) ) local num = math.random( 0, total_spawns - 1 ) local skin = math.random(9,288) local spawn_random = getElementChild ( getElementByID( "spawns" ), num ) local x = getElementData ( spawn_random, "posX" ) local y = getElementData ( spawn_random, "posY" ) local z = getElementData ( spawn_random, "posZ" ) local rot = getElementData ( spawn_random, "rot" ) setPlayerTeam ( source, teamZombies ) setTimer( spawnPlayer , 5000 , 1 , source, x, y, z, rot) setCameraTarget ( source, source ) fadeCamera(source, true) --[[ idk what the fuck is dat for k,v in ipairs( getElementChildren( getElementByID( "armas" ) ) ) do setTimer( giveWeapon, 5000 , 1 , source, tonumber( getElementData( v, "id" ) ), getElementData( v, "ammo" ) ) end]] end addEventHandler ( "onPlayerWasted", aa_root, aa_playerWasted ) local localPlayerName = getPlayerName(aa_root) -- misiones function MarkerHit1 ( hitPlayer, matchingDimension ) local plrs = getElementsByType( "player" ); for i, plr in pairs( plrs ) do WinDisplay = textCreateDisplay () setTimer( textDisplayAddText, 800, 1, WinDisplay, WinText ) -- textDisplayAddText ( WinDisplay, WinText ) WinText = textCreateTextItem ( getPlayerName(hitPlayer) .. " WIN! Next Map In 10 Seconds", 0.5, 0.5, "low", 255, 0, 0, 255, 2, "center" ) textDisplayAddObserver ( WinDisplay, plr) setElementData( hitPlayer, "inmarker", true ) setTimer( textDestroyTextItem, 5000, 1, WinText ) setTimer(StartNextMap,10000,1) setPedFrozen ( aa_root, true ) setTimer( setElementFrozen, 10000, 1, aa_root, false ) end end addEventHandler("onMarkerHit", aa_root, MarkerHit1) function StartNextMap () exports.mapmanager:changeGamemode( getResourceFromName('aa') ) end infection = createPickup (-1, 1, 3.11, 3, 1275, 15000 ) function infected ( thePlayer ) setPlayerTeam ( thePlayer, teamZombies ) setPedSkin ( thePlayer, 13 ) setPedHeadless ( thePlayer, true ) end addEventHandler ( "onPickupUse", infection, infected ) addEventHandler("onPlayerSpawn", root, function() if(getPlayerTeam(source) == teamZombies) then local weaponsToGive = { { id = 4, ammo = 30, setAsCurrent = true }, -- your knife } for _, v in ipairs(weaponsToGive) do giveWeapon(source, v.id, v.ammo, v.setAsCurrent) end setElementModel(source, 137) setPedHeadless ( source, true ) outputChatBox ( "You are now a Zombie.", source, 255, 0, 0 ) end end ) Link to comment
☻ᶠᶸᶜᵏᵧₒᵤ☻ Posted June 28, 2013 Author Share Posted June 28, 2013 FUNZIONA !!!! (Use Google Traduttore) hahahah LOOOOL okok, you are the best! one last thing How to do that if humans are gone, you switch to the next map? Link to comment
fmj02 Posted June 28, 2013 Share Posted June 28, 2013 You will have to remove auto-respawn to make it working, otherwise the team will be always alive(if the server has players) function AreSurvivorsGone() local t = {} for _, v in ipairs(getPlayersInTeam(teamSurvivor)) do if isPedDead(v) then table.insert(t, v) end end if #t == getPlayersInTeam(teamSurvivor) then return true end return false end addEventHandler("onPlayerWasted", root, function() if AreSurvivorsGone() then -- function for changing the map end end ) Link to comment
☻ᶠᶸᶜᵏᵧₒᵤ☻ Posted June 28, 2013 Author Share Posted June 28, 2013 I did not understand, with this code I have to do? Link to comment
Castillo Posted June 28, 2013 Share Posted June 28, 2013 Put it on your script, and add this function after "AreSurvivorsGone()" at "onPlayerWasted": exports.mapmanager:changeGamemode( getResourceFromName('aa') ) Link to comment
☻ᶠᶸᶜᵏᵧₒᵤ☻ Posted July 7, 2013 Author Share Posted July 7, 2013 sorry, but don't work, can you help me? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now