Jump to content

diesel974

Members
  • Posts

    53
  • Joined

  • Last visited

Everything posted by diesel974

  1. man (( you forgot totally wat i told u since the beginning ok, np here it is : 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) triggerServerEvent ( "giveNitro", getLocalPlayer(), guiGetText( GUIEditor_gridlist[1], 1, 1)) 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 ) 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("giveNitro",true) addEventHandler("giveNitro",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
  2. post the full script plz, both client and server side
  3. nah LOL, i mean in the client side, change the localPlayer to getLocalPlayer() in the triggerServerEvent
  4. Try to see if there are any other errors in debugscript plz, maybe i did not see any other error
  5. aww ok line 64 client side triggerServerEvent ( "giveNitro", localPlayer, guiGetText( GUIEditor_gridlist[1], 1, 1)) try to use getLocalPlayer() instead of localPlayer. Also server side, when u use addEvent("giveNitro",true) addEventHandler("giveNitro",root, function (number) -- lets say number for example 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 ) try to add outputChatBox("this is alright",client) between line 3 and 4. If you see this in chat( this is alright) , you know that its working
  6. And also, as far as i know, 100 is always greater than 0, isnt it ( server script, line 64) client side now, line 64 (again 64 wat a coincidence xxD) triggerServerEvent ( "giveNitro", localPlayer, guiGetText( GUIEditor_gridlist[1], 1, 1)) You are triggering the server and sending guiGetText(GUIEditor_gridlist[1], 1, 1)) as argument, still good, but in your serverside, addEvent("giveNitro",true) addEventHandler("giveNitro",root, function () if (tonumber(100) > 0) then if ( getPlayerMoney (source) >= 100 ) then takePlayerMoney(source, 100) local acc = getPlayerAccount ( source ) setElementData(source,"Nitro",getElementData(source,"Nitro")+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 ) in line 3 here, you are not puttin the argument within brackets O_o and it should be like this : addEvent("giveNitro",true) addEventHandler("giveNitro",root, function (number) -- lets say number for example for the argument if (tonumber(100) > 0) then if ( getPlayerMoney (source) >= 100 ) then takePlayerMoney(source, 100) local acc = getPlayerAccount ( source ) setElementData(source,"Nitro",getElementData(source,"Nitro")+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 ) Now, when i looked below your serverside, i saw line 76 to 89 and actually there is an important part in it, you had put the argument within brackets, but i dont know why you have added 100 too. Also, in your serverside script, line 68 you wrote setElementData(source,"Nitro",getElementData(source,"Nitro")+number) but number is not defined so maybe this can also be the error. Now, try to do this: addEvent("giveNitro",true) addEventHandler("giveNitro",root, function (number) -- lets say number for example 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 ) I tried to help you as much as i can, but a little advice, when you are testing try to use functions which outputs messages like outputChatBox or outputDebugString or outputServerLog for debugging, add as much as you can to see till where the codes is functionning. (again, sorry for my bad english )
  7. Im not sure if its really an error but anyway, you wrote "Cylinder" instead of "cylinder" in client script, line 1. In your debugscript, [2014-06-18 12:21:37] SCRIPT ERROR: mechupgrades\s.lua:1: '' expected near '(' = its sayin that you have not given a name to the function ( O_o or you have not name the function)( bad english, sorry ) so for example. you can write : function settingElementData () setElementData(source,"Nitro",0) setElementData(source,"Fix",0) setElementData(source,"Colour",0) end
  8. diesel974

    ServerSided

    Also, you can pm me whenever you want or add me on skype Darkwarrior.diesel
  9. diesel974

    ServerSided

    My friend, its been nearly 7 months since i started to script, and i know im not a pro, and you know what, i still make some mistakes. We all do mistakes, but we should not give up. In these 7 months, i read the gui tutorials many times, i can say i read it more than 10 times, just to master the basics. When i read them and understand them fully, i learned what events do and what parameters you should use. Now, i almost know all the basics. So bro, plz read the tutorials again. The link that i gave you, it has the triggerServerEvent in it, if you read it, you will know when to use it and how. Peace bro just dont give up!!!
  10. diesel974

    ServerSided

    What you are doing is wrong bro You cant add triggerServerEvent where you are creating the gui, it does not make any sense. This should be added only when the player has clicked on the accept job button
  11. diesel974

    ServerSided

    Of course it wont work because thePlayer is not defined. All i wanted to show you is where the triggerServerEvent should be. What you should add is triggerServerEvent( "sTeame" , getLocalPlayer() )
  12. diesel974

    ServerSided

    Ivan, your problem is not because of the team format, but because you dont know when to use the triggerServerEvent function. oka, i will explain, when you create the gui with the accept the job and reject the job buttons, you first want that when the player clicks on the reject button, the gui should dissapear, and everythin gets back to normal, but when the player clicks on the accept button, then only should the job start( so, that the part where you should use the triggerServerEvent so as to trigger the server to start the job) Ivan, please take my advice into consideration, make the script simple first.
  13. diesel974

    ServerSided

    First remove the line 51(joinTeam() since you are not really using that function). Secondly, no, the line 16 ( triggerServerEvent( "sTeame", thePlayer, "joinTeam" )) should be between 50 and 51 Ivan, it would be better if you first check out the tutorials found in wiki : https://wiki.multitheftauto.com/wiki/In ... ng_the_GUI You will learn how and when to use the triggerServerEvent function too at this page. Also, like i told you before, its better to make your scripts as simple as you can so that you can know if there are mistakes in it, and if the script is good and workin perfectly, then you can try to make it more complex.
  14. diesel974

    ServerSided

    between line 136 and 137 : setElementData(thePlayer,"Money", (getElementData(thePlayer,"Money") or 0 ) + ) end, 3000, 1 ) Remove the + in (getElementData(thePlayer,"Money") or 0) + ) And also, the problem is your clientside is not triggering server. There's no triggerServerEvent in the client side script , so i assume that its probably in the joinTeam() function!!!
  15. diesel974

    ServerSided

    client side, line 52, you wrote joinTeam() which infact is a function, so where is that function in the script?? ._.
  16. diesel974

    ServerSided

    Before that, is there any errors in debugscript???
  17. diesel974

    TaxiHelp

    Can u plz post the whole script in the Lua tag so that i can see which line 36 is debugscript referring??
  18. Thank you for your precious time you devoted to this tutorial bro, God bless
  19. diesel974

    TaxiHelp

    Plz use the Lua tag to make code reading easier . Also, indent your codes.. oka, lets get to the real deal : addEventHandler ( 'onClientRender', root, function ( ) -- local x, y, z = getCameraMatrix(); local x1, y1, z1 = getElementPosition ( markertaxi ); local distance_1 = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ); -- -- Marker #1 if distance_1 <= gMaxDistance then local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ); if x1_ and y1_ then -- local scale = 1 / ( gScale * ( distance_1 / gMaxDistance ) ); local alpha = ( ( distance_1 - gAlphaDistance ) / gAlphaDiff ); alpha = ( alpha < 0 ) and gTextAlpha or gTextAlpha - ( alpha * gTextAlpha ); scale = math.evalCurve( gMaxScaleCurve, scale ); end local textscale = math.evalCurve( gTextScaleCurve, scale ); local textalpha = math.evalCurve( gTextAlphaCurve, alpha ); end -- dxDrawText( "Taxi Job", x1_, y1_, x1_, y1_, tocolor ( 255, 255, 255, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); end ) oka,like debugscript said, : attempt to perform arithmetic on global "textscale" (a nil value), means that textscale is nil here, it does not hold any value. So, look at your codes. your problem is on the line 19, you defined textscale...oka, but then, when you are about to use it on the line 22, textscale is already out of scope, mean, in the block you had defined it (from line 10 to 21), at the end of line 21, the local variable textscale becomes nil bekoz it is local and its out of scope since its block has already ended. So, the solution would be to transfer the line 22 below the line 20
  20. firstly this is wrong : you are trying to call the function getElementSpeed with the parameters : player and seat that the event onClientVehicleEnter gives to the function (sorry for my bad english). Therefore, erase this line. Secondly; same mistake here too heres a tip of how you should do it : function speed(player, seat) local vspeed = getElementSpeed(source,"mph") if vspeed then .... -- now you continue with the function end addEventHandler("onClientVehicleEnter",getRootElement(),speed)
  21. diesel974

    TaxiHelp

    Sorry, but i never used dxDrawText ;/ i always tried to keep my scripts as simple as i can
  22. diesel974

    TaxiHelp

    i had made a taxi job but mostly server side, so as to protect my codes from being copied or stolen. Also, its a good practice to make ur scripts mostly server side so that the clients( i mean the other players) dont have too much to download. Heres a simple plan of how i made the script : i made the marker, so that when the player enters it, a gui will appear to him so that he can choose to take the job or not. (server side) i made the guis when the player press the accept job button, gui disappear and trigger server to give the job to the player. create a table for the locations of the markers and the peds start the job give the taxi to the player create marker1 and ped when player hits marker1, warp the ped into the taxi destroy marker1, and create marker2 when player hits marker2, remove the ped from the taxi and give the player his money now, this can be elaborated more, and if you are doing the job serverside, you gonna use setElementData and getElementData to avoid collisions.... read more about that a wiki
  23. You cant make the peds visible to the taxi drivers only simply because, like wiki says : There are some elements that you can make visible to the taxi driver only, like markers and blips for example, but not vehicles, players, objects and peds. For more info, check this page : https://wiki.multitheftauto.com/wiki/SetElementVisibleTo
  24. getElementPosition createObject There's an example in wiki, just go to this link : https://wiki.multitheftauto.com/wiki/CreateObject The example 2.
×
×
  • Create New...