Jump to content

Stranger

Members
  • Posts

    710
  • Joined

  • Last visited

Everything posted by Stranger

  1. i meant if someone select a skin from the grid list, and press the button then do trigger to setElementModel, i did put it in client side but no one can see the skin but him.
  2. hey guys, why if i do trigger to setElementModel from client to server side , not work ? client side: addEventHandler("onClientGUIClick", root, function() if (source == s1) then local row, col = guiGridListGetSelectedItem(gri) local ski = guiGridListGetItemText(gri, row, col) if (ski) then guiSetVisible(se, false) showCursor(false) if (ski == "Skin 1") then triggerServerEvent ("onPlayerSelectTheSkinOne", localPlayer) elseif (ski == "Skin 2") then triggerServerEvent ("onPlayerSelectTheSkinTwo", localPlayer) elseif (ski == "Skin 3") then triggerServerEvent ("onPlayerSelectTheSkinThree", localPlayer) elseif (ski == "Skin 4") then triggerServerEvent ("onPlayerSelectTheSkinFour", localPlayer) end end end end ) server side: addEvent ("onPlayerSelectTheSkinOne", true) addEvent ("onPlayerSelectTheSkinTwo", true) addEvent ("onPlayerSelectTheSkinThree", true) addEvent ("onPlayerSelectTheSkinFour", true) addEventHandler ("onPlayerSelectTheSkinOne", function () setElementModel(source, 283) end) addEventHandler ("onPlayerSelectTheSkinTwo", function () setElementModel(source, 282) end) addEventHandler ("onPlayerSelectTheSkinThree", function () setElementModel(source, 285) end) addEventHandler ("onPlayerSelectTheSkinFour", function () setElementModel(source, 287) end)
  3. so the problem in getPedTotalAmmo
  4. i did but nothing happend, no problems , but i don't know why it's not save.
  5. hi guys, i have this problem that this code is not save correctly: 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 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) else spawnPlayer ( source, 213.36328+math.random(1,3), 1867.44336+math.random(1,3), 13.14062, 0, 285, 0, 0) setPlayerMoney (source, 50000) setCameraTarget (source, source) fadeCamera(source, true, 2.0) end end end addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) function onQuit (quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then local x,y,z = getElementPosition (source) local r,g,b = getPlayerNametagColor (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-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, -- s8) -->) 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, -- s8) -->) 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) addEventHandler ("onPlayerWasted", root, function () setTimer (spawnPlayer, 3000, 1, source, 213.36328+math.random(1,3), 1867.44336+math.random(1,3), 13.14062, 0, 285, 0, 0) setTimer (setCameraTarget, 3250, 1, source, source) 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 addEventHandler("onPlayerWasted", root, function() local weapons = convertWeaponsToJSON(source) setElementData(source,"tempWeapons",weapons) 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 function check () local weapons = getElementData(source,"tempWeapons") if (weapons) then giveWeaponsFromJSON(source, weapons) setTimer (function () check () end, 4000, 1) end end addEventHandler ("onPlayerSpawn", root, check) function setTeam() local account = getPlayerAccount(source) local team = getAccountData (account, "team") if team and getTeamFromName(team) then setPlayerTeam(source, getTeamFromName(team)) end end addEventHandler("onPlayerLogin",getRootElement(),setTeam) function saveTeam() local team = getPlayerTeam(source) local account = getPlayerAccount(source) if (team) and not isGuestAccount(account) then setAccountData(account, "team", getTeamName(team)) end end addEventHandler("onPlayerQuit",getRootElement(),saveTeam) which mean if the player dead and spawned again, his weapon save randomly, i mean once save once not save, so help.
  6. yeah, it's work , thank you.
  7. no there is not a code that refilling the health, i'm sure, and the code i know there is no problem with it: addEventHandler ("onPlayerDamage", root, function (attacker, weapon, bodypart) if attacker then health = getElementHealth (source) setElementHealth (source, health - 30) end end)
  8. you didn't understand me, i mean every time i hit him he loss 30 until he die, and i just wanna make it fast, i mean i want when i hit him not loss 5 or whatever he use , i just wanna make it if i hit him he loss 30 until he die but i have this problem that if the player close to die his health refilled, i want it if he close to die , his health not refilled, just keep going down, i wish that you understand what i meant.
  9. i meant, that i want his health go down not go up, like if i hit him , will take from his health 30% until he die but i here is the problem that make the health refilled if his health reached 30
  10. hello, i have a problem or maybe bug ? i don't know that if i used: setElementHealth (player, getElementHealth (player) - 30) it's work but if his health and his health has reached 30, his health is filled automatically, i don't know if this is a bug or something like that.
  11. will, it's work, but not like what i said, i said i want it when someone aiming on the vehicle with weapon the vehicle will be destroyed.
  12. i did it like that: setTimer (function (player) target = getPedTarget (player) if getElementType (target) == "vehicle" then destroyElement (target) end end, 500,0) but not working !
  13. hello, how can i make when the player (ped) aiming on something like 'vehicle' be destroyed , or anything !
  14. sorry, for writing the name 'client side', the right name is 'destroy vehicle side' ^_^"
  15. cause your code , disaster, take my code.
  16. function make_db () executeSQLQuery ("CREATE TABLE IF NOT EXISTS dealercars (id NUMERIC, owner TEXT, model NUMERIC, name TEXT, health NUMBERIC, paintjob NUMERIC, color NUMERIC, upgrades NUMERIC)") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), make_db) local dealerMarker1 = createMarker(2131.75, -1148.138671875, 23.406946182251, "cylinder", 2, 0, 255, 0, 255) createBlipAttachedTo(dealerMarker1, 55, 2, 0, 0, 0, 0, 0, 300) function open_dealer_server (hitElement) if source == dealerMarker1 then triggerClientEvent(hitElement, "open_dealer_wdw", root) triggerClientEvent(hitElement, "list_dealer_cars", root) end end addEventHandler("onMarkerHit", getRootElement(), open_dealer_server) function buy_car_from_dealer (owner,model,name,money) if getPlayerMoney(owner) >= tonumber(money) then local ID = executeSQLQuery("SELECT * FROM dealercars") for i,v in ipairs(ID) do carid = v.id end local account = getAccountName(getPlayerAccount(owner)) local modela = getVehicleModelFromName(model) local carbought = executeSQLQuery("INSERT INTO dealercars(id,owner,model,name,health,paintjob,color,upgrades) VALUES(?,?,?,?,?,?,?,?)", carid, tostring(account), tonumber(modela), tostring(model), 1000, 0, 0, 0) takePlayerMoney(owner, money) setElementData(owner, "gotCar", "no") outputChatBox("Congratulations you've bought a "..model.." for "..money, owner, 0, 255, 0) else outputChatBox("You don't have enough money", owner, 255, 0, 0) end end addEvent("buy_dealer_car", true) addEventHandler("buy_dealer_car", getRootElement(), buy_car_from_dealer) ---------------------------------------------- --------------- Spawner Panel ---------------- ---------------------------------------------- function keybindpla () for i,v in ipairs(getElementsByType("player")) do bindKey(v, "f2", "down", open_spawner_pla) setElementData(v, "gotCar", "no") end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), keybindpla) addEventHandler("onPlayerLogin", getRootElement(), keybindpla) function open_spawner_pla (source) triggerClientEvent(source, "open_spawner_wdw", root) end function list_owned_cars_server (player) local playerAcc = getAccountName(getPlayerAccount(player)) local carlmao = executeSQLQuery("SELECT * FROM dealercars WHERE owner=?", playerAcc) for i,k in ipairs(carlmao) do triggerClientEvent(player, "list_owned_cars", root, k.name, k.health) end end addEvent("list_owned_cars_S", true) addEventHandler("list_owned_cars_S", getRootElement(), list_owned_cars_server) function spawn_car_pleaseD (ownerName,carName) if getElementData(ownerName, "gotCar") == "no" then local gayowner = getAccountName(getPlayerAccount(ownerName)) local carModel = getVehicleModelFromName(carName) local x,y,z = getElementPosition(ownerName) OwnerVehicle = createVehicle(carModel, x, y, z) setTimer(warpPedIntoVehicle, 50, 1, ownerName, OwnerVehicle) setElementData(OwnerVehicle, "owner", tostring(gayowner)) setElementData(ownerName, "gotCar", "yes") local carlma = executeSQLQuery("SELECT * FROM dealercars WHERE owner=?", gayowner) else outputChatBox("You don't own a car", ownerName, 255, 0, 0) end end addEvent("spawn_dealer_car", true) addEventHandler("spawn_dealer_car", getRootElement(), spawn_car_pleaseD) function destroy_car_pleaseD (ownerName) pedCar = getPedOccupiedVehicle(ownerName) gayownerAcc = getAccountName(getPlayerAccount(ownerName)) if isPedInVehicle(ownerName) == true then if getElementData(ownerName, "gotCar") == "yes" and getElementData(pedCar, "owner") == gayownerAcc then CurrentCar = getPedOccupiedVehicle(ownerName) destroyElement(CurrentCar) setElementData(ownerName, "gotCar", "no") else outputChatBox("You can't park a car you don't own", ownerName, 255, 0, 0) end else outputChatBox("You aren't in a vehicle", ownerName, 255, 0, 0) end end addEvent("destroy_dealer_car", true) addEventHandler("destroy_dealer_car", getRootElement(), destroy_car_pleaseD)
  17. addCommandHandler ("warn", function (player, cmd, playername) if playername then who = getPlayerFromName(playername) outputChatBox ("WARN: You have been warned", who, 255, 0, 0) else outputChatBox ("info: write - warn playername in f8", player, 255, 255, 0) end end)
  18. will this is the code: function spawn (Name,carName) if getElementData(Name, "haveCar") == "no" then local owner = getAccountName(getPlayerAccount(Name)) local carModel = getVehicleModelFromName(carName) local x,y,z = getElementPosition(Name) Vehicle = createVehicle(carModel, x, y, z) -- code getAccountData (owner, "upgrades") end addEvent("spawn_car", true) addEventHandler("spawn_car", getRootElement(), spawn) this the destroy vehicle side: function destroy (Name) Acc = getAccountName(getPlayerAccount(Name)) if getElementData(Name, "haveCar") == "yes" and getElementData(Vehicle, "owner") == Acc then -- code if Vehicle then for _,Upgrades in ipairs ( getVehicleUpgrades ( Vehicle ) ) do setAccountData (Acc, "upgrades", Upgrades) end addEvent("destroy_car", true) addEventHandler("destroy_car", getRootElement(), destroy)
  19. will, i did what you said but same thing !
  20. can you just tell me what i have to use, to make it save ? i know i have to use 'getVehicleUpgrades' but, can you tell me , what the right thing i have to use it !
  21. will i trid like this : function spawn (Name,carName) if getElementData(Name, "haveCar") == "no" then -- code local owner = getAccountName(getPlayerAccount(Name)) Vehicle = createVehicle(carModel, x, y, z) getAccountData (owner "upgrades") end addEvent("spawn_car", true) addEventHandler("spawn_car", getRootElement(), spawn) function destroy (Name) Acc = getAccountName(getPlayerAccount(Name)) -- code setAccountData (Acc, "upgrades", getVehicleUpgrades (Vehicle)) end addEvent("destroy_car", true) addEventHandler("destroy_car", getRootElement(), destroy) but not working
  22. hello, i was wondering, how can i save the upgrades of the vehicle that i have it ?
×
×
  • Create New...