Jump to content

bosslorenz

Members
  • Posts

    200
  • Joined

  • Last visited

Everything posted by bosslorenz

  1. onClientMarkerHit guiSetVisible But of course as you have said, another transport system on another marker. So you have to make another guiCreateWindow.
  2. Of course I did understand that, I know can be used when its a zip file a located at resources. But I extracted the client & server lua scripts which are located on this ==server > mods > deathmatch > resources > RPG (meta.xml located here) > LoginSystem (client & server scripts here). There, what im just trying to say is how can i add the accountaccess If its not located on the resources file. But thanks anyway for your comments Its just that I want all the scripts on my Folder so that i`ll just start all scripts with just 1 command. /start RPG But I now used the resource.login_panel
  3. Thanks, thats just my mistake, file src is the same as I should put in engineLoadTXD and engineLoadDFF . Thanks.
  4. Folder RPG ( meta.xml) RPG > (ZombieRPG)Weapons > weapons > (ak47.txd,ak47.dff) RPG > (ZombieRPG)Weapons > (weaponreplace-c.lua) Thats my folder. You gave me wrong meta.xml. It can no longer locate the file path/ script path. My meta.xml is not on the same folder as the weaponreplace-c.lua.
  5. --Client lua function replaceWeapon() local txd = engineLoadTXD("weapons/ak47.txd", true) engineImportTXD(txd, 355) local dff = engineLoadDFF("weapons/ak47.dff", 355) engineReplaceModel(dff, 355) end addEventHandler("onClientResourceStart", resourceRoot, replaceWeapon) Meta.xml No error in debug but it seems it keeps on the original texture of it.
  6. I downloaded the file zip. And the lua. server & client I put it in my folder server. I already added this 2 lua on my meta.xml? Does it have any exports to be added on meta?
  7. Server---- -- Login handling function loginPlayer(username,password,enableKickPlayer,attemptedLogins,maxLoginAttempts) if not (username == "") then if not (password == "") then local account = getAccount ( username, password ) if ( account ~= false ) then logIn (source, account, password) outputChatBox ("#0000FF* #FFFFFFYou have sucessfully logged in!",source,255,255,255,true) setTimer(outputChatBox,700,1,"#0000FF* #FFFFFFTo enable auto-login, use #ABCDEF/enableauto#FFFFFF!",source,255,255,255,true) triggerClientEvent (source,"hideLoginWindow",getRootElement()) else if enableKickPlayer == true then if (attemptedLogins >= maxLoginAttempts-1) then outputChatBox ("#0000FF* #FFFFFFError! Wrong username and/or password!",source,255,255,255,true) setTimer(outputChatBox,500,1,"#0000FF* #FFFFFFWarning! Maximum login attempts reached! [#008AFF"..attemptedLogins+1 .."/"..maxLoginAttempts.."#FFFFFF]",source,255,255,255,true) setTimer(outputChatBox,1000,1,"#0000FF* #FFFFFFYou will be kicked in #008AFF5 seconds#FFFFFF!",source,255,255,255,true) setTimer(kickPlayer,5000,1,source,"Failed to login") else outputChatBox ("#0000FF* #FFFFFFError! Wrong username and/or password!",source,255,255,255,true) setTimer(outputChatBox,500,1,"#0000FF* #FFFFFFLogin attempts: [#008AFF"..attemptedLogins+1 .."/"..maxLoginAttempts.."#FFFFFF]",source,255,255,255,true) triggerClientEvent(source,"onRequestIncreaseAttempts",source) end else outputChatBox ("#0000FF* #FFFFFFError! Wrong username and/or password!",source,255,255,255,true) end end else outputChatBox ("#0000FF* #FFFFFFError! Please enter your password!",source,255,255,255,true) end else outputChatBox ("#0000FF* #FFFFFFError! Please enter your username!",source,255,255,255,true) end end -- Registration here function registerPlayer(username,password,passwordConfirm) if not (username == "") then if not (password == "") then if not (passwordConfirm == "") then if password == passwordConfirm then local account = getAccount (username,password) if (account == false) then local accountAdded = addAccount(tostring(username),tostring(password)) if (accountAdded) then triggerClientEvent(source,"hideRegisterWindow",getRootElement()) outputChatBox ("#0000FF* #FFFFFFYou have sucessfuly registered! [username: #ABCDEF" .. username .. " #FF0000| #FFFFFFPassword: #ABCDEF" .. password .. "#FFFFFF]",source,255,255,255,true ) setTimer(outputChatBox,800,1,"#0000FF* #FFFFFFYou can now login with your new account.",source,255,255,255,true ) else outputChatBox ("#0000FF* #FFFFFFAn unknown error has occured! Please choose a different username/password and try again.",source,255,255,255,true ) end else outputChatBox ("#0000FF* #FFFFFFError! An account with this username already exists!",source,255,255,255,true ) end else outputChatBox ("#0000FF* #FFFFFFError! Passwords do not match!",source,255,255,255,true) end else outputChatBox ("#0000FF* #FFFFFFError! Please confirm your password!",source,255,255,255,true) end else outputChatBox ("#0000FF* #FFFFFFError! Please enter a password!",source,255,255,255,true) end else outputChatBox ("#0000FF* #FFFFFFError! Please enter a username you would like to register with!",source,255,255,255,true) end end -- Auto-login handling function autologinPlayer(username,password) if not (username == "") then if not (password == "") then local account = getAccount ( username, password ) if not (account == false) then logIn (source, account, password) outputChatBox("#0000FF* #FFFFFFYou have been automatically logged in.",source,255,255,255,true) setTimer(outputChatBox,1000,1,"#0000FF* #FFFFFFTo disable auto-login, use #ABCDEF/disableauto.",source,255,255,255,true) triggerClientEvent ( source, "hideLoginWindow", getRootElement()) else outputChatBox ("#FF0000* #FFFFFFAuto-login error - Username & password do not match",source,255,255,255,true) end else outputChatBox ("#FF0000* #FFFFFFAuto-login error - Failed to retrieve password",source,255,255,255,true) end else outputChatBox ("#FF0000* #FFFFFFAuto-login error - Failed to retrieve username",source,255,255,255,true) end end -- When the player logs out, trigger the client event to check if the login panel will request them to login again function logoutHandler() triggerClientEvent(source,"onRequestDisplayPanel",source) end addEventHandler("onPlayerLogout",getRootElement(),logoutHandler) -- Get the server's name function getData() local sName = md5(getServerName()) local sName = string.sub(sName,0,15) triggerClientEvent(source,"onGetServerData",getRootElement(),sName) end addEvent("onRequestLogin",true) addEvent("onRequestRegister",true) addEvent("onRequestAutologin",true) addEvent("onClientLoginLoaded",true) addEventHandler("onRequestLogin",getRootElement(),loginPlayer) addEventHandler("onRequestRegister",getRootElement(),registerPlayer) addEventHandler("onRequestAutologin",getRootElement(),autologinPlayer) addEventHandler("onClientLoginLoaded",getRootElement(),getData) Client--- ---------------------------------- -----------| Settings |----------- ---------------------------------- blackLoginScreen = true -- Set to 'true' to display a black screen to the player untill they log in or choose to play as a guest. enableKickPlayer = true -- Set whether to kick the player after they fail to login specified amount of times. disallowLogout = false -- Set whether to show the userpanel to the players if they log out of their accounts. removeBlackScreenTime = 4 -- The time it takes for the black screen to dissapear - If you choose to display the black screen. [iN SECONDS] maxLoginAttempts = 5 -- Set the maximum incorrect login attempts before the player gets kicked - If player kicking is enabled. ---------------------------------- -- Set the text you want displayed in the "rules" window here - use '\n' to go into the next line infoText = "------ Rules ------ \n\n* No cheating!\n* No insulting and spamming!\n* No vehicle mods\n\nEdit the text however you like\n\n\n\n\n\n\n\nLogin panel by NeXTreme" -- Screen and GUI window sizes screenWidth,screenHeight = guiGetScreenSize() mainWidth,mainHeight = 749,472 regWidth,regHeight = 439,344 -- Generate the XML file name function getServerName() triggerServerEvent("onClientLoginLoaded",getLocalPlayer()) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),getServerName) function setXmlFileName(sName) xmlFileName = tostring("login_"..sName..".xml") loginPanel() end addEvent("onGetServerData",true) addEventHandler("onGetServerData",getRootElement(),setXmlFileName) ---------------------------------- addEvent("onRequestIncreaseAttempts",true) addEvent("onRequestDisplayPanel",true) function loginPanel() -- Check if autologin is enabled - If yes, then log the player in, else create and show the userpanel local xmlFile = xmlLoadFile(xmlFileName) if xmlFile then status = xmlNodeGetAttribute(xmlFile,"autologin") if (status == "true") then local username = tostring(xmlNodeGetAttribute(xmlFile,"username")) local password = tostring(xmlNodeGetAttribute(xmlFile,"password")) if not (username == "") and not (password == "") then triggerServerEvent("onRequestAutologin",getLocalPlayer(),username,password) end else if blackLoginScreen == true then fadeCamera(false,0,0,0,0) end mainWindow = guiCreateWindow(screenWidth/2-mainWidth/2,screenHeight/2-mainHeight/2,mainWidth,mainHeight,"Login panel",false) guiWindowSetSizable(mainWindow,false) mInfo = guiCreateMemo(21,36,411,278,infoText,false,mainWindow) guiMemoSetReadOnly(mInfo,true) editUsername = guiCreateEdit(53,364,187,25,"",false,mainWindow) guiEditSetMaxLength(editUsername,30) editPassword = guiCreateEdit(53,421,187,25,"",false,mainWindow) guiEditSetMaxLength(editPassword,30) guiEditSetMasked(editPassword,true) lblUsername = guiCreateLabel(67,330,158,38,"Username:",false,mainWindow) guiLabelSetColor(lblUsername,0,85,255) guiLabelSetVerticalAlign(lblUsername,"center") guiLabelSetHorizontalAlign(lblUsername,"center",false) guiSetFont(lblUsername,"default-bold-small") lblPassword = guiCreateLabel(67,389,158,38,"Password:",false,mainWindow) guiLabelSetColor(lblPassword,0,85,255) guiLabelSetVerticalAlign(lblPassword,"center") guiLabelSetHorizontalAlign(lblPassword,"center",false) guiSetFont(lblPassword,"default-bold-small") btnPlayAsGuest = guiCreateButton(548,368,168,74,"Play as guest",false,mainWindow) guiSetFont(btnPlayAsGuest,"default-bold-small") btnLogin = guiCreateButton(280,368,242,74,"Login",false,mainWindow) guiSetFont(btnLogin,"sa-header") btnToggleRegister = guiCreateButton(490,246,206,68,"Register an account",false,mainWindow) guiSetFont(btnToggleRegister,"default-bold-small") registerWindow = guiCreateWindow(screenWidth/2-regWidth/2,screenHeight/2-regHeight/2,regWidth,regHeight,"Registration",false) guiWindowSetSizable(registerWindow,false) editRegistrationUsername = guiCreateEdit(98,138,242,25,"",false,registerWindow) editRegistrationPassword = guiCreateEdit(98,195,242,25,"",false,registerWindow) guiEditSetMasked(editRegistrationPassword,true) editRegistrationRepeatPassword = guiCreateEdit(99,252,242,25,"",false,registerWindow) guiEditSetMasked(editRegistrationRepeatPassword,true) lblRegister = guiCreateLabel(24,24,391,97,"Register",false,registerWindow) guiLabelSetColor(lblRegister,0,85,255) guiLabelSetVerticalAlign(lblRegister,"center") guiLabelSetHorizontalAlign(lblRegister,"center",false) guiSetFont(lblRegister,"sa-gothic") lblRUsername = guiCreateLabel(98,113,242,17,"Username:",false,registerWindow) guiLabelSetColor(lblRUsername,0,85,255) guiLabelSetVerticalAlign(lblRUsername,"center") guiLabelSetHorizontalAlign(lblRUsername,"center",false) guiSetFont(lblRUsername,"default-bold-small") lblRPassword = guiCreateLabel(98,171,242,17,"Password:",false,registerWindow) guiLabelSetColor(lblRPassword,0,85,255) guiLabelSetVerticalAlign(lblRPassword,"center") guiLabelSetHorizontalAlign(lblRPassword,"center",false) guiSetFont(lblRPassword,"default-bold-small") lblRepeatPassword = guiCreateLabel(98,230,242,17,"Repeat password:",false,registerWindow) guiLabelSetColor(lblRepeatPassword,0,85,255) guiLabelSetVerticalAlign(lblRepeatPassword,"center") guiLabelSetHorizontalAlign(lblRepeatPassword,"center",false) guiSetFont(lblRepeatPassword,"default-bold-small") btnCancel = guiCreateButton(232,292,179,38,"Cancel",false,registerWindow) guiSetFont(btnCancel,"default-bold-small") btnConfirmRegistration = guiCreateButton(29,292,179,38,"Confirm & register!",false,registerWindow) guiSetFont(btnConfirmRegistration,"default-bold-small") guiCreateStaticImage(440,23,300,225,"logo.png",false,mainWindow) guiSetVisible(mainWindow, true) guiSetVisible(registerWindow, false) guiSetInputEnabled(true) showCursor(true) addEventHandler("onClientGUIClick",btnLogin,onClickLogin) addEventHandler("onClientGUIClick",btnToggleRegister,onClickRegisterToggle) addEventHandler("onClientGUIClick",btnPlayAsGuest,onClickGuest) addEventHandler("onClientGUIClick",btnConfirmRegistration,onClickRegisterConfirm) addEventHandler("onClientGUIClick",btnCancel,onClickCancel) addEventHandler("onRequestIncreaseAttempts",getRootElement(),increaseAttempts) attemptedLogins = 0 end xmlUnloadFile(xmlFile) else xmlFileHandler(true) end addEventHandler("onRequestDisplayPanel",getRootElement(),logoutHandler) end --addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),loginPanel) -- Disable autologin function removeAutoLogin() local xmlFile = xmlLoadFile(xmlFileName) if xmlFile then local status = xmlNodeGetAttribute(xmlFile,"autologin") if status == "true" then xmlNodeSetAttribute(xmlFile,"autologin","false") outputChatBox("#0000FF* #FFFFFFAuto-login is now #FF0000DISABLED#FFFFFF!",255,255,255,true) xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) else outputChatBox("#0000FF* #FFFFFFAuto-login is already #FF0000DISABLED#FFFFFF!",255,255,255,true) xmlUnloadFile(xmlFile) end end end addCommandHandler("disableauto", removeAutoLogin) -- Enable autologin function addAutoLogin() local xmlFile = xmlLoadFile(xmlFileName) if xmlFile then local status = xmlNodeGetAttribute(xmlFile,"autologin") if status == "false" then xmlNodeSetAttribute(xmlFile,"autologin","true") outputChatBox("#0000FF* #FFFFFFAuto-login is now #00FF00ENABLED#FFFFFF! You will be automatically logged in every time you join the server.",255,255,255,true) setTimer(outputChatBox,1000,1,"#0000FF* #FFFFFFTo #FF0000DISABLE#FFFFFF auto-login, use #ABCDEF/disableauto#FFFFFF!",255,255,255,true) xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) else outputChatBox("#0000FF* #FFFFFFAuto-login is already #00FF00ENABLED#FFFFFF!",255,255,255,true) xmlUnloadFile(xmlFile) end end end addCommandHandler("enableauto", addAutoLogin) -- LOGIN PLAYER function onClickLogin(button,state) if(button == "left" and state == "up") then if (source == btnLogin) then username = guiGetText(editUsername) password = guiGetText(editPassword) triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,enableKickPlayer,attemptedLogins,maxLoginAttempts) xmlFileHandler() end end end -- REGISTER PLAYER function onClickRegisterConfirm(button,state) if(button == "left" and state == "up") then if (source == btnConfirmRegistration) then username = guiGetText(editRegistrationUsername) password = guiGetText(editRegistrationPassword) passwordConfirm = guiGetText(editRegistrationRepeatPassword) triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm) end end end -- Open registration window function onClickRegisterToggle(button,state) if(button == "left" and state == "up") then if (source == btnToggleRegister) then guiSetVisible(registerWindow, true) guiBringToFront(registerWindow) guiSetInputEnabled(true) showCursor(true) end end end -- Cancel registration function onClickCancel(button,state)
  8. Ive downloaded this resource from here by slothman https://community.multitheftauto.com/index.php?p=resources&s=details&id=292 Having same problem with other guys, no Marker to get the job. No error in debug. Anyone knows other resource of Cops n Robbers free?
  9. Heres the code I made. Buy rocket launcher working. Problem 1: But it looks like it still allows me to buy rocket launcher ammo even if I dont have a Rocket Launcher. Problem 2: Also when I buy rocket launcher, why does it give me a free 30 ammo, I have put only --SERVER-- function buym4() local playerMoney = getPlayerMoney(source) if (playerMoney >= 40000) then takePlayerMoney(source,40000) outputChatBox ("You have bought a Rocket Launcher.", source, 0, 255, 0, false) giveWeapon(source,35) local weapons = { } for i = 0, 12 do weapons[ i ] = { weapon = getPedWeapon( source ), ammo = getPedTotalAmmo( source, i ) } end setAccountData ( getPlayerAccount ( source ), "ownRlauncher", toJSON( weapons ) ) else outputChatBox ("Insufficient money to buy this weapon.", source, 255, 0, 0, false) end end addEvent("givem4",true) addEventHandler("givem4", root, buym4) function buym4ammo() local playerMoney = getPlayerMoney(source) local weapons = getAccountData( getPlayerAccount ( source ), "account.weapons" ) if ( weapons ) then weapons = fromJSON( weapons ) end if (playerMoney >= 10000) and getAccountData ( getPlayerAccount ( source ), "ownRlauncher" ) then outputChatBox ("You have bought a 150 Rocket Launcher Ammo.", source, 0, 255, 0, false) takePlayerMoney(source,10000) setWeaponAmmo(source,35,150) elseif (playerMoney < 10000) and getAccountData ( getPlayerAccount ( source ), "ownRlauncher" ) then outputChatBox ("Insufficient money to buy this ammo.", source, 255, 0, 0, false) elseif (playerMoney >= 10000) and ( not getAccountData ( getPlayerAccount ( source ), "ownRlauncher" ) ) then outputChatBox ("You need to buy first a Rocket Launcher.", source, 255, 0, 0, false) end end addEvent("givem4ammo",true) addEventHandler("givem4ammo", root, buym4ammo) --CLIENT-- marker1 = createMarker(1310, -1368.4000244141, 12.6, "cylinder", 1, 0, 0, 255, 255) GUIEditor = { button = {}, window = {}, progressbar = {} } addEventHandler("onClientResourceStart", resourceRoot, function() window1 = guiCreateWindow(283, 116, 173, 360, "TEST", false) guiWindowSetMovable(window1, false) guiWindowSetSizable(window1, false) guiSetVisible(window1,false) button1 = guiCreateButton(53, 66, 102, 49, "m4", false, window1) button2 = guiCreateButton(25, 158, 112, 58, "mp5", false, window1) button3 = guiCreateButton(117, 299, 47, 51, "close", false, window1) end ) function openGui() guiSetVisible(window1, true) showCursor(true) end addEventHandler("onClientMarkerHit", marker1, openGui) function buym4() if ( source == button1) then showCursor(false) guiSetVisible(window1,false) triggerServerEvent("givem4", localPlayer) end end addEventHandler("onClientGUIClick", root, buym4) function buym4ammo() if ( source == button2) then showCursor(false) guiSetVisible(window1,false) triggerServerEvent("givem4ammo", localPlayer) end end addEventHandler("onClientGUIClick", root, buym4ammo) function closeGui() if ( source == button3) then showCursor(false) guiSetVisible(window1,false) end end addEventHandler("onClientGUIClick", root, closeGui)
  10. Got it working now. --C-- marker1 = createMarker(1310, -1368.4000244141, 12.6, "cylinder", 1, 0, 0, 255, 255) GUIEditor = { button = {}, window = {}, progressbar = {} } addEventHandler("onClientResourceStart", resourceRoot, function() window1 = guiCreateWindow(283, 116, 173, 360, "TEST", false) guiWindowSetMovable(window1, false) guiWindowSetSizable(window1, false) guiSetVisible(window1,false) button1 = guiCreateButton(53, 66, 102, 49, "m4", false, window1) button2 = guiCreateButton(25, 158, 112, 58, "mp5", false, window1) button3 = guiCreateButton(117, 299, 47, 51, "close", false, window1) end ) function openGui() guiSetVisible(window1, true) showCursor(true) end addEventHandler("onClientMarkerHit", marker1, openGui) function buym4() if ( source == button1) then showCursor(false) guiSetVisible(window1,false) triggerServerEvent("givem4", localPlayer) end end addEventHandler("onClientGUIClick", root, buym4) function buymp5() if ( source == button2) then showCursor(false) guiSetVisible(window1,false) triggerServerEvent("givemp5", localPlayer) end end addEventHandler("onClientGUIClick", root, buymp5) function closeGui() if ( source == button3) then showCursor(false) guiSetVisible(window1,false) end end addEventHandler("onClientGUIClick", root, closeGui) -S- function buym4() local playerMoney = getPlayerMoney(source) if (playerMoney >= 40000) then takePlayerMoney(source,40000) giveWeapon(source,31,200) end end addEvent("givem4",true) addEventHandler("givem4", root, buym4) function buymp5() local playerMoney = getPlayerMoney(source) if (playerMoney >= 10000) then takePlayerMoney(source,10000) giveWeapon(source,29,150) end end addEvent("givemp5",true) addEventHandler("givemp5", root, buymp5) Does someone knows how can I make this separate sell. Just like sell M4 with no bullets. and after buying M4 you can buy bullets for M4. But without the weapon you cannot buy ammo for m4. And also saves the weapon to the account even when ammo runs out, id doesnt remove the weapon from the player.
  11. CLIENT marker1 = createMarker(1310, -1368.4000244141, 12.6, "cylinder", 1, 0, 0, 255, 255) GUIEditor = { button = {}, window = {}, progressbar = {} } addEventHandler("onClientResourceStart", resourceRoot, function() window1 = guiCreateWindow(283, 116, 173, 360, "TEST", false) guiWindowSetMovable(window1, false) guiWindowSetSizable(window1, false) guiSetVisible(window1,false) button1 = guiCreateButton(53, 66, 102, 49, "m4", false, window1) button2 = guiCreateButton(25, 158, 112, 58, "mp5", false, window1) button3 = guiCreateButton(117, 299, 47, 51, "close", false, window1) end ) function openGui() guiSetVisible(window1, true) showCursor(true) end addEventHandler("onClientMarkerHit", marker1, openGui) function buym4(thePlayer,button1) if ( source == button1) then showCursor(false) guiSetVisible(window1,false) triggerServerEvent("givem4", localPlayer) end end addEventHandler("onClientGUIClick", root, buym4) function buymp5(thePlayer,button2) if ( source == button2) then showCursor(false) guiSetVisible(window1,false) triggerServerEvent("givemp5", localPlayer) end end addEventHandler("onClientGUIClick", root, buymp5) function closeGui() if ( source == button3) then showCursor(false) guiSetVisible(window1,false) end end addEventHandler("onClientGUIClick", root, closeGui) SERVER function buym4() local playerMoney = getPlayerMoney(source) if (playerMoney >= 40000) then takePlayerMoney(source,40000) giveWeapon(source,31,200) end end addEvent("givem4",true) addEventHandler("givem4", root, buym4) function buymp5() local playerMoney = getPlayerMoney(source) if (playerMoney >= 10000) then takePlayerMoney(source,10000) giveWeapon(source,29,150) end end addEvent("givemp5",true) addEventHandler("givemp5", root, buymp5) When i click button1 and button2 its not working. It doesnt takemymoney and doesnt giveWeapon. Only the close button3 works! Help pls!
  12. -CLIENT- local weaponshopmarker1 = createMarker( 1302, -1377, 12.7, "cylinder", 1, 0, 0, 255, 255) GUIEditor = { button = {}, staticimage = {}, progressbar = {}, window = {} } function showweap1() GUIEditor.window[1] = guiCreateWindow(247, 140, 291, 393, "LORENZ WEAPON SHOP TEST", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetProperty(GUIEditor.window[1], "CaptionColour", "FF1100FF") GUIEditor.button[1] = guiCreateButton(162, 73, 92, 66, "M4 ($5000)", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFF0000") GUIEditor.button[2] = guiCreateButton(162, 255, 92, 63, "MP5 ($3000)", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFF003B") GUIEditor.staticimage[1] = guiCreateStaticImage(23, 71, 107, 63, "m4.png", false, GUIEditor.window[1]) GUIEditor.staticimage[2] = guiCreateStaticImage(23, 255, 105, 63, "Smp5.png", false, GUIEditor.window[1]) showCursor(true) end function weaponshop1() guiSetVisible(GUIEditor.window[1], true) end addEventHandler("onClientMarkerHit", weaponshopmarker1, showweap1) function buy1 () if (source == GUIEditors.button[1]) then showCursor(true) triggerServerEvent ("givem4", localPlayer) end end addEventHandler("onClientGUIClick", root, buy1) -SERVER- function giveweaponm4() if ( getPlayerMoney (source) >= 5000 ) then takePlayerMoney(source, 5000) giveWeapon (source,31,150,true) end end addEvent("givem4",true) addEventHandler("givem4", root, giveweaponm4) problem is when I click button[1] it doesnt give me the weapon, becoz it doesnt takemy $5000 money. Help
  13. Thanks @Walid. I should have checked it fully before posting here .
  14. CLIENT-SIDE ped1 = createPed( 285, 1314, -1369, 13.6, 180) setElementFrozen (ped1,true) function cancelPedDamage() cancelEvent() end addEventHandler("onClientPedDamage", ped1, cancelPedDamage) function givePed1() givePedWeapon( ped1, 31, 500, true) setTimer( givePedWeapon, 1000, 1, ped1, 31, 500, true) end addEventHandler("onResourceStart", root, givePed1) No error debug. its just that when the resource starts , it spawns the ped but not holding the weapon=31=M4. I need help
  15. function saveAccount( account ) local account = eventName == "onPlayerLogout" and account or getPlayerAccount( source ) if ( account ) and ( not isGuestAccount( account ) ) then local x, y, z = getElementPosition( source ) local _, _, rotation = getElementRotation( source ) local position = { skin = getElementModel( source ), x = x, y = y, z = z, interior = getElementInterior( source ), dimension = getElementDimension( source ), rotation = rotation } local stats = { money = getPlayerMoney( source ), health = getElementHealth( source ), armor = getPedArmor( source ) } local weapons = { } for i = 0, 12 do weapons[ i ] = { weapon = getPedWeapon( source ), ammo = getPedTotalAmmo( source, i ) } end setAccountData( account, "account.position", toJSON( position ) ) setAccountData( account, "account.stats", toJSON( stats ) ) setAccountData( account, "account.weapons", toJSON( weapons ) ) end end addEventHandler( "onPlayerQuit", root, saveAccount ) addEventHandler( "onPlayerWasted", root, saveAccount ) addEventHandler( "onPlayerLogout", root, saveAccount ) addEventHandler( "onPlayerLogin", root, function( _, account ) local position = getAccountData( account, "account.position" ) if ( position ) then position = fromJSON( position ) spawnPlayer( source, position.x, position.y, position.z, position.rotation, position.skin, position.interior, position.dimension ) else spawnPlayer( source, 2485, -1665, 13.5, 0, 0, 0, 0 ) end setCameraTarget( source, source ) fadeCamera( source, true, 2.0 ) local stats = getAccountData( account, "account.stats" ) if ( stats ) then stats = fromJSON( stats ) setElementHealth( source, stats.health ) setPedArmor( source, stats.armor ) setPlayerMoney( source, stats.money ) end local weapons = getAccountData( account, "account.weapons" ) if ( weapons ) then weapons = fromJSON( weapons ) for i, data in pairs( weapons ) do giveWeapon( source, data.weapon, data.ammo, false ) end end end ) addEventHandler("onPlayerWasted", root, function() spawnPlayer( source, 2485, -1665, 13.5, 0, 0, 0, 0 ) local weapons = convertWeaponsToJSON(source) setElementData(source,"tempWeapons",weapons) end ) addEventHandler("onPlayerSpawn", root, function () local weapons = getElementData(source,"tempWeapons") if (weapons) then giveWeaponsFromJSON(source, weapons) end end ) function convertWeaponsToJSON(player) local 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 return toJSON(weaponsTable) end function giveWeaponsFromJSON(player, weapons) 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 Can anyone pls help me with this. No error in debugscript but doesnt save skin , load weapons on death
  16. function saveAccount( account ) local account = eventName == "onPlayerLogout" and account or getPlayerAccount( source ) if ( account ) and ( not isGuestAccount( account ) ) then local x, y, z = getElementPosition( source ) local _, _, rotation = getElementRotation( source ) local position = { skin = getElementModel( source ), x = x, y = y, z = z, interior = getElementInterior( source ), dimension = getElementDimension( source ), rotation = rotation } local stats = { money = getPlayerMoney( source ), health = getElementHealth( source ), armor = getPedArmor( source ) } local weapons = { } for i = 0, 12 do weapons[ i ] = { weapon = getPedWeapon( source ), ammo = getPedTotalAmmo( source, i ) } end setAccountData( account, "account.position", toJSON( position ) ) setAccountData( account, "account.stats", toJSON( stats ) ) setAccountData( account, "account.weapons", toJSON( weapons ) ) end end addEventHandler( "onPlayerQuit", root, saveAccount ) addEventHandler( "onPlayerWasted", root, saveAccount ) addEventHandler( "onPlayerLogout", root, saveAccount ) addEventHandler( "onPlayerLogin", root, function( _, account ) local position = getAccountData( account, "account.position" ) if ( position ) then position = fromJSON( position ) spawnPlayer( source, position.x, position.y, position.z, position.rotation, position.skin, position.interior, position.dimension ) else spawnPlayer( source, 2485, -1665, 13.5, 0, 0, 0, 0 ) end setCameraTarget( source, source ) fadeCamera( source, true, 2.0 ) local stats = getAccountData( account, "account.stats" ) if ( stats ) then stats = fromJSON( stats ) setElementHealth( source, stats.health ) setPedArmor( source, stats.armor ) setPlayerMoney( source, stats.money ) end local weapons = getAccountData( account, "account.weapons" ) if ( weapons ) then weapons = fromJSON( weapons ) for i, data in pairs( weapons ) do giveWeapon( source, data.weapon, data.ammo, false ) end end end ) function onWasted() spawnPlayer( source, 2485, -1665, 13.5) if ( weapons ) then weapons = fromJSON( weapons ) for i, data in pairs( weapons ) do giveWeapon( source, data.weapon, data.ammo, false ) end end end addEventHandler ("onPlayerWasted", root, onWasted) Can anyone pls help me with this. onWasted. It doesnt load any of my weapons but no error in debug.
  17. Cant help you with that now . Mine works 100%
  18. https://community.multitheftauto.com/in ... ls&id=8036 You could use this resource. Its very good gang system. Hope it helps you
  19. bosslorenz

    Zday

    Zday by slothman, 1) Is there a way to spawn zombies everywhere but only in a radar area? streaming is still ==1
  20. addEventHandler("onPlayerSpawn", root, function ( ) local account = getPlayerAccount(source) if (account) and not (isGuestAccount(account)) then local weapons = getAccountData(account, "weapons") if (weapons) then takeAllWeapons(source) for weapon, ammo in pairs(fromJSON(weapons)) do giveWeapon(source, weapon, ammo, true) end end end end) addEventHandler("onPlayerWasted", root, function ( ) local account = getPlayerAccount(source) if (account) and not (isGuestAccount(account)) then local weapons = getAllPedWeapon(source) setAccountData(account, "weapons", toJSON(weapons)) fadeCamera(source, false) setTimer(spawnPlayer, 1000, 1 , source, 2485, -1665, 13.5, 0, getPedSkin(source), 0 ,0) setTimer(setCameraTarget, 1250, 1, source, source) setTimer(fadeCamera, 2000, 1, source, true) end end) function getAllPedWeapon(thePed) if (isPedDead(source)) then return end local weapons = { } for slot=1, 12 do local weapon = getPedWeapon(thePed, slot) local ammo = getPedTotalAmmo(thePed, slot) if (weapon > 0) and (ammo > 0) then weapons[weapon] = ammo end end return weapons end Here the code u gave. I just added spawn function upon onPlayerWasted. And this error shows bad argument #1 to 'pairs' (table expected, got nil)
  21. function saveAccount( account ) local account = eventName == "onPlayerLogout" and account or getPlayerAccount( source ) if ( account ) and ( not isGuestAccount( account ) ) then local x, y, z = getElementPosition( source ) local _, _, rotation = getElementRotation( source ) local position = { skin = getElementModel( source ), x = x, y = y, z = z, interior = getElementInterior( source ), dimension = getElementDimension( source ), rotation = rotation } local stats = { money = getPlayerMoney( source ), health = getElementHealth( source ), armor = getPedArmor( source ) } local weapons = { } for i = 0, 12 do weapons[ i ] = { weapon = getPedWeapon( source ), ammo = getPedTotalAmmo( source, i ) } end setAccountData( account, "account.position", toJSON( position ) ) setAccountData( account, "account.stats", toJSON( stats ) ) setAccountData( account, "account.weapons", toJSON( weapons ) ) end end addEventHandler( "onPlayerQuit", root, saveAccount ) addEventHandler( "onPlayerWasted", root, saveAccount ) addEventHandler( "onPlayerLogout", root, saveAccount ) addEventHandler( "onPlayerLogin", root, function( _, account ) local position = getAccountData( account, "account.position" ) if ( position ) then position = fromJSON( position ) spawnPlayer( source, position.x, position.y, position.z, position.rotation, position.skin, position.interior, position.dimension ) else spawnPlayer( source, 2485, -1665, 13.5, 0, 0, 0, 0 ) end setCameraTarget( source, source ) fadeCamera( source, true, 2.0 ) local stats = getAccountData( account, "account.stats" ) if ( stats ) then stats = fromJSON( stats ) setElementHealth( source, stats.health ) setPedArmor( source, stats.armor ) setPlayerMoney( source, stats.money ) end local weapons = getAccountData( account, "account.weapons" ) if ( weapons ) then weapons = fromJSON( weapons ) for i, data in pairs( weapons ) do giveWeapon( source, data.weapon, data.ammo, false ) end end end ) function onWasted(totalAmmo, killer, killerWeapon, bodypart , stealth) if not isGuestAccount(getPlayerAccount(source)) then local theWeapon = getPedWeapon(source) local weaponAmmo = getPedTotalAmmo(source) fadeCamera(source, false) setTimer(spawnPlayer, 1500, 1 , source, 2485, -1665, 13.5, 0, getPedSkin(source), 0 ,0) setTimer(fadeCamera, 1500, 1, source, true) setTimer(setCameraTarget, 2000, 1, source, source) setTimer(giveWeapon, 2000, 1, source, data.weapon, data.ammo) end end addEventHandler("onPlayerWasted", getRootElement(), onWasted) Ive changed theWeapon -->>data.weapon and weaponAmmo to data.ammo and this errors show:69: attempt to index global 'data' (a nil value)
  22. Its just the weapons thats not working. It still keeps on not loading any weapons. But no debugerrors and others works fine
×
×
  • Create New...