Jump to content

diesel974

Members
  • Posts

    53
  • Joined

  • Last visited

Everything posted by diesel974

  1. I read it, but since i am learning how to make car mods, i dont understand a lot Can i have some more explanations plz?? Or if there is any tutorial to show how to do it then i will be very pleased to see it. Thank you.
  2. But lets say i want to make a new infernus, and i want it to have additional parts like spoiler,bumpers etc... but not attached to it by default. I want it to be same like the elegy, where you can add these additional parts via a modshop. So how can i do it??? Again, thank you!
  3. Hello! Oka, like wiki says : So my question is, we can only make 5 variants?? And lets say each variants are different to each other(spoiler,bumber,hood ....) can we add all the 5 variants to the vehicle or only 1 allowed?? Thank you for your replies!
  4. Thank you #Ivan7. Yes, maybe i will release more scripts later.
  5. Yes, Saml1er is right. I was just like you when i started to script 7 months ago. But i never quit. I read the tutorials again and again, and try to make simple scripts. Here are some links, open and read them : https://wiki.multitheftauto.com/wiki/In ... ng_the_GUI https://wiki.multitheftauto.com/wiki/Sc ... troduction And also, this forum has a tutorial section There are so many tutorials that can make you from newbie to pro scripter. All you got to do is to keep reading them and never abandon. And if you dont understand something and need helps, then you can come here and ask for it : viewforum.php?f=148
  6. Well, i modified the code and it works now. I tested it and it works great. When a vehicle is destroyed, if it doesnt have any owner, the vehicle is respawn in 5 seconds, but if it has an owner, it wont be respawn. To respawn it, only the owner can type /respawn for the vehicle to be respawned. Also, for you to use the /acarcreate command, bear in mind that you need to be admin to do that. Also the /acarpark works just fine. Heres the codes: severside: local cars={} local buycarpickup={} local maxcars = 0 local destroyedV = {} function spawnVehicles() local root = xmlLoadFile ("cars.xml") if not root then root = xmlCreateFile("cars.xml","root") local cars = xmlCreateChild(root,"car") xmlSaveFile(root) end local houseroot = xmlFindChild (root,"car",0) if (houseroot) then for i,v in ipairs (xmlNodeGetChildren(houseroot)) do local carmodel = xmlNodeGetAttribute (v,"model") local x = xmlNodeGetAttribute (v,"x") local y = xmlNodeGetAttribute (v,"y") local z = xmlNodeGetAttribute (v,"z") local color1 = xmlNodeGetAttribute (v,"color1") local color2 = xmlNodeGetAttribute (v,"color2") local owner = xmlNodeGetAttribute (v,"owner") local price = xmlNodeGetAttribute (v,"price") local lock = xmlNodeGetAttribute (v,"lock") local a = xmlNodeGetAttribute (v,"a") cars[i] = createVehicle ( tonumber(carmodel),tonumber(x),tonumber(y),tonumber(z), 0, 0, tonumber(a) ) setElementInterior ( cars[i], 0 ) setElementData (cars[i],"xpos",tonumber(x)) setElementData (cars[i],"ypos",tonumber(y)) setElementData (cars[i],"zpos",tonumber(z)) setElementData (cars[i],"angle",tonumber(a)) setElementData (cars[i],"owner",owner) setElementData (cars[i],"price",tonumber(price)) setElementData (cars[i],"lock",tonumber(lock)) setElementData (cars[i], "num", i ) setVehicleColor ( cars[i], tonumber(color1), tonumber(color2), 0, 0 ) if(lock == 1) then setVehicleLocked ( car, true ) end if getElementData ( cars[i], "owner" ) == "Nobody" then buycarpickup[i] = createPickup ( x, y, z, 3, 1274 ) attachElements ( buycarpickup[i], cars[i], 0, 0, 1.9 ) end maxcars = maxcars+1 end outputDebugString ("Cars loaded!") end end addEventHandler ( "onResourceStart", getResourceRootElement(),spawnVehicles) function respawnVehicle(thePlayer,command) local name = getPlayerName(thePlayer) if destroyedV[name] ~= nil then local model = destroyedV[name]["model"] local x = destroyedV[name]["x"] local y = destroyedV[name]["y"] local z = destroyedV[name]["z"] local a = destroyedV[name]["a"] local owner = destroyedV[name]["owner"] local price = destroyedV[name]["price"] local lock = destroyedV[name]["lock"] local num = destroyedV[name]["num"] local col1 = destroyedV[name]["col1"] local col2 = destroyedV[name]["col2"] local col3 = destroyedV[name]["col3"] local col4 = destroyedV[name]["model"] cars[num] = createVehicle ( tonumber(model),tonumber(x),tonumber(y),tonumber(z), 0, 0, tonumber(a) ) setElementInterior (cars[num], 0 ) setElementData (cars[num],"xpos",tonumber(x)) setElementData (cars[num],"ypos",tonumber(y)) setElementData (cars[num],"zpos",tonumber(z)) setElementData (cars[num],"angle",tonumber(a)) setElementData (cars[num],"owner",owner) setElementData (cars[num],"price",tonumber(price)) setElementData (cars[num],"lock",tonumber(lock)) setElementData (cars[num], "num",num) setVehicleColor (cars[num], tonumber(col1), tonumber(col2), tonumber(col3), tonumber(col4)) destroyedV[name] = nil end end addCommandHandler("respawn",respawnVehicle) function saveCars () --outputChatBox("okaa triggered !!") local root = xmlLoadFile ("cars.xml") local houseroot = xmlFindChild (root,"car",0) if (houseroot) then for i,v in ipairs (xmlNodeGetChildren(houseroot)) do local color1, color2, color3, color4 = getVehicleColor ( cars[i] ) xmlNodeSetAttribute ( v, "model", getElementModel(cars[i]) ) xmlNodeSetAttribute ( v, "x", getElementData(cars[i], "xpos") ) xmlNodeSetAttribute ( v, "y", getElementData(cars[i], "ypos") ) xmlNodeSetAttribute ( v, "z", getElementData(cars[i], "zpos") ) xmlNodeSetAttribute ( v, "a", getElementData(cars[i], "angle") ) xmlNodeSetAttribute ( v, "color1", color1 ) xmlNodeSetAttribute ( v, "color2", color2 ) xmlNodeSetAttribute ( v, "owner", getElementData(cars[i], "owner") ) xmlNodeSetAttribute ( v, "price", getElementData(cars[i], "price") ) xmlNodeSetAttribute ( v, "lock", getElementData(cars[i], "lock") ) end xmlSaveFile(root) end end function adminCreateVehicle ( source, cmd ) local accName = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup ( "user." .. accName, aclGetGroup ( "Admin" ) ) then local root = xmlLoadFile ("cars.xml") local houseroot = xmlFindChild (root,"car",0) local createdcar = xmlCreateChild ( houseroot, "vehicle" ) local carmodel = xmlNodeSetAttribute ( createdcar, "model", "451" ) local x, y, z = getElementPosition ( source ) local xa,ya,a = getElementRotation ( source ) xmlNodeSetAttribute ( createdcar, "x", x ) xmlNodeSetAttribute ( createdcar, "y", y ) xmlNodeSetAttribute ( createdcar, "z", z ) xmlNodeSetAttribute ( createdcar, "a", a ) xmlNodeSetAttribute ( createdcar, "color1", "0" ) xmlNodeSetAttribute ( createdcar, "color2", "0" ) xmlNodeSetAttribute ( createdcar, "owner", "Nobody" ) xmlNodeSetAttribute ( createdcar, "price", "0" ) xmlNodeSetAttribute ( createdcar, "lock", "0" ) cars[maxcars+1] = createVehicle ( 451,x,y,z,0,0,a ) buycarpickup[maxcars+1] = createPickup ( x, y, z, 3, 1274 ) attachElements ( buycarpickup[maxcars+1], cars[maxcars+1], 0, 0, 1.9 ) setElementData (cars[maxcars+1],"xpos",x) setElementData (cars[maxcars+1],"ypos",y) setElementData (cars[maxcars+1],"zpos",z) setElementData (cars[maxcars+1],"angle", a) setElementData (cars[maxcars+1],"owner","Nobody") setElementData (cars[maxcars+1],"price",0) setElementData (cars[maxcars+1],"lock",0) setElementData(cars[maxcars+1],"num",maxcars+1) xmlSaveFile(root) maxcars = maxcars+1 else outputChatBox ("Error: You can't use this command",source, 255,255,127 ) end end addCommandHandler ("acarcreate", adminCreateVehicle) addCommandHandler ("acarsave", saveCars) function getCar ( car ) return cars[car] end function enterVehicle ( source, seat, jacked ) local playercar = getPedOccupiedVehicle ( source ) if(seat == 0) then if (getElementData ( playercar, "owner" )) then if(getElementData ( playercar, "owner" ) ~= "Nobody" ) then if(getElementData ( playercar, "owner" ) == getPlayerName ( source )) then outputChatBox ("It is your car!",source, 255,255,127 ) else outputChatBox ("This vehicle owner: "..getElementData ( playercar, "owner" ).."",source, 255,255,127 ) end else local price = getElementData ( playercar, "price" ) triggerClientEvent ( source, "showBuyCar", source, price) toggleAllControls ( source, false, true, false ) return true end end end end addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) function AcceptToBuyCar ( ) local playercar = getPedOccupiedVehicle ( source ) if(getElementData ( playercar, "owner" ) == "Nobody") then if(getPlayerMoney ( source ) > tonumber(getElementData ( playercar, "price"))) then setElementData ( playercar, "owner", getPlayerName ( source )) takePlayerMoney ( source, tonumber(getElementData ( playercar, "price" ))) toggleAllControls ( source, true ) outputChatBox ("You buy this car!", source, 243,149,72 ) destroyElement(buycarpickup[getElementData(playercar,"num")]) saveCars () else outputChatBox ("Error: You don't have enought money", source, 243,149,72 ) setControlState ( source, "enter_exit", true ) end end end addEvent("acceptBuyCar",true) addEventHandler("acceptBuyCar",root,AcceptToBuyCar) function playerCarLock ( source, cmd) for i,v in ipairs (cars) do if(getElementData ( cars[i], "owner" ) == getPlayerName ( source )) then setVehicleLocked ( cars[i], true ) setElementData (cars[i],"lock", 1) outputChatBox ("You closed your car",source, 243,149,72 ) saveCars() end end end addCommandHandler ("lockmycar",playerCarLock) function playerCarUnLock ( source, cmd) for i,v in ipairs (cars) do if(getElementData ( cars[i], "owner" ) == getPlayerName ( source )) then setVehicleLocked ( cars[i], false ) setElementData (cars[i],"lock", 0) outputChatBox ("You opened your car",source, 243,149,72 ) saveCars() end end end addCommandHandler ("unlockmycar",playerCarUnLock) addEventHandler("onVehicleExplode",getRootElement(), function () local x = getElementData (source,"xpos") local y = getElementData (source,"ypos") local z = getElementData (source,"zpos") local a = getElementData (source,"angle") local owner = getElementData (source,"owner") local price = getElementData (source,"price") local lock = getElementData (source,"lock") local num = getElementData(source,"num") local model = getElementModel(source) local col1, col2, col3, col4 = getVehicleColor(source) destroyElement(source) destroyElement(buycarpickup[num]) if num then if owner == "Nobody" then setTimer(function() cars[num] = createVehicle ( tonumber(model),tonumber(x),tonumber(y),tonumber(z), 0, 0, tonumber(a) ) setElementInterior (cars[num], 0 ) setElementData (cars[num],"xpos",tonumber(x)) setElementData (cars[num],"ypos",tonumber(y)) setElementData (cars[num],"zpos",tonumber(z)) setElementData (cars[num],"angle",tonumber(a)) setElementData (cars[num],"owner",owner) setElementData (cars[num],"price",tonumber(price)) setElementData (cars[num],"lock",tonumber(lock)) setElementData (cars[num], "num",num) buycarpickup[num] = createPickup ( x, y, z, 3, 1274 ) attachElements ( buycarpickup[num], cars[num], 0, 0, 1.9 ) setVehicleColor (cars[num], tonumber(col1), tonumber(col2), tonumber(col3), tonumber(col4)) end,5000,1) else destroyedV[owner] = {x = x, y = y, z = z, a = a, owner = owner, price = price, lock = lock, num = num, model = model, col1 = col1, col2 = col2, col3 = col3, col4 = col4} end
  7. Oka, i had some free time and i read your codes. Apparently when a vehicle is destroyed, it is not respawned. Theres no function for that in this resource, so therefore i dont see why you want to create a function that when a vehicle is destroyed, it should not be respawned ! Unless its the contrary that you want. If you want that the vehicle is respawn, then yes, this will require a function to do that. And for your second question: 2.How can I make it so when I do /respawn it respawns the cars at the peoples houses who bought them. Here, you mean all the cars or a specific vehicle?? I asked this question because what you are asking here is something that can easily be done. All you need to do is firstly changed the masked or unnamed function that triggers when the resource is started to a name function. Serverside, line 5 to 44. Rewrite it like this : function spawnVehicles() local root = xmlLoadFile ("cars.xml") local houseroot = xmlFindChild (root,"cars",0) if (houseroot) then for i,v in ipairs (xmlNodeGetChildren(houseroot)) do local carmodel = xmlNodeGetAttribute (v,"model") local x = xmlNodeGetAttribute (v,"x") local y = xmlNodeGetAttribute (v,"y") local z = xmlNodeGetAttribute (v,"z") local color1 = xmlNodeGetAttribute (v,"color1") local color2 = xmlNodeGetAttribute (v,"color2") local owner = xmlNodeGetAttribute (v,"owner") local price = xmlNodeGetAttribute (v,"price") local lock = xmlNodeGetAttribute (v,"lock") local a = xmlNodeGetAttribute (v,"a") cars[i] = createVehicle ( tonumber(carmodel),tonumber(x),tonumber(y),tonumber(z), 0, 0, tonumber(a) ) setElementInterior ( cars[i], 0 ) setElementData (cars[i],"xpos",tonumber(x)) setElementData (cars[i],"ypos",tonumber(y)) setElementData (cars[i],"zpos",tonumber(z)) setElementData (cars[i],"angle",tonumber(a)) setElementData (cars[i],"owner",owner) setElementData (cars[i],"price",tonumber(price)) setElementData (cars[i],"lock",tonumber(lock)) setElementData (cars[i], "num", i ) setVehicleColor ( cars[i], tonumber(color1), tonumber(color2), 0, 0 ) if(lock == 1) then setVehicleLocked ( car, true ) end if getElementData ( cars[i], "owner" ) == "Nobody" then buycarpickup[i] = createPickup ( x, y, z, 3, 1274 ) attachElements ( buycarpickup[i], cars[i], 0, 0, 1.9 ) end maxcars = maxcars+1 end outputDebugString ("Cars loaded!") end end addEventHandler ( "onResourceStart", getResourceRootElement(),spawnVehicles) All i did was changing the masked function to a named function. Now, if you want to respawn all the vehicle when you type the command /respawn , all you will have to do is create a function that will call the spawnVehicle function.. and all this should happen when you type in the command. Here it is : function respawnVehicle(thePlayer,command) spawnVehicles() end addCommandHandler("respawn",respawnVehicle) When you type the /respawn command, it will trigger the respawnVehicle function, which in turn will call the spawnVehicles function to recreate all the vehicles. However, if im not wrong, there will be one issue. When you will type this command, the vehicles that were created when the resource had started will not be destroyed, and will be at the same place. This means when you will type the command /respawn, there will be more probably 2 vehicles with the same location coordinates, same owner, price ..... etc.. If you want to fix this, you will have to destroy all the vehicles that were created before by this resource so that there should not be 2 vehicles of the same data. This can easily be done by a loop. Also, if something is not working, type /debugscript 3 in the chat, and see if there are any errors that appears below on your screen. If yes, post them here. I hoped i helped you the way you wanted. And next time, dont be sad or angry if nobody is helping you, because time is something that most of us dont really have much. All you need is to wait. Have a nice day!
  8. Hello cody. no need to be sad or angry. If nobody is helping you is either because they dont have much time, or they dont know how to help u. Not all of us have a lot of free time I will try to help you, but i also dont really have much time. TO start, i saw your command and you are savin the data in xml file. So tell me, when you open the cars.xml file, do you see the data you wanted to save??
  9. Hello guys. Today, im here to give away all the scripts i made till now without any regrets or sadness. I made all these scripts for a server.. some months ago, but due to some problems the staff and i had.., i quit the server, and im here to give the resources away, so that anybody can use it. My only requests are make good use of them, and, to all staff, please be nice and kind to players. Stop ill-treating them Before i proceed with the scripts, i would like to take some times to thank some people who helped me a lot here. I had other accounts, but i always forgot the passwords of my email accounts Special thanks to xXMADEXx, who taught me some things when i did my first script Thanks to Citizen, who helped me very much in the french section. Thanks to Castillo or SolidSnake, you helped me like you always do with others. Oka, time for the resources now: 1)simple login panel 2)carsystem 3)otto shop 4)postman job 5)busdriver job 6) simple hospital script 7)Skin & clothes shop -- For the carsystem i made, i also used 50p modshop to save the modifications made to the vehicle, and heres the link to download the modshop: Btw, thank you 50p https://community.multitheftauto.com/in ... ls&id=9686 These are all the scripts i made till now. I also thanks the people who i did not mention here, and have ever helped me. Thank you. Found any bugs in it, contact me and i will try to fix it. YOU CAN EDIT THEM, AS LONG AS YOU DONT GIVE CREDITS TO YOURSELF Have fun guys. Be kind! Hare Rama Hare Krishna
  10. A small typo : all Peds are Players. Not all Peds are Players I believe it should have been : all Peds are Elements Thank you for the tutorial gentleman. Have a nice day!
  11. If im not wrong, you want to set the element data "zsaksz" with 0 as data to players who join your server?? If thats the case then use onPlayerLogin and then instead of using thePlayer, you can use source .
  12. diesel974

    Help Taxi

    Man I clearly showed you what to do. All you had to do was copy - paste, but you have not done that. i told you : But you wrote startJob() only Correct this plz!. Hmm, nvm, here is the script, i wrote some comments to explain you some things, read it : local pickups = { { -2514.2985839844, -19.26721572876, 25.6171875 }, { -2413.8093261719, 314.66299438477, 35.171875 }, { -1980.0808105469, 884.00354003906, 45.203125 }, { -1584.2047119141, 812.43743896484, 6.8203125 }, { -1817.1701660516, 1286.7491455078, 15.492509841919 }, { -2343.4348144531, 983.23840322031, 50.6953125 }, { -2554.942629531, 193.716659548, 6.2031769752502 } } local dropoffss = { { -2275.2744140625, 612.84197998047, 43.402828216553 }, { -2566.2153320313, 578.38897705078, 14.453125 }, { -2128.4689941406, 310.44934082031, 35.254566192627 }, { -1702.652941016, 717.54370117188, 24.890625 }, { -1912.1589355469, 883.3916015625, 35.215755462646 }, { -1977.3975830078, 1118.9444580078, 53.23331451416 }, { -1703.1501464844, 1340.6345214844, 7.1796875 } } local pedCus = { { 7 }, { 21 }, { 29 }, { 137 }, { 27 }, { 240 }, { 264 } } function SetVisiteFor (mark,player) setElementVisibleTo ( mark, root, false ) setElementVisibleTo ( mark, player, true ) end taxiVehs = { [420] = true } Cars = {} function teamSet ( ) if (isElement(Cars[source])) then destroyElement(Cars[source]) end setElementData(source,"markertax",4) setElementModel(source, 255) Cars[source] = createVehicle(420, -2485.3188476563, -169.93522644043, 25.6171875) addEventHandler ( "onVehicleExit", Cars[source], deleteOnExit ) addEventHandler ( "onVehicleEnter", Cars[source], inVEH ) addEventHandler ( "onVehicleStartEnter", Cars[source], enterVehicle ) warpPedIntoVehicle ( source, Cars[source] ) -- source is the current player who is actually running the script(or the job) startJob(source) -- here, we add source as argument so as to give the function startJob the current player as argument outputChatBox("You are now employed as a Taxi Driver!", source) end addEvent ( "sTeame", true) addEventHandler ( "sTeame", root, teamSet ) addEventHandler('onPlayerQuit', root, function() if isElement( Cars[source] ) then destroyElement(Cars[source] ) end end ) function enterVehicle ( seat, jacked ) if getElementData(source,"JobNew") ~= 4 then removePedFromVehicle( source ) outputChatBox("Only Taxi Drivers can drive this vehicle!", source) end end markers = { } blips = { } peds = { } mposi = { } mposii = {} function startJob (source ) -- the argument we had given to startJob above ( source) is going to be used here local x, y, z = unpack ( pickups [ math.random ( #pickups ) ] ) markers [ source ] = createMarker ( x, y, z, "cylinder", 5.0, 255, 0, 0, 0 ) SetVisiteFor (markers [ source ],source) -- wat is this function, SetVisiteFor, never heard that mposi = { getElementPosition( markers [ source ] ) } local skins = unpack ( pedCus [ math.random ( #pedCus ) ] ) peds [ source ] = createPed( skins, x, y, z ) SetVisiteFor (peds [ source ],source) blips [ source ] = createBlipAttachedTo ( markers [ source ], 58 ) SetVisiteFor (blips [ source ],source) addEventHandler ( "onMarkerHit", markers [ source ], warpit ) end function inVEH () if isPedInVehicle ( source ) and getElementData(source,"JobNew") == 4 then startJob () end end function warpit (hitElement,matchingDimension ) --[[ please, take some times, go to mta wiki, and read about function and events. like you wrote above, "onMarkerHit" is an event which means when something hits a marker. So, when this event is triggered, it passes 2 parameters(or arguments) to the function that it calls ( warpit, in your case). The 2 parameters are hitElement, which means the element that has hit the marker, and matchingDimension, which is not that much important for now.]] if isPedInVehicle ( hitElement ) then -- use hitElement instead of source. Source is the marker that you just hit. local vehiclee = getPedOccupiedVehicle ( hitElement ) if ( getElementModel ( vehiclee ) == 420 ) then bindKey(hitElement,"H","down",warpit2) -- pass the argument hitElement to the function warpit2 end end end function warpit2 (hitElement) warpPedIntoVehicle(peds [ hitElement ], getPedOccupiedVehicle ( hitElement ), 2 ) local x, y, z = unpack ( dropoffss [ math.random ( #dropoffss ) ] ) markers [ hitElement ] = createMarker ( x, y, z - 1, "cylinder", 5.0, 195, 197, 9, 255 ) SetVisiteFor (markers [ hitElement ],hitElement) -- i still dont know wat is this function.... correct this plz mposii = { getElementPosition( markers [ hitElement ] ) } blips [ hitElement ] = createBlipAttachedTo ( markers [ hitElement ], 41 ) SetVisiteFor (blips [ hitElement ],hitElement) addEventHandler ( "onMarkerHit", markers [ hitElement ], pickmeup ) unbindKey(hitElement,"H","down",warpit2) end function pickmeup (hitElement,matchingDimension) -- again, write the parameters, i will give you some links below, check them to learn more info if isPedInVehicle ( hitElement ) then destroyJob () local mx, my, mz = unpack ( mposi ) local mmx, mmy, mmz = unpack ( mposii ) local money = getDistanceBetweenPoints2D ( mx, my, mmx, mmy ) finalmoney = math.floor ( money ) if finalmoney then setTimer( function (hitElement) finalmoney = finalmoney + 1000 setElementData(hitElement,"Money", (getElementData(hitElement,"Money" or 0 ) ) ) outputChatBox( "You have earned "..finalmoney.."!",hitElement,0, 144, 0) setElementData(hitElement,"Money", getElementData(hitElement,"Money" or 0 ) ) end, 3000, 1, hitElement ) setTimer ( function (hitElement) if ( isElement ( peds [ hitElement ] ) ) then destroyElement ( peds [ hitElement ] ) end startJob (hitElement) end ,3000, 1, hitElement ) end end end function deleteOnExit ( ) if ( isElement ( markers [ source ] ) ) then destroyElement ( markers [ source ] ) end if ( isElement ( blips [ source ] ) ) then destroyElement ( blips [ source ] ) end if ( isElement ( peds [ source ] ) ) then destroyElement ( peds [ source ] ) end end function destroyJob () if ( isElement ( markers [ source ] ) ) then destroyElement ( markers [ source ] ) end if ( isElement ( blips [ source ] ) ) then destroyElement( blips [ source ] ) end end It still contains some mistakes like the unknown function that you wrote SetVisiteFor.. correct this and maybe i miss a mistake too. Also, you need to know what and how events are used. Go to this page : https://wiki.multitheftauto.com/wiki/Event If you want to learn to script better, spend more time at wiki rather than opening resources and editing them. Learn the basics first ( functions, events...) Regards
  13. diesel974

    Help Taxi

    Hey Well, you triggered the server and skin is set, and you are warped into the vehicle, good. But what should happen next!!??? O_o i guess the job should start now, isnt it?? And the function which actually start the job is startJob(thePlayer)... so just write this : startJob(source) -- yes, here you write source instead of thePlayer, because thePlayer is undefined here below line 55 or 56
  14. Woooohoooo one of my favorite old songs. I like the parady, good job!
  15. Hey, i found it, like i told you before, the serverside had some errors, thats y it was not working. Truth is you missed some end and i fixed it for you. i have put some comments to show you where you missed the ends. check it : function trololo() setElementData(source,"Nitro",0) setElementData(source,"Fix",0) setElementData(source,"Colour",0) end addEventHandler("onResourceStart",resourceRoot, function() -- its here that the whole error is found, you had missed 3 ends LOL local players = getElementsByType ( "player" ) for i,p in ipairs(players) do setElementData(p,"NitroT",false) setElementData(p,"FixT",false) setElementData(p,"ColourT",false) local sourceAccount = getPlayerAccount ( p ) if isGuestAccount ( sourceAccount ) then setElementData(p,"Nitro",0) setElementData(p,"Fix",0) setElementData(p,"Colour",0) else if (getAccountData(sourceAccount, "Nitro")) then setElementData(p,"Nitro",getAccountData(sourceAccount, "Nitro")) end if (getAccountData(sourceAccount, "Fix")) then setElementData(p,"Fix",getAccountData(sourceAccount, "Fix")) end if (getAccountData(sourceAccount, "Colour")) then setElementData(p,"Colour",getAccountData(sourceAccount, "Colour")) end if not (getAccountData(sourceAccount, "Nitro")) and not (getAccountData(sourceAccount, "Fix")) and not (getAccountData(sourceAccount, "Colour")) then setElementData(p,"Nitro",0) setElementData(p,"Fix",0) setElementData(p,"Colour",0) end end -- first end end -- second end end-- third end ) addEventHandler("onPlayerLogout",getRootElement(), function (acc) setAccountData(acc,"Nitro",getElementData(source,"Nitro")) setAccountData(acc,"Fix",getElementData(source,"Fix")) setAccountData(acc,"Colour",getElementData(source,"Colour")) setElementData(source,"Nitro",0) setElementData(source,"Fix",0) setElementData(source,"Colour",0) end ) -- this part is good addEventHandler("onPlayerLogin", root, function ( _, theCurrentAccount) if (getAccountData(theCurrentAccount, "Nitro")) then setElementData(source,"Nitro",getAccountData(theCurrentAccount, "Nitro")) end if (getAccountData(theCurrentAccount, "Fix")) then setElementData(source,"Fix",getAccountData(theCurrentAccount, "Fix")) end if (getAccountData(theCurrentAccount, "Colour")) then setElementData(source,"Colour",getAccountData(theCurrentAccount, "Colour")) end end ) -- this part also is good addEvent("giveboomnitro",true) addEventHandler("giveboomnitro",getRootElement(), function (number) -- lets say number for example outputChatBox(" trololooooo giveNitro was triggered",client) if (tonumber(number) > 0) then if ( getPlayerMoney (client) >= 100 ) then takePlayerMoney(client, 100) local acc = getPlayerAccount ( client ) setElementData(client,"Nitro",getElementData(client,"Nitro")+number) setAccountData(acc,"Nitro",getElementData(client,"Nitro")) else outputChatBox("You do not have enough money to buy Nitro",client,255,0,0,false) end end end ) -- this part also is good Now try it and if any other errors in debug..post it
  16. Oka, since your meta is good, it means your serverside script has errors in it, im gonna to check that. Just dont give up!!!
  17. Im sorry, but i dont know what to do now, i dont know whats the real problem sorry i could not help you.
  18. Check if your meta is good too, cause now, i really dont know what is going wrong I tried my maximum to help you
  19. oka, now use the same code im going to give you. clientside : local marker = createMarker( 1220.8000488281, -1427.3000488281, 12.39999961853, "cylinder", 1.5, 0, 0, 0, 0) ----local ped = createPed(305,1220.8000488281, -1427.5999755859, 13.39999961853) createBlip (2000.763671875, 1539.0169677734, 13.5859375, 23 ,2 ) myFont = dxCreateFont( "BEBAS.ttf", 20 ) -- Create custom font GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_gridlist = {} windowjob = guiCreateWindow(392, 176, 408, 437, "Parts", false) guiWindowSetSizable(windowjob, false) guiSetVisible(windowjob, false) GUIEditor_Memo[1] = guiCreateMemo(25, 27, 367, 108, "This is the Vehicle Upgrades store, you can buy these objects to apply to your vehicle of any sort", false, windowjob) guiMemoSetReadOnly(GUIEditor_Memo[1], true) GUIEditor_gridlist[1] = guiCreateGridList(21, 258, 366, 111, false, windowjob) guiGridListAddColumn(GUIEditor_gridlist[1], "Upgrades", 0.5) guiGridListAddColumn(GUIEditor_gridlist[1], "Price", 0.5) for i = 1, 3 do guiGridListAddRow(GUIEditor_gridlist[1]) end guiGridListSetItemText(GUIEditor_gridlist[1], 0, 1, "Colour", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 0, 2, "$100", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 1, 1, "Nitro", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 1, 2, "$1000", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 2, 1, "Repair", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 2, 2, "$250", false, false) GUIEditor_Button[2] = guiCreateButton(206, 379, 174, 48, "Cancel", false, windowjob) GUIEditor_Button[1] = guiCreateButton(21, 379, 175, 48, "Buy!", false, windowjob) function GuiOpen(hitElement) setElementData ( localPlayer, "ownskin", getElementModel (localPlayer) ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, GuiOpen) function GuiClose(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, GuiClose) function removeUpWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeUpWindow, false) function removeUpWindow() guiSetVisible(windowjob, false) showCursor(false) outputChatBox("ok, here is ok too") triggerServerEvent ( "giveboomnitro", getLocalPlayer(), guiGetText( GUIEditor_gridlist[1], 1, 1)) outputChatBox("same here too") end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeUpWindow, false) local maxDistance = 12 -- the distance showing 3dtext local ped = createPed (305,1220.8000488281, -1427.5999755859, 13.39999961853) addEventHandler ( "onClientRender", root, function ( ) local pX, pY, pZ = getElementPosition ( localPlayer ) local pedX, pedY, pedZ = getElementPosition ( ped ) local distance = getDistanceBetweenPoints3D ( pX, pY, pZ, pedX, pedY, pedZ ) if ( distance <= 15 ) then local x, y = getScreenFromWorldPosition ( pedX, pedY, pedZ ) if ( x and y ) then dxDrawText( "Upgrades", x, y+1.5, _, _, tocolor( 255, 255, 0, 255 ), 1, myFont, "center", "center" ) end end end ) serverside : function trololo() setElementData(source,"Nitro",0) setElementData(source,"Fix",0) setElementData(source,"Colour",0) end addEventHandler("onResourceStart",resourceRoot, function() local players = getElementsByType ( "player" ) for i,p in ipairs(players) do setElementData(p,"NitroT",false) setElementData(p,"FixT",false) setElementData(p,"ColourT",false) local sourceAccount = getPlayerAccount ( p ) if isGuestAccount ( sourceAccount ) then setElementData(p,"Nitro",0) setElementData(p,"Fix",0) setElementData(p,"Colour",0) else if (getAccountData(sourceAccount, "Nitro")) then setElementData(p,"Nitro",getAccountData(sourceAccount, "Nitro")) end if (getAccountData(sourceAccount, "Fix")) then setElementData(p,"Fix",getAccountData(sourceAccount, "Fix")) end if (getAccountData(sourceAccount, "Colour")) then setElementData(p,"Colour",getAccountData(sourceAccount, "Colour")) end if not (getAccountData(sourceAccount, "Nitro")) and not (getAccountData(sourceAccount, "Fix")) and not (getAccountData(sourceAccount, "Colour")) then setElementData(p,"Nitro",0) setElementData(p,"Fix",0) setElementData(p,"Colour",0) end ) addEventHandler("onPlayerLogout",getRootElement(), function (acc) setAccountData(acc,"Nitro",getElementData(source,"Nitro")) setAccountData(acc,"Fix",getElementData(source,"Fix")) setAccountData(acc,"Colour",getElementData(source,"Colour")) setElementData(source,"Nitro",0) setElementData(source,"Fix",0) setElementData(source,"Colour",0) end ) addEventHandler("onPlayerLogin", root, function ( _, theCurrentAccount) if (getAccountData(theCurrentAccount, "Nitro")) then setElementData(source,"Nitro",getAccountData(theCurrentAccount, "Nitro")) end if (getAccountData(theCurrentAccount, "Fix")) then setElementData(source,"Fix",getAccountData(theCurrentAccount, "Fix")) end if (getAccountData(theCurrentAccount, "Colour")) then setElementData(source,"Colour",getAccountData(theCurrentAccount, "Colour")) end end ) addEvent("giveboomnitro",true) addEventHandler("giveboomnitro",getRootElement(), function (number) -- lets say number for example outputChatBox(" trololooooo giveNitro was triggered",client) if (tonumber(number) > 0) then if ( getPlayerMoney (client) >= 100 ) then takePlayerMoney(client, 100) local acc = getPlayerAccount ( client ) setElementData(client,"Nitro",getElementData(client,"Nitro")+number) setAccountData(acc,"Nitro",getElementData(client,"Nitro")) else outputChatBox("You do not have enough money to buy Nitro",client,255,0,0,false) end end end ) -------addEvent("givenitro",true) --addEventHandler("givenitro",root, --function (money,100) --if (tonumber(number) > 0) then --if ( getPlayerMoney (source) >= 100 ) then ---takePlayerMoney(source, 100) --local acc = getPlayerAccount ( source ) ---setElementData(source,"Nitro",getElementData(source,"Nito")+number) --setAccountData(acc,"Nitro",getElementData(source,"Nitro")) --else ---outputChatBox("You do not have enough money to buy Nitro",source,255,0,0,false) ---end --end ---end copy the whole code, dont do any changes in them. try it now, and plz, when you are going to post again here, put the errors in debugscript too, maybe im missing an error here
  20. Tell me something, when you used the code that i gave you, did you see this line in your chat : trololooooo giveNitro was triggered. ??????
  21. man, i did not change Cylinder to cylinder only!!! try to compare your serverside script with the one i have given u above
×
×
  • Create New...