Jump to content

shaio

Members
  • Posts

    117
  • Joined

  • Last visited

Everything posted by shaio

  1. I want to be able to change skins, and go in order with the table index.
  2. Cmon for real, would someone please look at this script?? I really need some help.. And for :Os sake it all server side, It can't be leaked, I'll make client side dxDraw for it when I get the damn thing to work. I made it myself.. Please help me..
  3. Could somebody please help me with this??
  4. This is all server side. I have no errors and no warnings in debugscript. I cannot find what is wrong with this script. Could someone please help me? I'm using just 2 skins for test purposes. I cannot change team or skin. local root = getRootElement() defaultSkin = 0 defaultTeam = "" currentSkin = 1 currentTeam = 1 team = "" enabled = false -------------------------------------------------- Configuration -------------------------------------------------- k = "F4" teams = { {team = "Freeroamer",x = -1980.03125,y = 884.171875,z = 45.203125,camX = -1991.60546875,camY = 883.015625,camZ = 49.198482513428,rot = 0,r = 0,g = 0,b = 0}, {team = "Gangster",x = 2498.328125,y = -1666.9169921875,z = 13.345584869385,camX = 2485.46484375,camY = -1666.2373046875,camZ = 16.649211883545,rot = 0,r = 0,g = 0,b = 0}, {team = "Doctor",x = 1178.6708984375,y = -1323.6162109375,z = 14.131542205811,camX = 1178.6708984375,camY = -1323.6162109375,camZ = 13.531591415405,rot = 0,r = 0,g = 0,b = 0}, {team = "Police",x = 1542.80078125,y = -1674.4306640625,z = 13.555210113525,camX = 1526.4638671875,camY = -1675.212890625,camZ = 19.493789672852,rot = 0,r = 0,g = 0,b = 0}, {team = "Military",x = 201.4443359375,y = 1897.6630859375,z = 17.640625,camX = 204.458984375,camY = 1919.634765625,camZ = 23.877788543701,rot = 0,r = 0,g = 0,b = 0}, {team = "Staff",x = -2025.8017578125,y = 171.3896484375,z = 28.84375,camX = -2002.76171875,camY = 170.9296875,camZ = 39.366466522217,rot = 0,r = 0,g = 0,b = 0} } skins = {} skins["Freeroamer"] = {0,5} skins["Gangster"] = {1,4} skins["Doctor"] = {2,3} skins["Police"] = {3,2} skins["Military"] = {4,1} skins["Staff"] = {5,0} ------------------------------------------------------------------------------------------------------------------- addEventHandler("onPlayerLogin",root,function() setAccountData(getPlayerAccount(source),"firstTime",true) bindKey(source,k,"down",deathChangeTeam) firstChange(source) end) for i,t in pairs(teams) do createTeam(t.team,t.r,t.g,t.b) end function firstChange(player) if getElementType(player) == "player" then defaultSkin = getElementModel(player) if getPlayerTeam(player) then defaultTeam = getPlayerTeam(player) end team = "Freeroamer" if currentSkin == #skins[tostring(team)] then currentSkin = 1 else currentSkin = currentSkin + 1 end updateSkin(player) for i,te in pairs(teams) do if te.team == team then setElementPosition(player,tonumber(te.x),tonumber(te.y),tonumber(te.z)) setCameraMatrix(player,tonumber(te.camX),tonumber(te.camY),tonumber(te.camZ),tonumber(te.x),tonumber(te.y),tonumber(te.z),0,70) end end setElementFrozen(player,true) bindKey(player,"arrow_u","down",changeTeam) bindKey(player,"arrow_d","down",changeTeam) bindKey(player,"arrow_l","down",changeSkin) bindKey(player,"arrow_r","down",changeSkin) bindKey(player,"enter","down",finishSelection) if getAccountData(getPlayerAccount(player),"firstTime") == false then bindKey(player,"backspace","down",exitSelection) end toggleAllControls(player,false) end end function changeSkin(player,key) if key == "arrow_l" then if currentSkin == 1 then currentSkin = #skins[tostring(team)] else currentSkin = currentSkin - 1 end elseif key == "arrow_r" then if currentSkin == #skins[tostring(team)] then currentSkin = 1 else currentSkin = currentSkin + 1 end end updateSkin(player) end function changeTeam(player,key) if key == "arrow_d" then if currentTeam == 1 then currentTeam = #teams else currentTeam = currentTeam - 1 end elseif key == "arrow_u" then if currentTeam == #teams then currentTeam = 1 else currentTeam = currentTeam + 1 end end updateTeam(player) end function updateSkin(player) for i,s in pairs(skins[tostring(team)]) do if i == currentSkin then setElementModel(player,tonumber(s)) end end end function updateTeam(player) for i,t in pairs(teams) do if i == currentTeam then if t.team == team then team = t.team updateSkin(player) setElementPosition(player,tonumber(t.x),tonumber(t.y),tonumber(t.z)) setCameraMatrix(player,tonumber(t.camX),tonumber(t.camY),tonumber(t.camZ),tonumber(t.x),tonumber(t.y),tonumber(t.z),0,70) end end end end function deathChangeTeam(player,key) if key == "f4" then addEventHandler("onPlayerWasted",root,function() if source == player then if getAccountData(getPlayerAccount(source),"firstTime") == false then if enabled == false then firstChange(source) outputChatBox("You will now be entered into team selection when you die.",player,0,255,255) enabled = true elseif enabled == true then outputChatBox("Team selection cancelled!",player,0,255,255) enabled = false end end end end) end end function finishSelection(player,key) if key == "enter" then setCameraTarget(player,player) setElementFrozen(player,false) toggleAllControls(player,true) setPlayerTeam(player,getTeamFromName(team)) unbindKey(player,"arrow_u","down",changeTeam) unbindKey(player,"arrow_d","down",changeTeam) unbindKey(player,"arrow_l","down",changeSkin) unbindKey(player,"arrow_r","down",changeSkin) unbindKey(player,"enter","down",finishSelection) unbindKey(player,"backspace","down",exitSelection) setAccountData(getPlayerAccount(player),"firstTime",true) end end function exitSelection(player,key) if key == "backspace" then setElementModel(player,tonumber(defaultSkin)) setPlayerTeam(player,defaultTeam) setCameraTarget(player,player) setElementFrozen(player,false) toggleAllControls(player,true) unbindKey(player,"arrow_u","down",changeTeam) unbindKey(player,"arrow_d","down",changeTeam) unbindKey(player,"arrow_l","down",changeSkin) unbindKey(player,"arrow_r","down",changeSkin) unbindKey(player,"enter","down",finishSelection) unbindKey(player,"backspace","down",exitSelection) end end
  5. shaio

    Teams

    Could anyone help me with this?
  6. shaio

    Teams

    Here is full script, I got everything to work. But there are a few bugs. When two players enter the skin selection at the same time, the player ends up joining a different team, some skins combine with other team skins, and after a while if using the skin selector I found that it quits working, you aren't able to use the bindkeys to change skins anymore. So please help me with this. local root = getRootElement() defaultSkin = 0 defaultTeam = "" currentskin = 1 mak = "" -------------------------------------------------- Configuration -------------------------------------------------- teams = { {team = "No Team",pedID = 0,x = 409.55225,y = -2205.87939,z = 10.87813,r = 255,g = 0,b = 0}, {team = "Medic",pedID = 275,x = 409.34235,y = -2208.22314,z = 10.87813,r = 0,g = 255,b = 255}, {team = "Vagos",pedID = 108,x = 409.32993,y = -2210.71582,z = 10.87813,r = 255,g = 255,b = 0}, {team = "Triads",pedID = 118,x = 409.33679,y = -2201.01514,z = 10.87813,r = 100,g = 100,b = 100}, {team = "Sidnacoo",pedID = 124,x = 409.33578,y = -2196.91724,z = 10.87813,r = 113,g = 201,b = 90}, {team = "Grove",pedID = 106,x = 409.33737,y = -2216.90210,z = 10.87813,r = 50,g = 220,b = 60}, {team = "Bikers",pedID = 254,x = 409.33804,y = -2213.61621,z = 10.87813,r = 220,g = 170,b = 40}, {team = "Ballas",pedID = 104,x = 409.33844,y = -2195.09155,z = 10.87813,r = 130,g = 37,b = 132}, {team = "Aztecas",pedID = 114,x = 409.33960,y = -2199.03662,z = 10.87813,r = 10,g = 180,b = 177}, {team = "Police",pedID = 285,x = 409.33051,y = -2203.03003,z = 10.87813,r = 0,g = 0,b = 0} } skins = {} skins["No Team"] = {0,1,2,7,13,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,32,33,34,35,36,37,43,44,45,46,47,48,49,50,51,52,57,58,61,62,66,68,72,78,79,80,81,82,83,84,94,95,96,97,98,99,101,128,132,133,134,135,136,142,143,144,146,153,154,155,156,158,159,160,161,162,167,168,170,171,176,177,179,180,181,182,183,184,185,186,187,188,189,200,202,203,204,206,209,210,212,213,220,221,222,227,228,229,230,231,234,235,236,239,240,241,242,249,250,252,253,254,255,258,259,260,261,262,264,272,278,279,290,291,295,297,299,302,303,305,306,308,309,310} skins["Medic"] = {274,275,276,70} skins["Vagos"] = {108,109,110} skins["Triads"] = {118,120,117,118,120} skins["Sidnacoo"] = {120,124} skins["Grove"] = {105,106,107,269,270,300,301,311} skins["Bikers"] = {100,247,248,254} skins["Ballas"] = {102,103,104,293} skins["Aztecas"] = {114,115,116,292} skins["Police"] = {71,73,163,164,165,166,265,266,267,280,281,282,283,284,285,286,287,288,312} ------------------------------------------------------------------------------------------------------------------- teamSelectors = {} ped = {} marker = {} function markerEnter(element,dim) if getElementType(element) == "player" then mak = getElementData(source,"team") defaultSkin = getElementModel(element) defaultTeam = getPlayerTeam(element) team = getElementData(source,"team") for i,plr in pairs(getElementsByType("player")) do setElementVisibleTo(element,plr,false) setElementVisibleTo(plr,element,false) end if currentskin == #skins[tostring(mak)] then currentskin = 1 else currentskin = currentskin + 1 end update(element) setElementPosition(element,451.033203125,-2207.3427734375,10.878125190735) setCameraMatrix(element,440.205078125,-2206.6123046875,12,451.033203125,-2207.3427734375,10.878125190735,0,30) setElementFrozen(element,true) bindKey(element,"arrow_l","down",changeSkin) bindKey(element,"arrow_r","down",changeSkin) bindKey(element,"enter","down",finishSelection) bindKey(element,"backspace","down",exitSelection) toggleAllControls(element,false) end end for i,t in pairs(teams) do createTeam(t.team,t.r,t.g,t.b) ped[i] = createPed(t.pedID,t.x,t.y+1,t.z) marker[i] = createMarker(t.x+1,t.y+1,t.z-0.9,"cylinder",1,t.r,t.g,t.b,130) setElementData(marker[i],"team",t.team) table.insert(teamSelectors,{p = ped[i],mark = marker[i]}) for i,p in pairs(teamSelectors) do setElementRotation(p.p,0,0,-90) setElementFrozen(p.p,true) end addEventHandler("onMarkerHit",marker[i],markerEnter) end for i,ped in pairs(teamSelectors) do setTimer(function() setElementCollisionsEnabled(ped.p,false) end,1000,1) end function changeSkin(player,key) if key == "arrow_l" then if currentskin == 1 then currentskin = #skins[tostring(mak)] else currentskin = currentskin - 1 end elseif key == "arrow_r" then if currentskin == #skins[tostring(mak)] then currentskin = 1 else currentskin = currentskin + 1 end end update(player) end function update(player) for i,s in pairs(skins[tostring(mak)]) do if i == currentskin then setElementModel(player,tonumber(s)) end end end function finishSelection(player,key) if key == "enter" then setCameraTarget(player,player) setElementFrozen(player,false) toggleAllControls(player,true) setPlayerTeam(player,getTeamFromName(mak)) unbindKey(player,"arrow_l","down",changeSkin) unbindKey(player,"arrow_r","down",changeSkin) unbindKey(player,"enter","down",finishSelection) unbindKey(player,"backspace","down",exitSelection) for i,plr in pairs(getElementsByType("player")) do setElementVisibleTo(player,plr,true) setElementVisibleTo(plr,player,true) end end end function exitSelection(player,key) if key == "backspace" then setElementModel(player,tonumber(defaultSkin)) setPlayerTeam(player,defaultTeam) setCameraTarget(player,player) setElementFrozen(player,false) toggleAllControls(player,true) unbindKey(player,"arrow_l","down",changeSkin) unbindKey(player,"arrow_r","down",changeSkin) unbindKey(player,"enter","down",finishSelection) unbindKey(player,"backspace","down",exitSelection) for i,plr in pairs(getElementsByType("player")) do setElementVisibleTo(player,plr,true) setElementVisibleTo(plr,player,true) end end end
  7. shaio

    Help

    Account("risk").player doesn't exist. So you cannot call it. You need something like this. function Account() end
  8. shaio

    Help

    is Account() a defined function?
  9. shaio

    Teams

    I have this and the error is with the event.. It cannot call the function, and yes, the function does exist.. for i,t in pairs(teams) do createTeam(t.team,t.r,t.g,t.b) ped[i] = createPed(t.pedID,t.x,t.y+1,t.z,270) marker[i] = createMarker(t.x,t.y,t.z,"cylinder",0.7,t.r,t.g,t.b,255) setElementData(marker[i],"team",t.team) addEventHandler("onMarkerHit",marker[i],markerEnter) table.insert(teamSelectors,{p = ped[i],mark = marker[i]}) end
  10. shaio

    Teams

    Could anyone help me with this?
  11. shaio

    Teams

    u make a table here.. table called 'peds' exists, this is just creating a sub-table in the peds table..
  12. shaio

    Teams

    I'm making a team system where when a player enters the marker near the ped it changes the peds skin and team. But it says error on line 18. } expected near =. Help me with this please. teams = { {team = "No Team",pedID = 0,x = 409.55225,y = -2205.87939,z = 10.87813,r = 255,g = 0,b = 0,skins = {0,1,2,7,13,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,32,33,34,35,36,37,43,44,45,46,47,48,49,50,51,52,57,58,61,62,66,68,72,78,79,80,81,82,83,84,94,95,96,97,98,99,101,128,132,133,134,135,136,142,143,144,146,153,154,155,156,158,159,160,161,162,167,168,170,171,176,177,179,180,181,182,183,184,185,186,187,188,189,200,202,203,204,206,209,210,212,213,220,221,222,227,228,229,230,231,234,235,236,239,240,241,242,249,250,252,253,254,255,258,259,260,261,262,264,272,278,279,290,291,295,297,299,302,303,305,306,308,309,310}}, {team = "Medic",pedID = 275,x = 409.34235,y = -2208.22314,z = 10.87813,r = 0,g = 255,b = 255,skins = {274,275,276,70}}, {team = "Vagos",pedID = 108,x = 409.32993,y = -2210.71582,z = 10.87813,r = 255,g = 255,b = 0,skins = {108,109,110}}, {team = "Triads",pedID = 118,x = 409.33679,y = -2201.01514,z = 10.87813,r = 100,g = 100,b = 100,skins = {118,120,117,118,120}}, {team = "Sidnacoo",pedID = 124,x = 409.33578,y = -2196.91724,z = 10.87813,r = 113,g = 201,b = 90,skins = {120,124}}, {team = "Grove",pedID = 106,x = 409.33737,y = -2216.90210,z = 10.87813,r = 50,g = 220,b = 60,skins = {105,106,107,269,270,300,301,311}}, {team = "Bikers",pedID = 254,x = 409.33804,y = -2213.61621,z = 10.87813,r = 220,g = 170,b = 40,skins = {100,247,248,254}}, {team = "Ballas",pedID = 104,x = 409.33844,y = -2195.09155,z = 10.87813,r = 130,g = 37,b = 132,skins = {102,103,104,293}}, {team = "Aztecas",pedID = 114,x = 409.33960,y = -2199.03662,z = 10.87813,r = 10,g = 180,b = 177,skins = {114,115,116,292}}, {team = "Police",pedID = 285,x = 409.33051,y = -2203.03003,z = 10.87813,r = 0,g = 0,b = 0,skins = {71,73,163,164,165,166,265,266,267,280,281,282,283,284,285,286,287,288,312}} } peds = {} for i,t in pairs(teams) do createTeam(t.team,t.r,t.g,t.b) table.insert(peds,{ped[i] = createPed(t.pedID,t.x,t.y+1,t.z,270),marker[i] = createMarker(t.x,t.y,t.z,"cylinder",0.7,t.r,t.g,t.b,255)}) end
  13. shaio

    Lock System

    exactly, it represents all the sub tables, which means it will check all the vehicles, and if one of those vehicles are locked, it will not work for the rest.
  14. shaio

    help

    local wanted = {} function vehicleExitJack(player,seat,jacked) if jacked then wanted[player] = {level = 6} setTimer(kill911,60000,1,player) end end addEventHandler("onVehicleExit",getRootElement(),vehicleExitJack) function setWanted(player,otherPlayer) if wantedPlayers == true then local wantedPlayer = getPlayerFromName(otherPlayer) setPlayerWantedLevel(wantedPlayer,6) wanted[player] = {level = 6} setTimer(kill911,60000,1,wantedPlayer) end end addCommandHandler("911",setWanted) function updateWanted() for i,plr in pairs(getElementsByType("player")) do if wanted[plr] then setPlayerWantedLevel(plr,wanted[plr].level) end end end setTimer(updateWanted,1000,0) function kill911(player) wanted[player] = nil end Made this simple code for you, so that the player gets a wanted level when he/she is in a stolen vehicle, or called on at 911, and they cannot get out of it.
  15. shaio

    Lock System

    addEventHandler("onVehicleStartEnter",root,function(player,seat) if (seat == 0) then for i,veh in pairs(personalCar) do if source == veh.v then if veh.locked == true then cancelEvent() outputChatBox("This vehicle is locked!",player,0,255,255) end end end end end) Actually this code won't work, I'm sorry.. It will check the vehicle yes, but not in the specific players table. I want it to check the players table for the players vehicle, and if the players vehicle is NOT the vehicle he is trying to enter, I don't want him to be able to. But this code, it loops through the entire table, which these values only exist in personalCar[player] not personalCar, since we are creating sub tables for each player. Meaning that even if there weren't sub tables, any car that is in the table would be locked. And the owner of the vehicle would not be able to access it after exiting. The purpose of this code is to simply allow the owner to control the vehicle without being inside of it, or near it. I made a simple modification, hopefully it will work, even though it seems like it's not even valid :l addEventHandler("onVehicleStartEnter",root,function(player,seat) if (seat == 0) then if personalCar[player] then for i,veh in pairs(personalCar[player]) do if source == veh.v then if veh.locked == true then cancelEvent() outputChatBox("This vehicle is locked!",player,0,255,255) end end end end end end)
  16. shaio

    Lock System

    if that the player that's trying to get in, doesn't have a vehicle, the script wont work.. oh damn now that's what I'm looking for.. That will work. Thank you so much m8!
  17. shaio

    Lock System

    addEventHandler("onVehicleStartEnter",root,function(player,seat) if seat == 0 then if personalCar[player] then -- Checks if the ^ player there has a vehicle inside of their table. if not source ~= personalCar[player].v then -- this wont run if the player ^ up there, doesn't have a vehicle. if personalCar[player].locked == true then cancelEvent() outputChatBox("This vehicle is locked!",player,0,255,255) end end end end end) I'm sorry, but that just wont work..
  18. shaio

    Lock System

    This wont work.. Because if the player who's trying to access the car doesn't have a car of their own in their table, then the rest of the script wont run.. addEventHandler("onVehicleStartEnter",root,function(player,seat) if seat == 0 then if personalCar[player] then -- Checks if the ^ player there has a vehicle inside of their table. if not source ~= personalCar[player].v then -- this wont run if the player ^ up there, doesn't have a vehicle. if personalCar[player].locked == true then cancelEvent() outputChatBox("This vehicle is locked!",player,0,255,255) end end end end end)
  19. shaio

    Lock System

    I do this under the lock/unlock portion of the script. If I do it under the onVehicleStart enter event it will be locked if the player that's trying to get in has a vehicle anyway.. So I cannot do that under the event. I could however check if personalCar, but that would be pointless.. root = getRootElement() personalCar = {} function lock(player,cmd) if personalCar[player] then if personalCar[player].locked == true then personalCar[player].locked = false outputChatBox("Your vehicle is now unlocked!",player,0,255,255) elseif personalCar[player].locked == false then personalCar[player].locked = true outputChatBox("Your vehicle is now locked!",player,0,255,255) end end end addCommandHandler("lock",lock) addEventHandler("onVehicleStartEnter",root,function(player,seat) if seat == 0 then if not source ~= personalCar[player].v then if personalCar[player].locked == true then cancelEvent() outputChatBox("This vehicle is locked!",player,0,255,255) end end end end)
  20. shaio

    Lock System

    Could someone help me with this?
  21. Also this would be simpler if you used slothbot.
  22. shaio

    Lock System

    I use elseif to check for exact values, say it = something else, that part of the function will still run. I don't want that happening. and the ~= didn't work. Same error. line 275: attempt to index field "?" (a nil value)
  23. shaio

    Lock System

    And I'm tackling my advanced lock system again.. I want to save tables to the player instead of the car, so that each time a player spawns a vehicle the player can remotely lock and unlock their vehicle, and possibly in the future kick specific players out of it remotely. So here is my code, and the only error seems to be on line 275, please help me fix this. root = getRootElement() personalCar = {} addEventHandler("onResourceStart",root,function() for _,plr in pairs(getElementsByType("player")) do bindKey(plr,"k","down","lock") end end) addEventHandler("onPlayerJoin",root,function() bindKey(source,"k","down","lock") end) function newCar(player,cmd,carName,value,value2) if isPedInVehicle(player) then local car = getPedOccupiedVehicle(player) destroyElement(car) end local x,y,z = getElementPosition(player) if tonumber(carName) then local vehicle = createVehicle(carName,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) else if carName == "super" then if value == "gt" then local vehicle = createVehicle(506,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "blista" then if value == "compact" then local vehicle = createVehicle(496,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "news" then if value == "chopper" then local vehicle = createVehicle(488,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value == "van" then local vehicle = createVehicle(582,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "police" then if value == "maverick" then local vehicle = createVehicle(497,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value == "ls" then local vehicle = createVehicle(596,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value == "sf" then local vehicle = createVehicle(597,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value == "lv" then local vehicle = createVehicle(598,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value == "ranger" then local vehicle = createVehicle(599,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "mountain" then if value == "bike" then local vehicle = createVehicle(510,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "utility" then if value == "van" then local vehicle = createVehicle(552,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "fbi" then if value == "rancher" then local vehicle = createVehicle(490,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value == "truck" then local vehicle = createVehicle(528,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "combine" then if value == "harvester" then local vehicle = createVehicle(532,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "black" then if value == "boxville" then local vehicle = createVehicle(609,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "mr" then if value == "whoopee" then local vehicle = createVehicle(423,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "hotring" then if value == "racer" then if value2 == "2" then local vehicle = createVehicle(502,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value2 == "3" then local vehicle = createVehicle(503,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif not value2 then local vehicle = createVehicle(494,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end end elseif carName == "monster" then if value == "2" then local vehicle = createVehicle(556,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value == "3" then local vehicle = createVehicle(557,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif not value then local vehicle = createVehicle(444,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "trailer" then if value == "2" then local vehicle = createVehicle(608,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value == "3" then local vehicle = createVehicle(435,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value == "4" then local vehicle = createVehicle(450,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value == "5" then local vehicle = createVehicle(591,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif not value then local vehicle = createVehicle(611,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "baggage" then if value == "trailer" then if value2 == "2" then local vehicle = createVehicle(607,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif not value2 then local vehicle = createVehicle(606,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end end elseif carName == "farm" then if value == "trailer" then local vehicle = createVehicle(610,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "petrol" then if value == "trailer" then local vehicle = createVehicle(584,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "rc" then if value == "bandit" then local vehicle = createVehicle(441,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value == "baron" then local vehicle = createVehicle(464,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value == "cam" then local vehicle = createVehicle(594,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value == "goblin" then local vehicle = createVehicle(501,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value == "raider" then local vehicle = createVehicle(495,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value == "tiger" then local vehicle = createVehicle(564,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif value == "van" then local vehicle = createVehicle(459,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "box" then if value == "freight" then local vehicle = createVehicle(590,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "brown" then if value == "streak" then if value2 == "carriage" then local vehicle = createVehicle(570,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) elseif not value2 then local vehicle = createVehicle(538,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end end elseif carName == "flat" then if value == "freight" then local vehicle = createVehicle(569,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "bloodring" then if value == "banger" then local vehicle = createVehicle(504,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end elseif carName == "bf" then if value == "injection" then local vehicle = createVehicle(424,x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end else local vehicle = createVehicle(getVehicleIDFromName(carName),x,y,z+1) warpPedIntoVehicle(player,vehicle) addVehicle(player,vehicle) end end end addCommandHandler("vi",newCar) function lock(player,cmd) if personalCar[player] then if personalCar[player].locked == true then personalCar[player].locked = false outputChatBox("Your vehicle is now unlocked!",player,0,255,255) elseif personalCar[player].locked == false then personalCar[player].locked = true outputChatBox("Your vehicle is now locked!",player,0,255,255) end end end addCommandHandler("lock",lock) addEventHandler("onVehicleStartEnter",root,function(player,seat) if seat == 0 then if not source == personalCar[player].v then if personalCar[player].locked == true then cancelEvent() outputChatBox("This vehicle is locked!",player,0,255,255) end end end end) function eject(player,cmd,other) if isPedInVehicle(player) then if getVehicleOccupant(getPedOccupiedVehicle(player),0) == player then if (getPlayerName(getPlayerFromName(other)) == (getPlayerName(player))) then outputChatBox("You cannot eject yourself!",player,255,0,0,true) else removePlayerFromVehicle(getPlayerFromName(other)) local x,y,z = getElementPosition(getPlayerFromName(other)) setElementPosition(getPlayerFromName(other),x+5,y,z) outputChatBox(getPlayerName(player).." has ejected you from the vehicle!",getPlayerFromName(other),0,255,255,true) local vehicle = getPedOccupiedVehicle(player) for _,plr in ipairs(getVehicleOccupants(vehicle)) do outputChatBox(getPlayerName(player).." has ejected "..getPlayerName(getPlayerFromName(other)),plr,0,255,255,true) end end else outputChatBox("You need to be the driver!",player,255,0,0) end end end addCommandHandler("eject",eject) function addVehicle(player,vehicle) if not personalCar[player] then personalCar[player] = {v = vehicle,locked = true} else personalCar[player] = {v = vehicle,locked = true} end end
  24. shaio

    Offedit2

    Offedit2 was made to allow flexibility of the offedit script. I made a collision toggle, and a scale function to the original script, and it was not able to save. I wasn't able to make it save. So I recreated the entire resource and called it offedit2. I originally asked Offroader23 (Owner of the original offedit) to help me fix the script, but he was unable to due to inexperience. If you look at his code closely he is just saving a single function as a string to a file. This new offedit saves multiple values in a table, and then the table saves to a .json file. I hope you enjoy. Link to offedit2
×
×
  • Create New...