Mefisto_PL Posted January 3, 2012 Share Posted January 3, 2012 I have not working script that save skin and money.. How to fix that? function joinHandler ( ) spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, skin, 0) fadeCamera (source, true) setCameraTarget ( source, source ) end addEventHandler ( "onPlayerJoin" , getRootElement ( ) , joinHandler ) function spawnWasted(player, skin) repeat until spawnPlayer ( player, -2655.02, 625.30, 14.45, 180, skin, 0) fadeCamera(player, true) setCameraTarget(player, player) end addEventHandler("onPlayerWasted", root, function() setTimer(spawnWasted, 1800, 1, source, getElementModel(source)) end ) function greetPlayer ( ) outputChatBox ( "Witaj na Polskim Serwerze Zabawy stworzonym przez Mefisto_PL !" , source, 0, 159, 255 ) end addEventHandler ( "onPlayerLogin", getRootElement(), greetPlayer ) function onPlayerQuit() local playerAccount = getPlayerAccount(source) if (playerAccount) then local playerMoney = getPlayerMoney(source) local playerSkin = getPlayerSkin(source) setAccountData(playerAccount, "money", playerMoney) setAccountData(playerAccount, "skin", playerSkin) end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) function onPlayerLogin() local playerAccount = getPlayerAccount(source) if (playerAccount) then local playerMoney = getAccountData(playerAccount, "money") local playerSkin = getAccountData(playerAccount, "skin") if (playerMoney, playerSkin) then setPlayerMoney(source, playerMoney) setPlayerSkin(source, playerSkin) end end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) Link to comment
JR10 Posted January 3, 2012 Share Posted January 3, 2012 There is no function called getPlayerSkin, use getElementModel instead. skin in joinHandler is not defined. function joinHandler ( ) --spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, skin, 0) spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, 0, 0) fadeCamera (source, true) setCameraTarget ( source, source ) end addEventHandler ( "onPlayerJoin" , getRootElement ( ) , joinHandler ) function spawnWasted(player, skin) repeat until spawnPlayer ( player, -2655.02, 625.30, 14.45, 180, skin, 0) fadeCamera(player, true) setCameraTarget(player, player) end addEventHandler("onPlayerWasted", root, function() setTimer(spawnWasted, 1800, 1, source, getElementModel(source)) end ) function greetPlayer ( ) outputChatBox ( "Witaj na Polskim Serwerze Zabawy stworzonym przez Mefisto_PL !" , source, 0, 159, 255 ) end addEventHandler ( "onPlayerLogin", getRootElement(), greetPlayer ) function onPlayerQuit() local playerAccount = getPlayerAccount(source) if (playerAccount) and not isGuestAccount(playerAccount) then local playerMoney = getPlayerMoney(source) local playerSkin = getElementModel(source) setAccountData(playerAccount, "money", playerMoney) setAccountData(playerAccount, "skin", playerSkin) end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) function onPlayerLogin() local playerAccount = getPlayerAccount(source) if (playerAccount) then local playerMoney = getAccountData(playerAccount, "money") local playerSkin = getAccountData(playerAccount, "skin") if (playerMoney, playerSkin) then setPlayerMoney(source, playerMoney) setPlayerSkin(source, playerSkin) end end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) Link to comment
Mefisto_PL Posted January 3, 2012 Author Share Posted January 3, 2012 Spawn with CJ skin and bugged Link to comment
JR10 Posted January 3, 2012 Share Posted January 3, 2012 function joinHandler ( ) --spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, skin, 0) spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, 0, 0) fadeCamera (source, true) setCameraTarget ( source, source ) end addEventHandler ( "onPlayerJoin" , getRootElement ( ) , joinHandler ) function spawnWasted(player, skin) repeat until spawnPlayer ( player, -2655.02, 625.30, 14.45, 180, skin, 0) fadeCamera(player, true) setCameraTarget(player, player) end addEventHandler("onPlayerWasted", root, function() setTimer(spawnWasted, 1800, 1, source, getElementModel(source)) end ) function greetPlayer ( ) outputChatBox ( "Witaj na Polskim Serwerze Zabawy stworzonym przez Mefisto_PL !" , source, 0, 159, 255 ) end addEventHandler ( "onPlayerLogin", getRootElement(), greetPlayer ) function onPlayerQuit() local playerAccount = getPlayerAccount(source) if (playerAccount) and not isGuestAccount(playerAccount) then local playerMoney = getPlayerMoney(source) local playerSkin = getElementModel(source) setAccountData(playerAccount, "money", playerMoney) setAccountData(playerAccount, "skin", playerSkin) end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) function onPlayerLogin() local playerAccount = getPlayerAccount(source) if (playerAccount) then local playerMoney = tonumber(getAccountData(playerAccount, "money")) local playerSkin = tonumber(getAccountData(playerAccount, "skin")) if (playerMoney, playerSkin) then setPlayerMoney(source, playerMoney) setElementModel(source, playerSkin) end end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) Try that. Spawns with cj because you haven't logged in yet, you must login first. Link to comment
Castillo Posted January 3, 2012 Share Posted January 3, 2012 function joinHandler ( ) --spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, skin, 0) spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, 0, 0) fadeCamera (source, true) setCameraTarget ( source, source ) end addEventHandler ( "onPlayerJoin" , getRootElement ( ) , joinHandler ) function spawnWasted(player, skin) repeat until spawnPlayer ( player, -2655.02, 625.30, 14.45, 180, skin, 0) fadeCamera(player, true) setCameraTarget(player, player) end addEventHandler("onPlayerWasted", root, function() setTimer(spawnWasted, 1800, 1, source, getElementModel(source)) end ) function greetPlayer ( ) outputChatBox ( "Witaj na Polskim Serwerze Zabawy stworzonym przez Mefisto_PL !" , source, 0, 159, 255 ) end addEventHandler ( "onPlayerLogin", getRootElement(), greetPlayer ) function onPlayerQuit() local playerAccount = getPlayerAccount(source) if (playerAccount) and not isGuestAccount(playerAccount) then local playerMoney = getPlayerMoney(source) local playerSkin = getElementModel(source) setAccountData(playerAccount, "money", playerMoney) setAccountData(playerAccount, "skin", playerSkin) end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) function onPlayerLogin() local playerAccount = getPlayerAccount(source) if (playerAccount) then local playerMoney = tonumber(getAccountData(playerAccount, "money")) local playerSkin = tonumber(getAccountData(playerAccount, "skin")) if (playerMoney and playerSkin) then setPlayerMoney(source, playerMoney) setElementModel(source, playerSkin) end end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) Link to comment
JR10 Posted January 3, 2012 Share Posted January 3, 2012 function joinHandler ( ) --spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, skin, 0) spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, 0, 0) fadeCamera (source, true) setCameraTarget ( source, source ) end addEventHandler ( "onPlayerJoin" , getRootElement ( ) , joinHandler ) function spawnWasted(player, skin) repeat until spawnPlayer ( player, -2655.02, 625.30, 14.45, 180, skin, 0) fadeCamera(player, true) setCameraTarget(player, player) end addEventHandler("onPlayerWasted", root, function() setTimer(spawnWasted, 1800, 1, source, getElementModel(source)) end ) function greetPlayer ( ) outputChatBox ( "Witaj na Polskim Serwerze Zabawy stworzonym przez Mefisto_PL !" , source, 0, 159, 255 ) end addEventHandler ( "onPlayerLogin", getRootElement(), greetPlayer ) function onPlayerQuit() local playerAccount = getPlayerAccount(source) if (playerAccount) and not isGuestAccount(playerAccount) then local playerMoney = getPlayerMoney(source) local playerSkin = getElementModel(source) setAccountData(playerAccount, "money", playerMoney) setAccountData(playerAccount, "skin", playerSkin) end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) function onPlayerLogin() local playerAccount = getPlayerAccount(source) if (playerAccount) and not isGuestAccount(playerAccount) then local playerMoney = tonumber(getAccountData(playerAccount, "money")) local playerSkin = tonumber(getAccountData(playerAccount, "skin")) if (playerMoney and playerSkin) then setPlayerMoney(source, playerMoney) setElementModel(source, playerSkin) end end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) I added isGuestAccount check to onPlayerLogin. I can't find any difference between Castillo's and mine, I took yours anyway. Link to comment
Castillo Posted January 3, 2012 Share Posted January 3, 2012 Compare your line 42 (in the post behind mine) with mine. Yours: if (playerMoney, playerSkin) then -- You can't use a comma, you must use "and". Mine: if (playerMoney and playerSkin) then Link to comment
JR10 Posted January 3, 2012 Share Posted January 3, 2012 Oh lol, sorry. You're welcome. Link to comment
zer0w Posted January 10, 2012 Share Posted January 10, 2012 Nice and simple script, but too bad that it's not working when you die. You change to a random character after death. Link to comment
FatalTerror Posted January 10, 2012 Share Posted January 10, 2012 Just add an other event... onPlayerSpawn Link to comment
rublisk19 Posted January 10, 2012 Share Posted January 10, 2012 make other event onPlayerWasted Link to comment
zer0w Posted January 14, 2012 Share Posted January 14, 2012 Well I did this, still random character on death function player_Wasted ( ammo, attacker, weapon, bodypart ) end -- add the player_Wasted function as a handler for onPlayerWasted addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted ) Link to comment
Castillo Posted January 14, 2012 Share Posted January 14, 2012 That's nothing, a event handler attached to a empty function, what do you think it'll do? If you want to save the skin on death, try this: addEventHandler("onPlayerWasted",root, function () setElementData(source,"tempSkin",getElementModel(source)) end) addEventHandler("onPlayerSpawn",root, function () local skin = tonumber(getElementData(source,"tempSkin")) if (skin) then setElementModel(source, skin) end removeElementData(source,"tempSkin") end) Link to comment
zer0w Posted January 15, 2012 Share Posted January 15, 2012 That's nothing, a event handler attached to a empty function, what do you think it'll do?If you want to save the skin on death, try this: addEventHandler("onPlayerWasted",root, function () setElementData(source,"tempSkin",getElementModel(source)) end) addEventHandler("onPlayerSpawn",root, function () local skin = tonumber(getElementData(source,"tempSkin")) if (skin) then setElementModel(source, skin) end removeElementData(source,"tempSkin") end) Hmm thanks for the help, but still random character.. Link to comment
Castillo Posted January 15, 2012 Share Posted January 15, 2012 Post your respawn system. Link to comment
zer0w Posted January 15, 2012 Share Posted January 15, 2012 local spawnpoint addEventHandler("onResourceStart", resourceRoot, function() spawnpoint = getRandomSpawnPoint() resetMapInfo() for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) function joinHandler ( ) --spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, skin, 0) spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, 0, 0) fadeCamera (source, true) setCameraTarget ( source, source ) end addEventHandler ( "onPlayerJoin" , getRootElement ( ) , joinHandler ) function spawnWasted(player, skin) repeat until spawnPlayer ( player, -2655.02, 625.30, 14.45, 180, skin, 0) fadeCamera(player, true) setCameraTarget(player, player) end addEventHandler("onPlayerWasted", root, function() setTimer(spawnWasted, 1800, 1, source, getElementModel(source)) end ) function greetPlayer ( ) outputChatBox ( "Welcome to Zer0w's server" , source, 0, 159, 255 ) end addEventHandler ( "onPlayerLogin", getRootElement(), greetPlayer ) addEventHandler("onPlayerWasted",root, function () setElementData(source,"tempSkin",getElementModel(source)) end) addEventHandler("onPlayerSpawn",root, function () local skin = tonumber(getElementData(source,"tempSkin")) if (skin) then setElementModel(source, skin) end removeElementData(source,"tempSkin") end) function onPlayerQuit() local playerAccount = getPlayerAccount(source) if (playerAccount) and not isGuestAccount(playerAccount) then local playerMoney = getPlayerMoney(source) local playerSkin = getElementModel(source) setAccountData(playerAccount, "money", playerMoney) setAccountData(playerAccount, "skin", playerSkin) end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) function onPlayerLogin() local playerAccount = getPlayerAccount(source) if (playerAccount) and not isGuestAccount(playerAccount) then local playerMoney = tonumber(getAccountData(playerAccount, "money")) local playerSkin = tonumber(getAccountData(playerAccount, "skin")) if (playerMoney and playerSkin) then setPlayerMoney(source, playerMoney) setElementModel(source, playerSkin) end end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) function spawn(player) if not isElement(player) then return end if get("spawnreset") == "onSpawn" then spawnpoint = getRandomSpawnPoint() end exports.spawnmanager:spawnPlayerAtSpawnpoint(player,spawnpoint,false) repeat until setElementModel(player,math.random(312)) fadeCamera(player, true) setCameraTarget(player, player) showChat(player, true) end function getRandomSpawnPoint () local spawnpoints = getElementsByType("spawnpoint") return spawnpoints[math.random(1,#spawnpoints)] end addEventHandler("onPlayerJoin", root, function() spawn(source) end ) addEventHandler("onPlayerQuit",root, function () if getPlayerCount() == 1 and get("spawnreset") == "onServerEmpty" then spawnpoint = getRandomSpawnPoint() end end ) addEventHandler("onPlayerWasted", root, function() setTimer(spawn, 1800, 1, source) end ) Link to comment
Castillo Posted January 15, 2012 Share Posted January 15, 2012 Well, you are using two respawn systems there. local spawnpoint addEventHandler("onResourceStart", resourceRoot, function() spawnpoint = getRandomSpawnPoint() resetMapInfo() for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) function joinHandler ( ) --spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, skin, 0) spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, 0, 0) fadeCamera (source, true) setCameraTarget ( source, source ) end addEventHandler ( "onPlayerJoin" , getRootElement ( ) , joinHandler ) --[[ function spawnWasted(player, skin) repeat until spawnPlayer ( player, -2655.02, 625.30, 14.45, 180, skin, 0) fadeCamera(player, true) setCameraTarget(player, player) end addEventHandler("onPlayerWasted", root, function() setTimer(spawnWasted, 1800, 1, source, tonumber(getElementData(source,"tempSkin"))) end ) --]] function greetPlayer ( ) outputChatBox ( "Welcome to Zer0w's server" , source, 0, 159, 255 ) end addEventHandler ( "onPlayerLogin", getRootElement(), greetPlayer ) function onPlayerQuit() local playerAccount = getPlayerAccount(source) if (playerAccount) and not isGuestAccount(playerAccount) then local playerMoney = getPlayerMoney(source) local playerSkin = getElementModel(source) setAccountData(playerAccount, "money", playerMoney) setAccountData(playerAccount, "skin", playerSkin) end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) function onPlayerLogin() local playerAccount = getPlayerAccount(source) if (playerAccount) and not isGuestAccount(playerAccount) then local playerMoney = tonumber(getAccountData(playerAccount, "money")) local playerSkin = tonumber(getAccountData(playerAccount, "skin")) if (playerMoney and playerSkin) then setPlayerMoney(source, playerMoney) setElementModel(source, playerSkin) end end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) function spawn(player) if not isElement(player) then return end if get("spawnreset") == "onSpawn" then spawnpoint = getRandomSpawnPoint() end exports.spawnmanager:spawnPlayerAtSpawnpoint(player,spawnpoint,false) setElementModel(player, tonumber(getElementData(player,"tempSkin"))) fadeCamera(player, true) setCameraTarget(player, player) showChat(player, true) end function getRandomSpawnPoint () local spawnpoints = getElementsByType("spawnpoint") return spawnpoints[math.random(1,#spawnpoints)] end addEventHandler("onPlayerJoin", root, function() spawn(source) end ) addEventHandler("onPlayerQuit",root, function () if getPlayerCount() == 1 and get("spawnreset") == "onServerEmpty" then spawnpoint = getRandomSpawnPoint() end end ) addEventHandler("onPlayerWasted", root, function() setElementData(source,"tempSkin",getElementModel(source)) setTimer(spawn, 1800, 1, source) end ) I don't know, it should work as I commented out one of them. Link to comment
Kenix Posted January 16, 2012 Share Posted January 16, 2012 (edited) local spawnpoint function spawn( player ) local player = player or source if get( getResourceName( getThisResource( ) )..".spawnreset" ) == "onSpawn" then spawnpoint = getRandomSpawnPoint( ) end exports.spawnmanager:spawnPlayerAtSpawnpoint ( player,spawnpoint,false ) setElementModel( player, tonumber( getElementData( player,"tempSkin" ) or 0 ) ) fadeCamera( player, true ) setCameraTarget( player, player ) showChat( player, true ) end addEventHandler("onResourceStart", resourceRoot, function() spawnpoint = getRandomSpawnPoint( ) --resetMapInfo() is triggered in mapmanager for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) function joinHandler ( ) --spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, skin, 0) spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, 0, 0) fadeCamera (source, true) setCameraTarget ( source, source ) end addEventHandler ( "onPlayerJoin" , root , joinHandler ) --[[ function spawnWasted(player, skin) repeat until spawnPlayer ( player, -2655.02, 625.30, 14.45, 180, skin, 0) fadeCamera(player, true) setCameraTarget(player, player) end addEventHandler("onPlayerWasted", root, function() setTimer(spawnWasted, 1800, 1, source, tonumber(getElementData(source,"tempSkin"))) end ) --]] function greetPlayer ( ) outputChatBox ( "Welcome to Zer0w's server" , source, 0, 159, 255 ) end addEventHandler ( "onPlayerLogin", root, greetPlayer ) function onPlayerQuit() local playerAccount = getPlayerAccount( source ) if playerAccount and not isGuestAccount( playerAccount ) then local playerMoney = getPlayerMoney( source ) local playerSkin = getElementModel( source ) setAccountData( playerAccount, "money", playerMoney ) setAccountData( playerAccount, "skin", playerSkin ) end end addEventHandler( "onPlayerQuit", root, onPlayerQuit ) function onPlayerLogin( ) local playerAccount = getPlayerAccount( source ) if playerAccount and not isGuestAccount( playerAccount ) then local playerMoney = tonumber( getAccountData( playerAccount, "money" ) ) local playerSkin = tonumber( getAccountData( playerAccount, "skin" ) ) if playerMoney and playerSkin then setPlayerMoney( source, playerMoney ) setElementModel( source, playerSkin ) end end end addEventHandler( "onPlayerLogin", root, onPlayerLogin ) function getRandomSpawnPoint( ) local spawnpoints = getElementsByType( "spawnpoint" ) return spawnpoints[ math.random( 1,#spawnpoints ) ] end addEventHandler( "onPlayerJoin", root, function() spawn( source ) end ) addEventHandler( "onPlayerQuit",root, function ( ) if getPlayerCount( ) == 1 and get( getResourceName( getThisResource( ) )..".spawnreset" ) == "onServerEmpty" then spawnpoint = getRandomSpawnPoint( ) end end ) addEventHandler("onPlayerWasted", root, function( ) setElementData( source,"tempSkin",getElementModel( source ) ) setTimer( spawn, 1800, 1, source ) end ) Edited January 16, 2012 by Guest Link to comment
zer0w Posted January 16, 2012 Share Posted January 16, 2012 I still thank you guys for the perfectly working script, but now I'm trying to figure out a working weapon save system. I didn't code this, but a guy called Jason wrote the code : weaponSlots = 11 ammoSlot = {} gunSlot = {} for slot = 1, weaponSlots do if getPedWeapon ( player, slot ) then ammoSlot[slot] = getPedTotalAmmo ( player, slot ) gunSlot[slot] = getPedWeapon ( player, slot ) end end -- If you want save your WEAPON CODE later than you can use ElementData -> global for gun = 1, #gunSlot do if gunSlot[gun] ~= nil then setElementData(player, "weapon#"..gun, getWeaponNameFromID(gunSlot[gun]) setElementData(player, "ammo#"..gun, ammoSlot[gun]) end end Somehow I think it's missing a function, I tried lots of functions but none of them were working, I even used the search button. Help would be appreciated. Link to comment
Castillo Posted January 16, 2012 Share Posted January 16, 2012 What respawn system are you using? Link to comment
zer0w Posted January 16, 2012 Share Posted January 16, 2012 What respawn system are you using? I used your code, for freeroam so broph.lua the weapon saving is clientside so I made a meta.xml and a weaponsave.lua containing that code that I posted above Link to comment
Castillo Posted January 17, 2012 Share Posted January 17, 2012 Ok, then, try this: local spawnpoint addEventHandler("onResourceStart", resourceRoot, function() spawnpoint = getRandomSpawnPoint() resetMapInfo() for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) function joinHandler ( ) spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, 0, 0) fadeCamera (source, true) setCameraTarget ( source, source ) end addEventHandler ( "onPlayerJoin" , getRootElement ( ) , joinHandler ) function greetPlayer ( ) outputChatBox ( "Welcome to Zer0w's server" , source, 0, 159, 255 ) end addEventHandler ( "onPlayerLogin", getRootElement(), greetPlayer ) function onPlayerQuit() local playerAccount = getPlayerAccount(source) if (playerAccount) and not isGuestAccount(playerAccount) then local playerMoney = getPlayerMoney(source) local playerSkin = getElementModel(source) setAccountData(playerAccount, "money", playerMoney) setAccountData(playerAccount, "skin", playerSkin) end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) function onPlayerLogin() local playerAccount = getPlayerAccount(source) if (playerAccount) and not isGuestAccount(playerAccount) then local playerMoney = tonumber(getAccountData(playerAccount, "money")) local playerSkin = tonumber(getAccountData(playerAccount, "skin")) if (playerMoney and playerSkin) then setPlayerMoney(source, playerMoney) setElementModel(source, playerSkin) end end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) function spawn(player) if not isElement(player) then return end if get("spawnreset") == "onSpawn" then spawnpoint = getRandomSpawnPoint() end exports.spawnmanager:spawnPlayerAtSpawnpoint(player,spawnpoint,false) setElementModel(player, tonumber(getElementData(player,"tempSkin"))) fadeCamera(player, true) setCameraTarget(player, player) showChat(player, true) local weapons = getElementData(player,"tempWeapons") if (weapons and weapons ~= "") then for weapon, ammo in pairs(fromJSON(weapons)) do if (weapon and ammo) then giveWeapon(player, tonumber(weapon), tonumber(ammo)) end end end end function getRandomSpawnPoint () local spawnpoints = getElementsByType("spawnpoint") return spawnpoints[math.random(1,#spawnpoints)] end addEventHandler("onPlayerJoin", root, function() spawn(source) end ) addEventHandler("onPlayerQuit",root, function () if getPlayerCount() == 1 and get("spawnreset") == "onServerEmpty" then spawnpoint = getRandomSpawnPoint() end end ) addEventHandler("onPlayerWasted", root, function() weaponSlots = 12 local weaponsTable = {} for slot=1, weaponSlots do local weapon = getPedWeapon( source, slot ) local ammo = getPedTotalAmmo( source, slot ) if (weapon > 0 and ammo > 0) then weaponsTable[weapon] = ammo end end setElementData(source,"tempSkin",getElementModel(source)) setElementData(source,"temWeapons",toJSON(weaponsTable)) setTimer(spawn, 1800, 1, source) end ) 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