Jump to content

DakiLLa

Members
  • Posts

    965
  • Joined

  • Last visited

Everything posted by DakiLLa

  1. DakiLLa

    GUI question

    ok, it works, but i have another problem. (dont want to create a new topic and i ask here) With last scripts on this page i want to create a truck driver mission. When i hits object - opens the Gui and when you press button "Yes", starts the mission. I have used van - spawn from ctv but when i starts the script i see 2 warnings: Warning: SServer.lua: Bad argument @ 'addEventHandler' - Line 12 Warning: SServer.lua: Bad argument @ 'addEventHandler' - Line 64 and when i hits the marker nothing occursed. server-side local TruckCol = createColTube ( -77.1681, -1136.4044, 1.0781, 2, 2 ) function HitColShape ( thePlayer, matchingDimension ) if (getElementType(thePlayer) == "player") then triggerClientEvent ( thePlayer, "ColHit", getRootElement () ) end end addEventHandler ( "onColShapeHit", TruckCol, HitColShape ) addEvent ( "SPECIAL_EVENT" ) addEventHandler ( "SPECIAL_EVENT", getRootElement (), TruckMission ) function TruckMission ( target ) local x = getElementData ( target, "posX" ) local y = getElementData ( target, "posY" ) local z = getElementData ( target, "posZ" ) local rx = getElementData ( target, "rotX" ) local ry = getElementData ( target, "rotY" ) local rz = getElementData ( target, "rotZ" ) local model = getElementData ( target, "model" ) --id local platetext = getElementData ( target, "plate" ) --plate text local colours = getElementData ( target, "colors" ) --colours of vehicle local pj = getElementData ( target, "paintjob" ) --paintjob local upgrades = getElementData ( target, "upgrades" ) --paintjob ---seperate the colours string and get specific colour ids local col1 = gettok ( colours, 1, 44 ) local col2 = gettok ( colours, 2, 44 ) local col3 = gettok ( colours, 3, 44 ) local col4 = gettok ( colours, 4, 44 ) --if any of them are "ran", then make them into a random id if col1 == "ran" or col1 == false then col1 = randInt(0,15) end if col2 == "ran" or col1 == false then col2 = randInt(0,15) end if col3 == "ran" or col1 == false then col3 = randInt(0,15) end if col4 == "ran" or col1 == false then col4 = randInt(0,15) end --if any of the rotations are not specified, make them 0 if rx == false then rx = 0 end if ry == false then ry = 0 end if rz == false then rz = 0 end --finally, create the vehicle and define it as van if ( platetext ) then van = createVehicle ( model, x, y, z, rx, ry, rz, platetext ) else van = createVehicle ( model, x, y, z, rx, ry, rz ) end --if a paintjob was specified, add it if ( pj ) then setVehiclePaintjob ( van, pj ) end --if there were any mods if ( upgrades ) then --split the upgrades into a table allUpgrades = split ( upgrades, 44 ) for k,v in ipairs(allUpgrades) do --loop through the table addVehicleUpgrade ( van, v ) --and add each upgrade end end vanMarker = createMarker ( x, y, z, "checkpoint", 1.5, 255, 255, 255, 255 ) attachElementToElement ( vanMarker, van ) createBlipAttachedTo ( van, 55 ) end addEventHandler ( "onVehicleExplode", getRootElement (), vehicleExplode ) function vehicleExplode () if source == van then outputChatBox ( "You have destroyed the cargo! Go out!", source, 255, 0, 0 ) endRound() end end function endRound () destroyBlipsAttachedTo ( van ) destroyElement ( van ) destroyElement ( vanMarker ) end client script wtih gui in my previous post. can you help ?
  2. DakiLLa

    GUI question

    and now next question i need to make a marker and when anybody hits it, opens a Gui window with buttons for player. I cant understand how to use the triggerEvent can you tell and correct my mistakes in my script and then i will use this like the sample. Client addEvent ( "ColHit", true ) addEventHandler ( "ColHit", getRootElement (), function TRUCK_GUI () TruckWindow = guiCreateWindow(378,251,287,114,"Job: Truck Driver",false) TruckButtonYes = guiCreateButton(0.2265,0.693,0.2334,0.2281,"Yes!",true,TruckWindow) TruckButtonNo = guiCreateButton(0.5331,0.693,0.2369,0.2281,"No!",true,TruckWindow) TruckLabel = guiCreateLabel(0.2056,0.2018,0.6655,0.2895,"Want to deliver some cargo ?",true,TruckWindow) guiLabelSetVerticalAlign(TruckLabel,"top") guiLabelSetHorizontalAlign(TruckLabel,"left",false) showCursor ( true ) end ) addEventHandler ( "onClientGUIClick", getResourceRootElement (getThisResource ()), function () if (source == TruckButtonYes) then triggerEvent ( "SPECIAL_EVENT", getRootElement () ) elseif (source == TruckButtonNo) then guiSetVisible (TruckWindow, false) showCursor (false) end end ) Server local TruckCol = createColTube ( -77.1681, -1136.4044, 1.0781, 2, 2 ) function HitColShape ( thePlayer, matchingDimension ) if (getElementType(thePlayer) == "player") then triggerEvent ( thePlayer, "ColHit", getRootElement () ) end end addEventHandler ( "onColShapeHit", TruckCol, HitColShape ) addEvent ( "SPECIAL_EVENT", true ) function TruckMission ( ) ..... thank's
  3. DakiLLa

    GUI question

    next question. why i cannot see my window when i join ? addEventHandler ( "onClientPlayerJoin", getLocalPlayer (), function () NWindow = guiCreateWindow(328,201,432,351,"SERVER NEWS",false) NButton = guiCreateButton(0.3472,0.8746,0.3009,0.0997,"OK",true,NWindow) showCursor (true) end ) addEventHandler ( "onClientGUIClick", getResourceRootElement (getThisResource ()), function () if (source == NButton) then guiSetVisible ( NWindow, false ) showCursor (false) end end ) thank's.
  4. DakiLLa

    GUI question

    i have made a small gui window with buttons. How to make that key "F2" will be shutdowns the window ? in my version it only create window. function initGui ( key, keyState) if ( keyState == "down" ) then MAIN_WINDOW = guiCreateWindow(833,452,183,284,"Teleport",false) Liberty = guiCreateButton(0.0656,0.0739,0.8852,0.0845,"Liberty City",true,MAIN_WINDOW) KickStart = guiCreateButton(0.0656,0.1866,0.8852,0.0845,"KickStart Stunt Track",true,MAIN_WINDOW) Exit = guiCreateButton(0.6557,0.8838,0.2951,0.0845,"Exit",true,MAIN_WINDOW) NormalWorld = guiCreateButton(0.0765,0.8873,0.4863,0.081,"Normal World",true,MAIN_WINDOW) showCursor ( true ) end end addEventHandler ( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), initGui ) addEventHandler ( "onClientGUIClick", getResourceRootElement (getThisResource ()), function () if (source == Liberty) then setElementInterior ( getLocalPlayer (), 1, -750.80, 491.00, 1371.70 ) elseif (source == KickStart) then setElementInterior ( getLocalPlayer (), 14, -1464.5360, 1557.6900, 1052.5310 ) elseif (source == NormalWorld) then setElementInterior ( getLocalPlayer (), 0, 0, 0, 2.5 ) elseif (source == Exit ) then guiSetVisible (MAIN_WINDOW, false) showCursor (false) end end ) function bind ( source ) bindKey ("F2", "down", initGui ) end addEventHandler ( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), bind ) thank's
  5. this error arise when you refreshing server. When shutdown and start - it's all ok.
  6. wow, it's really great, thanks guys, but if i want to use effect like this: https://www.youtube.com/watch?v=QyhZtajA ... re=related i think that it will be setVehicleLightState ?
  7. ok, but in what function i need to create timer, for what ? for setVehicleOverrideLights or for other ? I cant understand what i need to do.
  8. Hi there! I want to make a flashing ligts on vehicles when toggled L, and when L toggled again, stop flashing. But I dont understand what i need to do. I think, it should be a timer for function of toggle lights or not ? Script from vehicleligts resource ... function toggleVehicleLights ( player, key, state ) if ( getPlayerOccupiedVehicleSeat ( player ) == 0 ) then local veh = getPlayerOccupiedVehicle ( player ) if ( getVehicleOverrideLights ( veh ) ~= 2 ) then setVehicleOverrideLights ( veh, 2 ) else setVehicleOverrideLights ( veh, 1 ) end end end It will be effectly for cop-cars, like in Most Wanted. Thank's for replies
  9. try this: addCommandHandler( "ls", function( player ) setElementPosition( player, CoordinateX, CoordinateY, CoordinateZ ) outputChatBox( "You are now in Los Santos", player, 0, 255, 0 ) end )
  10. DakiLLa

    Radar Area

    takeAllWeapons ( thePlayer ) *fixed*
  11. DakiLLa

    Radar Area

    thx for help, Ace
  12. DakiLLa

    Radar Area

    I have made DM zone and if player entering the zone - server gives him a weapon, but it dont works. Can you find my mistake? I'm new in lua. local DMArea = createColCuboid ( 2597.5454, 1792.6381, 10.9765, 100, 100, 100 ) local DMRadar = createRadarArea ( 2597.5454, 1792.6381, 100, 100, 255, 0, 0 ) function DM_enter (thePlayer, matchingDimension ) outputChatBox( getClientName(thePlayer) .. " entered DM-zone ", getRootElement(), 241, 166, 10 ) giveWeapon (thePlayer, 31, 200 ) end addEventHandler ( "onColShapeHit", DMArea, DM_enter ) function DM_exit (thePlayer, matchingDimension ) if isPlayerDead (thePlayer ) ~= true then takeAllWeapons ( thePlayer ) end end addEventHandler ( "onColShapeLeave", DMArea, DM_exit ) thx for replies
  13. Is it possible to make a normal train cam with Lua scripts ?
  14. not United, but part of this Mod.
  15. hm, nice script. Can use stinger ONLY cop-team in Cdm ?
  16. Error on 164 line when i stay at the my created bank-marker without interior elseif marker == banksInfo[ k ].entrance.marker then --attempt to index field 'entrance' (a nil value)--
  17. huh..nice..but i need to save progress in gamemode . Any ways to solve this problem?
  18. in example what is "piraterpg.money" in setaccountdata and getaccountdata ? it's current file in which saves information of players or not ?
  19. Why my map not saves when i click on "Save" ?
  20. i dont want to create a new topic and i ask here: how can i save my money when i log-out and return money when i log-in ? can you help me with script ?
  21. wow! Great! Thanks for help!!
  22. Hi! I need script of giving money to players, but in Lua i'm full noob . Can you write this script for me please? Something of this: /givemoney [Player name] [the sum]
×
×
  • Create New...