Shayan816 Posted July 8, 2017 Share Posted July 8, 2017 watch the video.. This is my problem when i do /pvp it loading the weapons back which i fired.. Please Help ?? code Spoiler function spawn(player) if ( isElementWithinColShape(player,col) == true ) then outputChatBox("You are already in the PVP zone!",player,255,0,0) return end local rnd = math.random( 1, #spawns ) local col = getElementColShape( col ) spawnPlayer( player, spawns[rnd][1], spawns[rnd][2], spawns[rnd][3], spawns[rnd][4], spawns[rnd][5], spawns[rnd][6], spawns[rnd][7], spawns[rnd][8], spawns[rnd][9], spawns[rnd][10], spawns[rnd][11] ) end addCommandHandler("pvp", spawn) Link to comment
Dimos7 Posted July 8, 2017 Share Posted July 8, 2017 so you want to remove weapons the player had when it joinh the pbp zone? Link to comment
kieran Posted July 8, 2017 Share Posted July 8, 2017 Maybe add function to get weapons using getPedWeapon, getPedAmmo, and givePedWeapon, givePedAmmo ? Hold on! See in your "spawns" do you have something called "givePedWeapon" or "givePlayerWeapon" ? If so that's where your problem is! Link to comment
Shayan816 Posted July 8, 2017 Author Share Posted July 8, 2017 no, i dont want to remove all weapons.. just load the weapons, i mean before i do /pvp i used all grenades, but when i go /pvp i got them back i want to load all current weapons player has. i dont want to get the weapons back which i fired 2 minutes ago, kieran said: Maybe add function to get weapons using getPedWeapon, getPedAmmo, and givePedWeapon, givePedAmmo ? Hold on! See in your "spawns" do you have something called "givePedWeapon" or "givePlayerWeapon" ? If so that's where your problem is! no nothing.. i dont have givepedweapon or giveplayerweapon or anything about giving in my whole script Link to comment
Dimos7 Posted July 8, 2017 Share Posted July 8, 2017 can provic\de all code please because i can't see nothing with that code you post Link to comment
Shayan816 Posted July 8, 2017 Author Share Posted July 8, 2017 Just now, Dimos7 said: can provic\de all code please because i can't see nothing with that code you post Spoiler local col = createColRectangle ( 909, 525, 2100, 2600 ) local pTeam = createTeam("Players",0,255,0) addEventHandler("onPlayerJoin", root, function() setPlayerTeam(source, pTeam) setTeamFriendlyFire(pTeam,false) end) local pvpTeam = createTeam("PVP",255,0,0) setTeamFriendlyFire(pvpTeam,true) setTimer( function() for ind,ent in ipairs(getElementsByType("player")) do if ( isElementWithinColShape(ent,col) == true ) and ( getPlayerTeam(ent) ~= pvpTeam ) then setElementData(ent,"PVP.Team",getPlayerTeam(ent)) setPlayerTeam(ent,pvpTeam) outputChatBox("You have entered PVP zone!",ent,0,255,0) outputChatBox("Number of players inside PVP zone: ".. #getElementsWithinColShape(col,"player"),ent,255,255,0) elseif ( isElementWithinColShape(ent,col) == false ) and ( getPlayerTeam(ent) == pvpTeam ) then if ( not getElementData(ent,"PVP.Team") ) then setPlayerTeam(ent,pTeam) else setPlayerTeam(ent,getElementData(ent,"PVP.Team")) end outputChatBox("You have left PVP zone!",ent,255,0,0) end end end,500,0 ) local spawns = { --x, y, z, rotZ { 2096.3, 1286.6, 10.82, 90 }, { 1928.8, 1469.5, 10.82, 90 }, { 2032.6,1429.3,10.82, 90 }, { 2019.8, 1545.5, 10.82, 90 }, { 2162.1, 1644.7, 11.2, 90 }, { 2121.3, 1493.9, 10.82, 90 }, { 2163.7, 1483.6, 24.1, 90 }, { 2114.1, 1483.8, 24.1, 90 }, { 1939.8, 1343.2, 9.2, 90 }, { 2025.5, 1623.7, 11.9, 90 } } function spawn(player) if ( isElementWithinColShape(player,col) == true ) then outputChatBox("You are already in the PVP zone!",player,255,0,0) return end local rnd = math.random( 1, #spawns ) local col = getElementColShape( col ) spawnPlayer( player, spawns[rnd][1], spawns[rnd][2], spawns[rnd][3], spawns[rnd][4], spawns[rnd][5], spawns[rnd][6], spawns[rnd][7], spawns[rnd][8], spawns[rnd][9], spawns[rnd][10], spawns[rnd][11] ) end addCommandHandler("pvp", spawn) Link to comment
SkiZo Posted July 8, 2017 Share Posted July 8, 2017 Somethings in Save system i think ( load Data in onPlayerSpawn ) maybe ... or you have script when player spawn he give him that Guns .. i'm not sure exactly but you have to check from save system .. try to turn it off and try .. Link to comment
Shayan816 Posted July 8, 2017 Author Share Posted July 8, 2017 Just now, Legend<3 said: Somethings in Save system i think ( load Data in onPlayerSpawn ) maybe ... or you have script when player spawn he give him that Guns .. i'm not sure exactly but you have to check from save system .. try to turn it off and try .. i turned of save system.. and tried when i do /pvp all my weapons gone.. Link to comment
kieran Posted July 8, 2017 Share Posted July 8, 2017 You shouldn't be getting any weapons, is there any other lua files at all from this resource? Have you tried entering with 0 weapons? Link to comment
Shayan816 Posted July 8, 2017 Author Share Posted July 8, 2017 No only this 1 single file in this resource.. Link to comment
SkiZo Posted July 8, 2017 Share Posted July 8, 2017 (edited) 1 minute ago, Shayan816 said: No only this 1 single file in this resource.. He did not mean this resource.. .. check the others !! because something else give weapons .. Try To Stop resources .. One By One every time you test .. then you will find the Buged file . Because in your script nothing Wrong as i see Edited July 8, 2017 by Legend<3 Link to comment
Shayan816 Posted July 8, 2017 Author Share Posted July 8, 2017 8 minutes ago, Legend<3 said: He did not mean this resource.. .. check the others !! because something else give weapons .. Try To Stop resources .. One By One every time you test .. then you will find the Buged file . Because in your script nothing Wrong as i see i tried Stopped all resources, just freeroam running and save system.. and still same.. if i stop save system, im loosing all weapons when i go /pvp Link to comment
SkiZo Posted July 8, 2017 Share Posted July 8, 2017 (edited) 6 minutes ago, Shayan816 said: i tried Stopped all resources, just freeroam running and save system.. and still same.. if i stop save system, im loosing all weapons when i go /pvp Try to use this resource .. is for Save Weapons .. some times when i find bugs in weapons i use it ... https://www.mediafire.com/?2ibrjnb48rzm9j7 Edited July 8, 2017 by Legend<3 Link to comment
Shayan816 Posted July 8, 2017 Author Share Posted July 8, 2017 Just now, Legend<3 said: Try to use this script .. is for Save Weapons .. some times when i find bugs in weapons i use it ... https://www.mediafire.com/?2ibrjnb48rzm9j7 i already have these scripts in my save system.. along with this script Spoiler function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "funmodev2-money") if (accountData) then local playerMoney = getAccountData (theCurrentAccount, "funmodev2-money") local playerSkin = getAccountData (theCurrentAccount, "funmodev2-skin") local playerHealth = getAccountData (theCurrentAccount, "funmodev2-health") local playerArmor = getAccountData (theCurrentAccount, "funmodev2-armor") local playerX = getAccountData (theCurrentAccount, "funmodev2-x") local playerY = getAccountData (theCurrentAccount, "funmodev2-y") local playerZ = getAccountData (theCurrentAccount, "funmodev2-z") local playerInt = getAccountData (theCurrentAccount, "funmodev2-int") local playerDim = getAccountData (theCurrentAccount, "funmodev2-dim") local playerWanted = getAccountData (theCurrentAccount, "funmodev2-wantedlevel") local playerTeam = getAccountData (theCurrentAccount, "funmodev2-Team") local playerWeaponID0 = getAccountData (theCurrentAccount, "funmodev2-weaponID0") local playerWeaponID1 = getAccountData (theCurrentAccount, "funmodev2-weaponID1") local playerWeaponID2 = getAccountData (theCurrentAccount, "funmodev2-weaponID2") local playerWeaponID3 = getAccountData (theCurrentAccount, "funmodev2-weaponID3") local playerWeaponID4 = getAccountData (theCurrentAccount, "funmodev2-weaponID4") local playerWeaponID5 = getAccountData (theCurrentAccount, "funmodev2-weaponID5") local playerWeaponID6 = getAccountData (theCurrentAccount, "funmodev2-weaponID6") local playerWeaponID7 = getAccountData (theCurrentAccount, "funmodev2-weaponID7") local playerWeaponID8 = getAccountData (theCurrentAccount, "funmodev2-weaponID8") local playerWeaponID9 = getAccountData (theCurrentAccount, "funmodev2-weaponID9") local playerWeaponID10 = getAccountData (theCurrentAccount, "funmodev2-weaponID10") local playerWeaponID11 = getAccountData (theCurrentAccount, "funmodev2-weaponID11") local playerWeaponID12 = getAccountData (theCurrentAccount, "funmodev2-weaponID12") local playerWeaponAmmo0 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo0") local playerWeaponAmmo1 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo1") local playerWeaponAmmo2 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo2") local playerWeaponAmmo3 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo3") local playerWeaponAmmo4 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo4") local playerWeaponAmmo5 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo5") local playerWeaponAmmo6 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo6") local playerWeaponAmmo7 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo7") local playerWeaponAmmo8 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo8") local playerWeaponAmmo9 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo9") local playerWeaponAmmo10 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo10") local playerWeaponAmmo11 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo11") local playerWeaponAmmo12 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo12") spawnPlayer (source, playerX, playerY, playerZ +1, 0, playerSkin, playerInt, playerDim) setPlayerMoney (source, playerMoney) setTimer (setElementHealth, 500, 1, source, playerHealth) setTimer (setPedArmor, 500, 1, source, playerArmor) setTimer (setPlayerWantedLevel, 500, 1, source, playerWanted) giveWeapon(source, playerWeaponID0, playerWeaponAmmo0, true) giveWeapon(source, playerWeaponID1, playerWeaponAmmo1, false) giveWeapon(source, playerWeaponID2, playerWeaponAmmo2, false) giveWeapon(source, playerWeaponID3, playerWeaponAmmo3, false) giveWeapon(source, playerWeaponID4, playerWeaponAmmo4, false) giveWeapon(source, playerWeaponID5, playerWeaponAmmo5, false) giveWeapon(source, playerWeaponID6, playerWeaponAmmo6, false) giveWeapon(source, playerWeaponID7, playerWeaponAmmo7, false) giveWeapon(source, playerWeaponID8, playerWeaponAmmo8, false) giveWeapon(source, playerWeaponID9, playerWeaponAmmo9, false) giveWeapon(source, playerWeaponID10, playerWeaponAmmo10, false) giveWeapon(source, playerWeaponID11, playerWeaponAmmo11, false) giveWeapon(source, playerWeaponID12, playerWeaponAmmo12, false) setCameraTarget (source, source) fadeCamera(source, true, 2.0) end end end addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) function onLogout () kickPlayer (source, nil, "Logging out is disallowed.") end addEventHandler ("onPlayerLogout", getRootElement(), onLogout) function onQuit (quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then local x,y,z = getElementPosition (source) setAccountData (account, "funmodev2-money", tostring (getPlayerMoney (source))) setAccountData (account, "funmodev2-skin", tostring (getPedSkin (source))) setAccountData (account, "funmodev2-health", tostring (getElementHealth (source))) setAccountData (account, "funmodev2-armor", tostring (getPedArmor (source))) setAccountData (account, "funmodev2-R", r) setAccountData (account, "funmodev2-G", g) setAccountData (account, "funmodev2-B", b) setAccountData (account, "funmodev2-x", x) setAccountData (account, "funmodev2-y", y) setAccountData (account, "funmodev2-z", z) setAccountData (account, "funmodev2-int", getElementInterior (source)) setAccountData (account, "funmodev2-dim", getElementDimension (source)) setAccountData (account, "funmodev2-wantedlevel", getPlayerWantedLevel (source)) setAccountData (account, "funmodev2-weaponID0", getPedWeapon (source, 0)) setAccountData (account, "funmodev2-weaponID1", getPedWeapon (source, 1)) setAccountData (account, "funmodev2-weaponID2", getPedWeapon (source, 2)) setAccountData (account, "funmodev2-weaponID3", getPedWeapon (source, 3)) setAccountData (account, "funmodev2-weaponID4", getPedWeapon (source, 4)) setAccountData (account, "funmodev2-weaponID5", getPedWeapon (source, 5)) setAccountData (account, "funmodev2-weaponID6", getPedWeapon (source, 6)) setAccountData (account, "funmodev2-weaponID7", getPedWeapon (source, 7)) setAccountData (account, "funmodev2-weaponID8", getPedWeapon (source, 8)) setAccountData (account, "funmodev2-weaponID9", getPedWeapon (source, 9)) setAccountData (account, "funmodev2-weaponID10", getPedWeapon (source, 10)) setAccountData (account, "funmodev2-weaponID11", getPedWeapon (source, 11)) setAccountData (account, "funmodev2-weaponID12", getPedWeapon (source, 12)) setAccountData (account, "funmodev2-weaponAmmo0", getPedTotalAmmo (source, 0)) setAccountData (account, "funmodev2-weaponAmmo1", getPedTotalAmmo (source, 1)) setAccountData (account, "funmodev2-weaponAmmo2", getPedTotalAmmo (source, 2)) setAccountData (account, "funmodev2-weaponAmmo3", getPedTotalAmmo (source, 3)) setAccountData (account, "funmodev2-weaponAmmo4", getPedTotalAmmo (source, 4)) setAccountData (account, "funmodev2-weaponAmmo5", getPedTotalAmmo (source, 5)) setAccountData (account, "funmodev2-weaponAmmo6", getPedTotalAmmo (source, 6)) setAccountData (account, "funmodev2-weaponAmmo7", getPedTotalAmmo (source, 7)) setAccountData (account, "funmodev2-weaponAmmo8", getPedTotalAmmo (source, 8)) setAccountData (account, "funmodev2-weaponAmmo9", getPedTotalAmmo (source, 9)) setAccountData (account, "funmodev2-weaponAmmo10", getPedTotalAmmo (source, 10)) setAccountData (account, "funmodev2-weaponAmmo11", getPedTotalAmmo (source, 11)) setAccountData (account, "funmodev2-weaponAmmo12", getPedTotalAmmo (source, 12)) end end end addEventHandler ("onPlayerQuit", getRootElement(), onQuit) function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) if not( isGuestAccount (getPlayerAccount(source)) ) then local theWeapon = getPedWeapon (source) local weaponAmmo = getPedTotalAmmo (source) end end addEventHandler ("onPlayerWasted", getRootElement(), onWasted) --- function setTeam() local account = getPlayerAccount(source) -- gets players account local team = getAccountData (account, "team") -- gets players team if (team) and getTeamFromName(team) then setPlayerTeam(source, getTeamFromName(team)) -- sets players team end end addEventHandler("onPlayerLogin",root,setTeam) -- sets players team on login function save() local team = getPlayerTeam(source) -- Gets the players team local account = getPlayerAccount(source) if (team) and not isGuestAccount(account) then -- Checks to see if the player is a guest or not setAccountData(account, "team", getTeamName(team)) --saves team end end addEventHandler("onPlayerQuit", getRootElement(), save) -- saves team on quit Link to comment
SkiZo Posted July 8, 2017 Share Posted July 8, 2017 (edited) 10 minutes ago, Shayan816 said: i already have these scripts in my save system.. along with this script Reveal hidden contents function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "funmodev2-money") if (accountData) then local playerMoney = getAccountData (theCurrentAccount, "funmodev2-money") local playerSkin = getAccountData (theCurrentAccount, "funmodev2-skin") local playerHealth = getAccountData (theCurrentAccount, "funmodev2-health") local playerArmor = getAccountData (theCurrentAccount, "funmodev2-armor") local playerX = getAccountData (theCurrentAccount, "funmodev2-x") local playerY = getAccountData (theCurrentAccount, "funmodev2-y") local playerZ = getAccountData (theCurrentAccount, "funmodev2-z") local playerInt = getAccountData (theCurrentAccount, "funmodev2-int") local playerDim = getAccountData (theCurrentAccount, "funmodev2-dim") local playerWanted = getAccountData (theCurrentAccount, "funmodev2-wantedlevel") local playerTeam = getAccountData (theCurrentAccount, "funmodev2-Team") local playerWeaponID0 = getAccountData (theCurrentAccount, "funmodev2-weaponID0") local playerWeaponID1 = getAccountData (theCurrentAccount, "funmodev2-weaponID1") local playerWeaponID2 = getAccountData (theCurrentAccount, "funmodev2-weaponID2") local playerWeaponID3 = getAccountData (theCurrentAccount, "funmodev2-weaponID3") local playerWeaponID4 = getAccountData (theCurrentAccount, "funmodev2-weaponID4") local playerWeaponID5 = getAccountData (theCurrentAccount, "funmodev2-weaponID5") local playerWeaponID6 = getAccountData (theCurrentAccount, "funmodev2-weaponID6") local playerWeaponID7 = getAccountData (theCurrentAccount, "funmodev2-weaponID7") local playerWeaponID8 = getAccountData (theCurrentAccount, "funmodev2-weaponID8") local playerWeaponID9 = getAccountData (theCurrentAccount, "funmodev2-weaponID9") local playerWeaponID10 = getAccountData (theCurrentAccount, "funmodev2-weaponID10") local playerWeaponID11 = getAccountData (theCurrentAccount, "funmodev2-weaponID11") local playerWeaponID12 = getAccountData (theCurrentAccount, "funmodev2-weaponID12") local playerWeaponAmmo0 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo0") local playerWeaponAmmo1 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo1") local playerWeaponAmmo2 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo2") local playerWeaponAmmo3 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo3") local playerWeaponAmmo4 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo4") local playerWeaponAmmo5 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo5") local playerWeaponAmmo6 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo6") local playerWeaponAmmo7 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo7") local playerWeaponAmmo8 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo8") local playerWeaponAmmo9 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo9") local playerWeaponAmmo10 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo10") local playerWeaponAmmo11 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo11") local playerWeaponAmmo12 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo12") spawnPlayer (source, playerX, playerY, playerZ +1, 0, playerSkin, playerInt, playerDim) setPlayerMoney (source, playerMoney) setTimer (setElementHealth, 500, 1, source, playerHealth) setTimer (setPedArmor, 500, 1, source, playerArmor) setTimer (setPlayerWantedLevel, 500, 1, source, playerWanted) giveWeapon(source, playerWeaponID0, playerWeaponAmmo0, true) giveWeapon(source, playerWeaponID1, playerWeaponAmmo1, false) giveWeapon(source, playerWeaponID2, playerWeaponAmmo2, false) giveWeapon(source, playerWeaponID3, playerWeaponAmmo3, false) giveWeapon(source, playerWeaponID4, playerWeaponAmmo4, false) giveWeapon(source, playerWeaponID5, playerWeaponAmmo5, false) giveWeapon(source, playerWeaponID6, playerWeaponAmmo6, false) giveWeapon(source, playerWeaponID7, playerWeaponAmmo7, false) giveWeapon(source, playerWeaponID8, playerWeaponAmmo8, false) giveWeapon(source, playerWeaponID9, playerWeaponAmmo9, false) giveWeapon(source, playerWeaponID10, playerWeaponAmmo10, false) giveWeapon(source, playerWeaponID11, playerWeaponAmmo11, false) giveWeapon(source, playerWeaponID12, playerWeaponAmmo12, false) setCameraTarget (source, source) fadeCamera(source, true, 2.0) end end end addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) function onLogout () kickPlayer (source, nil, "Logging out is disallowed.") end addEventHandler ("onPlayerLogout", getRootElement(), onLogout) function onQuit (quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then local x,y,z = getElementPosition (source) setAccountData (account, "funmodev2-money", tostring (getPlayerMoney (source))) setAccountData (account, "funmodev2-skin", tostring (getPedSkin (source))) setAccountData (account, "funmodev2-health", tostring (getElementHealth (source))) setAccountData (account, "funmodev2-armor", tostring (getPedArmor (source))) setAccountData (account, "funmodev2-R", r) setAccountData (account, "funmodev2-G", g) setAccountData (account, "funmodev2-B", b) setAccountData (account, "funmodev2-x", x) setAccountData (account, "funmodev2-y", y) setAccountData (account, "funmodev2-z", z) setAccountData (account, "funmodev2-int", getElementInterior (source)) setAccountData (account, "funmodev2-dim", getElementDimension (source)) setAccountData (account, "funmodev2-wantedlevel", getPlayerWantedLevel (source)) setAccountData (account, "funmodev2-weaponID0", getPedWeapon (source, 0)) setAccountData (account, "funmodev2-weaponID1", getPedWeapon (source, 1)) setAccountData (account, "funmodev2-weaponID2", getPedWeapon (source, 2)) setAccountData (account, "funmodev2-weaponID3", getPedWeapon (source, 3)) setAccountData (account, "funmodev2-weaponID4", getPedWeapon (source, 4)) setAccountData (account, "funmodev2-weaponID5", getPedWeapon (source, 5)) setAccountData (account, "funmodev2-weaponID6", getPedWeapon (source, 6)) setAccountData (account, "funmodev2-weaponID7", getPedWeapon (source, 7)) setAccountData (account, "funmodev2-weaponID8", getPedWeapon (source, 8)) setAccountData (account, "funmodev2-weaponID9", getPedWeapon (source, 9)) setAccountData (account, "funmodev2-weaponID10", getPedWeapon (source, 10)) setAccountData (account, "funmodev2-weaponID11", getPedWeapon (source, 11)) setAccountData (account, "funmodev2-weaponID12", getPedWeapon (source, 12)) setAccountData (account, "funmodev2-weaponAmmo0", getPedTotalAmmo (source, 0)) setAccountData (account, "funmodev2-weaponAmmo1", getPedTotalAmmo (source, 1)) setAccountData (account, "funmodev2-weaponAmmo2", getPedTotalAmmo (source, 2)) setAccountData (account, "funmodev2-weaponAmmo3", getPedTotalAmmo (source, 3)) setAccountData (account, "funmodev2-weaponAmmo4", getPedTotalAmmo (source, 4)) setAccountData (account, "funmodev2-weaponAmmo5", getPedTotalAmmo (source, 5)) setAccountData (account, "funmodev2-weaponAmmo6", getPedTotalAmmo (source, 6)) setAccountData (account, "funmodev2-weaponAmmo7", getPedTotalAmmo (source, 7)) setAccountData (account, "funmodev2-weaponAmmo8", getPedTotalAmmo (source, 8)) setAccountData (account, "funmodev2-weaponAmmo9", getPedTotalAmmo (source, 9)) setAccountData (account, "funmodev2-weaponAmmo10", getPedTotalAmmo (source, 10)) setAccountData (account, "funmodev2-weaponAmmo11", getPedTotalAmmo (source, 11)) setAccountData (account, "funmodev2-weaponAmmo12", getPedTotalAmmo (source, 12)) end end end addEventHandler ("onPlayerQuit", getRootElement(), onQuit) function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) if not( isGuestAccount (getPlayerAccount(source)) ) then local theWeapon = getPedWeapon (source) local weaponAmmo = getPedTotalAmmo (source) end end addEventHandler ("onPlayerWasted", getRootElement(), onWasted) --- function setTeam() local account = getPlayerAccount(source) -- gets players account local team = getAccountData (account, "team") -- gets players team if (team) and getTeamFromName(team) then setPlayerTeam(source, getTeamFromName(team)) -- sets players team end end addEventHandler("onPlayerLogin",root,setTeam) -- sets players team on login function save() local team = getPlayerTeam(source) -- Gets the players team local account = getPlayerAccount(source) if (team) and not isGuestAccount(account) then -- Checks to see if the player is a guest or not setAccountData(account, "team", getTeamName(team)) --saves team end end addEventHandler("onPlayerQuit", getRootElement(), save) -- saves team on quit Your Save_System Don't Have ( "onPlayerSpawn" ) Event .. the new resouce have it .. or add function to resource 1 Edited July 8, 2017 by Legend<3 Link to comment
Shayan816 Posted July 8, 2017 Author Share Posted July 8, 2017 2 minutes ago, Legend<3 said: Your Save_System Don't Have ( "onPlayerSpawn" ) Event .. the new resouce have it .. or add function to resource 1 i have "onPlayerSpawn in my save system its on weapons file addEventHandler("onPlayerSpawn", root, function() if not playerWeapons[source] then return end setTimer(function(player) if not isElement(player) then return end for weapon, tbl in pairs(playerWeapons[player]) do giveWeapon(player, weapon, 1, tbl.inUsing) setWeaponAmmo(player, weapon, tbl.ammo, tbl.inClip) end end, 200, 1, source) end) Link to comment
SkiZo Posted July 8, 2017 Share Posted July 8, 2017 (edited) 1 minute ago, Shayan816 said: i have "onPlayerSpawn in my save system its on weapons file addEventHandler("onPlayerSpawn", root, function() if not playerWeapons[source] then return end setTimer(function(player) if not isElement(player) then return end for weapon, tbl in pairs(playerWeapons[player]) do giveWeapon(player, weapon, 1, tbl.inUsing) setWeaponAmmo(player, weapon, tbl.ammo, tbl.inClip) end end, 200, 1, source)end) It's the same that i send it to you .. but did you try to turn it on and test ? Edited July 8, 2017 by Legend<3 Link to comment
Shayan816 Posted July 8, 2017 Author Share Posted July 8, 2017 2 minutes ago, Legend<3 said: It's the same that i send it to you .. but did you try to turn it on and test ? yes its same.. and i also tried with the resource you sent.. not working... Link to comment
SkiZo Posted July 8, 2017 Share Posted July 8, 2017 Just now, Shayan816 said: Anyone Help ?? wait i will try it in local Link to comment
Shayan816 Posted July 8, 2017 Author Share Posted July 8, 2017 (edited) so i tried to use SetElementPosition still doesnt work local spawns = { --x, y, z, rotZ { 2096.3, 1286.6, 10.82, 90 }, { 1928.8, 1469.5, 10.82, 90 }, { 2032.6,1429.3,10.82, 90 }, { 2019.8, 1545.5, 10.82, 90 }, { 2162.1, 1644.7, 11.2, 90 }, { 2121.3, 1493.9, 10.82, 90 }, { 2163.7, 1483.6, 24.1, 90 }, { 2114.1, 1483.8, 24.1, 90 }, { 1939.8, 1343.2, 9.2, 90 }, { 2025.5, 1623.7, 11.9, 90 } } function spawn(player) if ( isElementWithinColShape(player,col) == true ) then outputChatBox("You are already in the PVP zone!",player,255,0,0) return end local rnd = math.random( 1, #spawns ) local col = getElementColShape( col ) setElementPosition(player, spawns[rnd][1], spawns[rnd][2], spawns[rnd][3], spawns[rnd][4], spawns[rnd][5], spawns[rnd][6], spawns[rnd][7], spawns[rnd][8], spawns[rnd][9], spawns[rnd][10], spawns[rnd][11] ) end addCommandHandler("pvp", spawn) debugscript 3 error Bad argument @ 'setElementPosition' [Expected bool at argument 5, got number '90'] Edited July 8, 2017 by Shayan816 Link to comment
Simple0x47 Posted July 8, 2017 Share Posted July 8, 2017 @Shayan816 Please explain your problem with details so I can offer you the solution you are looking for. Link to comment
Shayan816 Posted July 8, 2017 Author Share Posted July 8, 2017 (edited) i am trying to create random spawns for PVP zone so when players do /pvp they will spawn in random places as in table.. everything is fine but before i enter in /pvp zone i used my guns ammo, and when i do /pvp i spawned in pvp zone and i got back the ammo which i fired.. sorry for bad explanation if you didnt understand.. please watch this video Spoiler i want to fix this.... did u see.. when i do /pvp its loading the weapons which i fired.. when i used this addCommandHandler("pvp", function(player) if ( isElementWithinColShape(player,col) == true ) then outputChatBox("You are already in the PVP zone!",player,255,0,0) return end setElementPosition(player,2032.6420898438,1429.3059082031,10.8203125) end) this bug doesnt exists but i wanted to add more spawns so i used this Spoiler local spawns = { --x, y, z, rotZ { 2096.3, 1286.6, 10.82, 90 }, { 1928.8, 1469.5, 10.82, 90 }, { 2032.6,1429.3,10.82, 90 }, { 2019.8, 1545.5, 10.82, 90 }, { 2162.1, 1644.7, 11.2, 90 }, { 2121.3, 1493.9, 10.82, 90 }, { 2163.7, 1483.6, 24.1, 90 }, { 2114.1, 1483.8, 24.1, 90 }, { 1939.8, 1343.2, 9.2, 90 }, { 2025.5, 1623.7, 11.9, 90 } } function spawn(player) if ( isElementWithinColShape(player,col) == true ) then outputChatBox("You are already in the PVP zone!",player,255,0,0) return end local rnd = math.random( 1, #spawns ) local col = getElementColShape( col ) spawnPlayer( player, spawns[rnd][1], spawns[rnd][2], spawns[rnd][3], spawns[rnd][4], spawns[rnd][5], spawns[rnd][6], spawns[rnd][7], spawns[rnd][8], spawns[rnd][9], spawns[rnd][10], spawns[rnd][11] ) end addCommandHandler("pvp", spawn) and this bug raised i should use SetElementPosition instead of spawnPlayer ? Edited July 8, 2017 by Shayan816 Link to comment
Simple0x47 Posted July 8, 2017 Share Posted July 8, 2017 Okay so it shouldn't spawn any ammo when you type /pvp? Link to comment
Shayan816 Posted July 8, 2017 Author Share Posted July 8, 2017 3 minutes ago, Uknown. said: Okay so it shouldn't spawn any ammo when you type /pvp? it shouldnt spawn the ammo i used before i do /pvp i bought 10 grenades and used 3 grenades, so i have 7 grenades, i did /pvp i spawned in random place and i got 10 grenades instead of 7 i got those 3 grenades back... 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