-
Posts
378 -
Joined
-
Last visited
Everything posted by BriGhtx3
-
I already added it when I was trying it. But it is the same.
-
No. You just added an Event. No real changes. No error and so on. But thank you
-
Help - Making script workes on player first time join
BriGhtx3 replied to SonicTHedgehog's topic in Scripting
Try to use SQLite. Or : function join ( ) if getElementData (source, "firstTime") == false then setElementData ( source, "firstTime", true ) --... end end addEventHandler ( "onPlayerJoin", getRootElement(), join ) I'm not sure if this can work, because if the getElementData doesn't exist for a new player, then there will be an error -
This is my Client File : function nHalt() local sound = playSound("sounds/Bus/nHalt.ogg") end function lt() nHalt() local ltr = playSound("sounds/Bus/Bushaltestellen/LTR.ogg") end addEvent("LTR", true) addEventHandler("LTR", getRootElement(), lt) function SchrottP() nHalt() local schrott = playSound("sounds/Bus/Bushaltestellen/Schrott.ogg") end addEvent("Schrott", true) addEventHandler("Schrott", getRootElement(), SchrottP) function AngelP() nHalt() local angel = playSound("sounds/Bus/Bushaltestellen/Angel.ogg") end addEvent("Angel", true) addEventHandler("Angel", getRootElement(), AngelP) My Server File : local HalteNr1 function startJob(thePlayer) HalteNr1 = createMarker ( -2435, -595, 132, "checkpoint", 10, 125, 0, 0, 255, thePlayer ) HalteNr1B = createBlip ( -2435, -595, 132, 0, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) triggerClientEvent ( thePlayer, "LTR", getRootElement() ) triggerClientEvent ( thePlayer, "infobox_start", getRootElement(), "\nDienst gestartet!", 5000, 125, 0, 0 ) addEventHandler("onMarkerHit", HalteNr1, cMarker) end local HalteNr2 function cMarker(thePlayer) local money = vioGetElementData(thePlayer, "money") vioSetElementData ( thePlayer, "money", tonumber(money)+50 ) givePlayerMoney(thePlayer, 50) destroyElement(HalteNr1B) destroyElement(HalteNr1) triggerClientEvent ( thePlayer, "Schrott", getRootElement() ) HalteNr2 = createMarker ( -1923, -1785, 32, "checkpoint", 10, 125, 0, 0, 255, thePlayer ) HalteNr2B = createBlip ( -1923, -1785, 32, 0, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) addEventHandler("onMarkerHit", HalteNr2, dMarker) end When I hit the first marker, both sounds are played. When I hit the second marker, just the "nHalt" is played. How can I change the script, that both sounds are played? Everything is in the meta.xml No errors are shown
-
Oh thank you Edit : there was no error
-
My files : client : function createFreikaufGUI() gWindow["freikaufen"] = guiCreateWindow(250,162,310,331,"Auto freikaufen",false) freiKaufLb = guiCreateLabel(26,22,253,47,"Auto freikaufen",false,gWindow["freikaufen"]) guiSetFont(freiKaufLb,"sa-gothic") fText = guiCreateLabel(33,78,234,85,"Hier kannst du dein beschlagnahmtes\nAuto freikaufen! Die Gebühren liegen bei\n200$ pro Freikauf! Gehe anschließend zur\nVerwahrungsstelle um dein Auto\nabzuholen. Der Eintritt liegt bei 150$!",false,gWindow["freikaufen"]) guiSetFont(fText,"default-bold-small") fSlot = guiCreateLabel(37,184,235,35,"Slot des Autos? (1-9) : ",false,gWindow["freikaufen"]) guiSetFont(fSlot,"sa-header") fEdit = guiCreateEdit(38,231,233,34,"",false,gWindow["freikaufen"]) fBtn = guiCreateButton(41,274,228,40,"Auto freikaufen",false,gWindow["freikaufen"]) guiSetFont(fBtn,"sa-header") guiSetVisible(gWindow["freikaufen"], true) showCursor(true) addEventHandler("onClientGUIClick", fBtn, function() triggerServerEvent ( "freiKauf", lp, guiGetText ( fEdit ) ) end) end addCommandHandler("buykaution", createFreikaufGUI) server : function freiKaufS(theplayer, text) local player = getPlayerName( source ) --[[if slot > 9 or slot < 1 then triggerClientEvent ( player, "infobox_start", getRootElement(), "Slot nicht verfügbar!", 5000, 125, 0, 0 ) else local money = tonumber( vioGetElementData ( player, "money" ) ) local preis = 200 if money >= preis then vioSetElementData ( player, "money", money - preis ) MySQL_SetString("vehicles", "Beschlagnahmt", "0", "Besitzer LIKE '" ..player.."' AND Slot LIKE '" ..slot.. "' ") outputChatBox("Erfolgreich freigekauft!", player, 0, 255, 0) else triggerClientEvent ( player, "infobox_start", getRootElement(), "\nDu hast nicht genug\nGeld!", 5000, 125, 0, 0 ) end end]]-- outputChatBox(text) outputChatBox(player) end addEvent( "freiKauf", true ) addEventHandler( "freiKauf", getRootElement(), freiKaufS ) When I type "/buykaution" the gui window opens. Then when I click on the Button, the event triggers. When I output the results, it outputs the name which is triggered, but not the text in the editBox. Everything is in the meta.xml.
-
Yes I didn't know if i can use guisetvisible for pictures
-
Alright thank you. Now how do I hide the picture after 10 seconds?
-
blitzer.lua local distanz = createMarker ( -2006, 146, 28, cylinder, 10, 0, 0, 0, 0 ) function blitzer(hitElement, matchingDimension) speedx, speedy, speedz = getElementVelocity (hitElement) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) mps = actualspeed * 50 kmh = actualspeed * 180 mph = actualspeed * 111.847 geld = kmh/100*200 if kmh > 100 then outputChatBox ( "Du hast die maximale Geschwindkeit überstritten!", hitElement, 255, 0, 0) outputChatBox ( "Als Strafe wurden dir "..math.ceil(geld).."$ abgezogen!", hitElement, 255, 0, 0) triggerClientEvent(hitElement, "onStrafe", getRootElement()) setPlayerMoney(hitElement, -math.ceil(tonumber(geld))) end end addEventHandler("onMarkerHit", distanz, blitzer) blitzer_client.lua: function StrafHandler ( ) guiCreateStaticImage( 20,200, 400, 600, "blitzer/blitzer.png", false ) outputChatBox("Test") end addEvent( "onStrafe", true ) addEventHandler( "onStrafe", getRootElement(), StrafHandler ) The Problem is that the image doesn't show. It is in the meta.xml : <file src="blitzer/blitzer.png" /> And YES it is in the folder "blitzer"!
-
Oh alright now it works It was the dff! Thank you
-
http://uploaded.to/file/4ylipu0p
-
Still Bad txd Pointer (1) addEventHandler("onClientResourceStart",resourceRoot, function() setTimer(test, 1000, 0) end) function test() txd = engineLoadTXD("106.txd") engineImportTXD(txd, 106) txd2 = engineLoadTXD("107.txd") engineImportTXD(txd2, 107) end
-
@SDK false false false false @TABL I am not totally stupid
-
Doesn't work. The error message is : Bad txd pointer(1)
-
I don't know where the error is client.lua function replaceModel() local skin = engineLoadTXD ( "skins/106.txd" ) engineImportTXD ( skin, 106 ) skin = engineLoadTXD ( "skins/107.txd" ) engineImportTXD ( skin, 107 ) end addEventHandler ( "onClientResourceStart", getResourceRootElement(), replaceModel) My meta.xml : <script src="client.lua" type="client" /> <file src="skins/106.txd" /> <file src="skins/107.txd" /> And of course this IS NOT my WHOLE meta.xml! When I go ingame and change my skin to that one, it shows the original skins.
-
-- --Die function job muss angepasst werden, da ich die Variablen etc, nicht kenne -- -- VARIABLEN pMal = 0 function job(thePlayer) if (getElementData(thePlayer, "Job") == true) then outputChatBox('Du hast bereits einen Job!', thePlayer, 255, 0, 0) else outputChatBox('Du hast den Job angenommen!', thePlayer, 0, 255, 0) setElementData(thePlayer, "Job", true) setElementData(thePlayer, "JobLevel", 1) end end addCommandHandler("job", job) function startJob1(thePlayer) if (getElementData(thePlayer, "Job") == true) then ---- Level1 if (getElementData(thePlayer, "JobLevel") < 5) then setElementPosition(thePlayer, -1184, -1126, 130) setCameraTarget(thePlayer,thePlayer) ------------ pickup1 = createPickup(-1045, -1020, 128, 3, 1453) marker1 = createMarker(-1045, -1020, 128, checkpoint, 0.5, 255, 0, 0) ------------ outputChatBox('Sammle das Heu auf und bringe es zur Scheune', thePlayer) end end end addCommandHandler("starten1", startJob1) function pickups(hitPlayer) if isElementWithinMarker(hitPlayer, marker1 ) then outputChatBox('Gehe nun zur Scheune!', thePlayer) markerS = createMarker(-1184, -1126, 130, checkpoint, 0.5, 255, 0, 0 ) destroyElement(marker1) end -------------- if isElementWithinMarker(hitPlayer, markerS) then pMal = pMal + 1 outputChatBox('Hole noch mehr Heu!', thePlayer) pickup2 = createPickup(-1122, -953, 128, 3, 1453) marker2 = createMarker(-1122, -953, 128, checkpoint, 0.5, 255, 0, 0) destroyElement(MarkerS) end -------------- if isElementWithinMarker(hitPlayer, marker2 ) then outputChatBox('Gehe nun zur Scheune!', thePlayer) markerS2 = createMarker(-1184, -1126, 130, checkpoint, 0.5, 255, 0, 0 ) destroyElement(marker2) end -------------- if isElementWithinMarker(hitPlayer, markerS2) then pMal = pMal + 1 outputChatBox('Hole noch mehr Heu!', thePlayer) pickup3 = createPickup(-11185, -1000, 128, 3, 1453) marker3 = createMarker(-11185, -1000, 128, checkpoint, 0.5, 255, 0, 0) destroyElement(MarkerS2) end -------------- if isElementWithinMarker(hitPlayer, marker3 ) then outputChatBox('Gehe nun zur Scheune!', thePlayer) markerS3 = createMarker(-1184, -1126, 130, checkpoint, 0.5, 255, 0, 0 ) destroyElement(marker3) end -------------- if isElementWithinMarker(hitPlayer, markerS3) then pMal = pMal + 1 if pMal == 3 then destroyElement(MarkerS3) local pMoney = getPlayerMoney(hitPlayer) setPlayerMoney(hitPlayer, pMoney + 75) end end end addEventHandler("onMarkerHit", getRootElement(), pickups) This is my Code... When I hit the first marker (marker1), it gets destroyed. But when I hit the second one (markerS) it gets not destroyed (shouldn't be so), (but the marker after it (marker3) is visible (should be like this)). But now when I go to the next (marker3) the message is shown thousands of times and nothing gets along. Now : How can I fix it? - Every marker should be destroyed after hitting it and then the next shown.
-
Thanks BinSlayer1 My dimension was 0.
-
My Script : function AldiPed() AldiPed1 = createPed ( 219, 0, 0, 0 ) setElementInterior (AldiPed1, 4, -29, -30, 1004) setPedVoice(AldiPed1, "PED_TYPE_DISABLED") setPedFrozen (AldiPed1, true) setElementDimension (AldiPed1, 1) end addEventHandler('onClientResourceStart', getResourceRootElement(),AldiPed) I don't know where my error is. There isn't an error, just I don't see any ped. Even if I spawn him next to me.
-
Alright it works, thanks My next Problem : Schranke = createObject ( 968, 1557.6271972656, 2228.3720703125, 9.8182258605957, 0, 0, 0 ) markeraussens = createMarker ( 1562, 2232.5, 10, "cylinder", 5, 0, 0, 0, 0 ) markerinnens = createMarker ( 1554, 2232.5, 10, "cylinder", 5, 0, 0, 0, 0 ) toggle = 0 function toggleSchrankeAussen(thePlayer,command) if toggle == 0 then setElementRotation (Schranke, 0, 0, 277) toggle = 1 else setElementRotation (Schranke, 0, 0, 0) toggle = 0 end end function toggleSchrankeInnen(thePlayer,command) if toggle == 0 then setElementRotation (Schranke, 0, 0, 277) toggle = 1 else setElementRotation (Schranke, 0, 0, 0) toggle = 0 end end addEventHandler( "onMarkerHit", markeraussens, toggleSchrankeAussen ) addEventHandler( "onMarkerHit", markerinnens, toggleSchrankeInnen ) First the Barrier should be closed (rotation 0, but it is open). Then when I hit the marker, it should open and then close (when you leave the marker). How can I do this? EDIT : GOT IT, no questions
-
You mean like : warpPedIntoVehicle ( Ped1, veh, 2 ) <-- seat 1 ?
-
Hey, i have two scripts : - If I type /ped 400 10 10 10, a car is created, 3 peds and all are teleported into the car 400. - My Carsystem, where i can toggle the motor and lights. My Script (carsystem) : function motor(player,key,state) if getPedOccupiedVehicleSeat ( player ) == 0 then local auto = getPedOccupiedVehicle ( player ) if getVehicleEngineState ( auto ) == false then setVehicleEngineState ( auto, true ) else setVehicleEngineState ( auto, false ) end end end function Licht(player,key,state) if getPedOccupiedVehicleSeat ( player ) == 0 then local auto = getPedOccupiedVehicle ( player ) if getVehicleOverrideLights(auto) == 1 then setVehicleOverrideLights ( auto, 2 ) else setVehicleOverrideLights ( auto, 1 ) end end end function Keybind(player) if getPedOccupiedVehicleSeat ( player ) == 0 then local auto = getPedOccupiedVehicle ( player ) local motor2 = getElementData(auto,"Motor") if motor2 == true then setVehicleEngineState ( auto, true ) else setVehicleEngineState ( auto, false ) end setVehicleOverrideLights ( auto, 1 ) bindKey ( player, "X", "down", motor ) bindKey ( player, "L", "up", Licht ) end end addEventHandler("onVehicleEnter", getRootElement(), Keybind) function unKeybind(player) if getPedOccupiedVehicleSeat ( player ) == 0 then unbindKey ( player, "X", "down", motor ) unbindKey ( player, "L", "up", Licht ) end end addEventHandler("onVehicleExit", getRootElement(), unKeybind) And the admincommand : function ped ( thePlayer, command, vehicle, skin1, skin2, skin3 ) if isAdmin( thePlayer, AdminCommand[string.lower(command)] ) then if tonumber(skin1) and tonumber(skin2) and tonumber(skin3) and tonumber(vehicle) then local pX, pY, pZ = getElementPosition( thePlayer ) local Ped1 = createPed ( skin1, 0, 0, 3 ) local Ped2 = createPed ( skin2, 0, 0, 3 ) local Ped3 = createPed ( skin3, 0, 0, 3 ) local veh = createVehicle( vehicle, pX, pY, pZ ) warpPedIntoVehicle ( Ped1, veh ) warpPedIntoVehicle ( Ped2, veh ) warpPedIntoVehicle ( Ped3, veh ) warpPedIntoVehicle ( thePlayer, veh ) outputChatBox( "Du hast Menschen in dein Auto teleportiert.", thePlayer ) else outputChatBox( "Benutzung : /ped [AUTO ID] [sKIN1] [sKIN2] [sKIN3]", thePlayer ) end else outputChatBox( "Du hast nicht das Recht dazu!", thePlayer ) end end My Error(s) : When I type /ped 400 10 10 10 (for example), a car is created and im teleported into this car. But not the peds! The errors : Bad "Player" pointer at bindkey (39) Bad "Player" pointer at bindkey (40) The Lines : bindKey ( player, "X", "down", motor ) bindKey ( player, "L", "up", Licht ) Of course I know the error, but i don't know how to fix it (the error is that the script cant bind the keys to the created peds) xthepr0mise
