-
Posts
96 -
Joined
-
Last visited
Everything posted by LasHa
-
ah srry srry <3 ty you fixed it i just added wrongly in meta
-
max it didn't work for me idk why
-
do you try them in your local server? it doesn't works
-
marker hit but i have it i am opening gui in my script i didn't write whole script i wrote script where is gui and i want just button click i already have gui i will post whole script if its needed local ddmarker = createMarker( 2719, -1828, 11, "cylinder", 2, 255, 255, 0, 170, false ) createBlipAttachedTo(ddmarker, 43) local playerName = getPlayerName(getLocalPlayer()) participateWindow = guiCreateWindow(436, 368, 448, 220, "CSU DD Event", false) guiWindowSetSizable(participateWindow, false) participateButton = guiCreateButton(76, 150, 128, 43, "Participate", false, participateWindow) guiSetFont(participateButton, "default-bold-small") participateLabel = guiCreateLabel(10, 21, 432, 127, "Hello "..playerName..", you are about to participate in dd event, \nwhere you can kill people by car, with shooting them rockets from car. Click \nbutton Participate, but it costs 5,000$. \nIf you don't want to participate, or lose 5,000$ click Cansel Button. \nBut also you must know that, if you win this event you will get \n50,000$.", false, participateWindow) guiSetFont(participateLabel, "clear-normal") canselButton = guiCreateButton(233, 150, 128, 43, "Cansel", false, participateWindow) guiSetFont(canselButton, "default-bold-small") guiSetVisible (participateWindow, false) addEventHandler("onClientGUIClick", canselButton, function () guiSetVisible(participateWindow, false) showCursor(false) end, false) addEventHandler("onClientGuiClick", participateButton, function () local count = getElementData(localPlayer,"Your_Data")setElementData(localPlayer,"Your_Data",count+1) takePlayerMoney(5000) exports.CSUtexts:output("You have been participated in event, wait for other players, to participate and when you reach 10 players, event will be started automaticaly.", 255, 255, 0) guiSetVisible ( participateWindow, false ) end, false) function enteredMarker() if ( guiGetVisible ( participateWindow ) == false ) then guiSetVisible ( participateWindow, true ) showCursor(true) end end addEventHandler ( "onClientMarkerHit", ddmarker, enteredMarker ) function onQuitGame( ) local playerLeft = getPlayerName(source) local count = getElementData(localPlayer,"Your_Data") setElementData(localPlayer,"Your_Data",count-1) exports.CSUtexts:output(""..playerLeft.." left the event, Paricipate players in event "..count.."", 255, 255, 0) end addEventHandler( "onClientPlayerQuit", getRootElement(), onQuitGame ) addCommandHandler("leavedd", onQuitGame) function checkPlayers() local playersInDD = getElementData(localPlayer,"Your_Data") exports.CSUtexts:output("There are "..playersInDD.."/10 players signed in event", 255, 255, 0) end addCommandHandler("ddevent", checkPlayers) function warpPlayers() if (getElementData(localPlayer,"Your_Data", 10)) then exports.CSUtexts:output("10/10 players have signed in event, wait 10 seconds, to be warped.", 255, 255, 0) setTimer(1000, 1) end end
-
marker hit but i have it i am opening gui in my script i didn't write whole script i wrote script where is gui and i want just button click i already have gui i will post whole script if its needed [lua]local ddmarker = createMarker( 2719, -1828, 11, "cylinder", 2, 255, 255, 0, 170, false ) createBlipAttachedTo(ddmarker, 43) local playerName = getPlayerName(getLocalPlayer()) participateWindow = guiCreateWindow(436, 368, 448, 220, "CSU DD Event", false) guiWindowSetSizable(participateWindow, false) participateButton = guiCreateButton(76, 150, 128, 43, "Participate", false, participateWindow) guiSetFont(participateButton, "default-bold-small") participateLabel = guiCreateLabel(10, 21, 432, 127, "Hello "..playerName..", you are about to participate in dd event, \nwhere you can kill people by car, with shooting them rockets from car. Click \nbutton Participate, but it costs 5,000$. \nIf you don't want to participate, or lose 5,000$ click Cansel Button. \nBut also you must know that, if you win this event you will get \n50,000$.", false, participateWindow) guiSetFont(participateLabel, "clear-normal") canselButton = guiCreateButton(233, 150, 128, 43, "Cansel", false, participateWindow) guiSetFont(canselButton, "default-bold-small") guiSetVisible (participateWindow, false) addEventHandler("onClientGUIClick", canselButton, function () guiSetVisible(participateWindow, false) showCursor(false) end, false) addEventHandler("onClientGuiClick", participateButton, function () local count = getElementData(localPlayer,"Your_Data")setElementData(localPlayer,"Your_Data",count+1) takePlayerMoney(5000) exports.CSUtexts:output("You have been participated in event, wait for other players, to participate and when you reach 10 players, event will be started automaticaly.", 255, 255, 0) guiSetVisible ( participateWindow, false ) end, false) function enteredMarker() if ( guiGetVisible ( participateWindow ) == false ) then guiSetVisible ( participateWindow, true ) showCursor(true) end end addEventHandler ( "onClientMarkerHit", ddmarker, enteredMarker ) function onQuitGame( ) local playerLeft = getPlayerName(source) local count = getElementData(localPlayer,"Your_Data") setElementData(localPlayer,"Your_Data",count-1) exports.CSUtexts:output(""..playerLeft.." left the event, Paricipate players in event "..count.."", 255, 255, 0) end addEventHandler( "onClientPlayerQuit", getRootElement(), onQuitGame ) addCommandHandler("leavedd", onQuitGame) function checkPlayers() local playersInDD = getElementData(localPlayer,"Your_Data") exports.CSUtexts:output("There are "..playersInDD.."/10 players signed in event", 255, 255, 0) end addCommandHandler("ddevent", checkPlayers) function warpPlayers() if (getElementData(localPlayer,"Your_Data", 10)) then exports.CSUtexts:output("10/10 players have signed in event, wait 10 seconds, to be warped.", 255, 255, 0) setTimer(1000, 1) end end
-
doesn't works + so many bugs also when start script it shows me gui and when do end to don't show this window it fails script so please cadell help me.
-
really? prooo <3 doesn't works any other wayS?
-
guys can yo uhelp me? everything works fine, everything what i did, but not Participate button which is the main thing, i have added it in fucntion but didn't work, in eventhandler again ddidn't work, please fix it and help me local ddmarker = createMarker( 2719, -1828, 11, "cylinder", 2, 255, 255, 0, 170, false ) createBlipAttachedTo(ddmarker, 11) local playerName = getPlayerName(getLocalPlayer()) participateWindow = guiCreateWindow(436, 368, 448, 220, "CSU DD Event", false) guiWindowSetSizable(participateWindow, false) participateButton = guiCreateButton(76, 150, 128, 43, "Participate", false, participateWindow) guiSetFont(participateButton, "default-bold-small") participateLabel = guiCreateLabel(10, 21, 432, 127, "Hello "..playerName..", you are about to participate in dd event, \nwhere you can kill people by car, with shooting them rockets from car. Click \nbutton Participate, but it costs 5,000$. \nIf you don't want to participate, or lose 5,000$ click Cansel Button. \nBut also you must know that, if you win this event you will get \n50,000$.", false, participateWindow) guiSetFont(participateLabel, "clear-normal") canselButton = guiCreateButton(233, 150, 128, 43, "Cansel", false, participateWindow) guiSetFont(canselButton, "default-bold-small") guiSetVisible (participateWindow, false) addEventHandler("onClientGUIClick", canselButton, function () guiSetVisible(participateWindow, false) showCursor(false) end, false) addEventHandler("onClientGuiClick", participateButton, function () local count = getElementData(localPlayer,"Your_Data")setElementData(localPlayer,"Your_Data",count+1) takePlayerMoney(5000) exports.CSUtexts:output("You have been participated in event, wait for other players, to participate and when you reach 10 players, event will be started automaticaly.", 255, 255, 0) guiSetVisible ( participateWindow, false ) end, false)
-
its server side or client?
-
thanks very mcuh cadell you understood what i wanted.
-
guys i am new scripter and i am going to make great script just a problem that i have got. i want to set element data like this one, when player click button, setelementdata playersJoined and when second player hits in this button, it adds in the same elementdata playersJoined but +1 and when player leave game or write /cansel maybe -1? but how? i don't know anything in datas and in wiki i didn't understand what to do because there are not things like i want please help me :(
-
you didn't understand me i don't want to hide car when i exiting it, i want to hide car not only the time when i'm inside i want to hide it everytime when i am just like. 5000 meters next to the car
-
nikitafloy please show me an example change it please i can't understand like tihs
-
Hello everyone. Guys i have just done vehicle shop with its f2 features window. I have done everything but small problem. i have added Hide button in f2 and when you are in vehicle it can hide car but i couldn't hide car when i am not in car please guys help Here is code of Picking Car And Hiding Car Picking Car function pickCar(ownerName,carName) if getElementData(ownerName, "gotCar") == "no" then local getowner = getAccountName(getPlayerAccount(ownerName)) local carModel = getVehicleModelFromName(carName) local x,y,z = getElementPosition(ownerName) OwnerVehicle = createVehicle(carModel, x, y, z) setElementData(OwnerVehicle, "owner", tostring(gayowner)) setElementData(ownerName, "gotCar", "yes") local carlma = executeSQLQuery("SELECT * FROM carshops WHERE owner=?", getowner) else outputChatBox("You don't own a car", ownerName, 255, 0, 0) end end addEvent("spawn_dealer_car", true) addEventHandler("spawn_dealer_car", getRootElement(), spawn_car_pleaseD) Hide Car function hideCar (ownerName) pedCar = getPedOccupiedVehicle(ownerName) getownerAcc = getAccountName(getPlayerAccount(ownerName)) if isPedInVehicle(ownerName) == true then if getElementData(ownerName, "gotCar") == "yes" and getElementData(pedCar, "owner") == getownerAcc then CurrentCar = getPedOccupiedVehicle(ownerName) destroyElement(CurrentCar) setElementData(ownerName, "gotCar", "no") else outputChatBox("You can't hide car that you don't have", ownerName, 255, 0, 0) end else outputChatBox("You can't hide, if you are not sit on it", ownerName, 255, 0, 0) end end addEvent("destroy_dealer_car", true) addEventHandler("destroy_dealer_car", getRootElement(), destroy_car_pleaseD)
-
okey gui fixed when start resource and join but why it doesn't opening with f2 and with /vehiclemenu its okey
-
Guys Why noone helps? i thinked you were nice guys and you could help me
-
guys hello i am new scripter and its my first script i ever made. you will laugh when you will see my script because of its bugs but i am new scripter. guys problem is that when player joins in server or when resource starts it shows features menu and car shop it self. also when i am buying car it doesn't adds in vehicle features. when i click f2 or write command /vehiclemenu it doesn't opens features menu. and some other bugs. i need your help to learn scripting please guys client.lua local vehicles = { { "Bullet", 1400000 }, { "Infernus", 1500000 }, { "Banshee", 250000 } } addEventHandler ( "onClientResourceStart", getResourceRootElement ( getThisResource() ), function() shopWindow = guiCreateWindow(30, 352, 333, 650, "Vehicle Sales", false) guiWindowSetSizable(shopWindow, false) shopGrid = guiCreateGridList(10, 62, 312, 542, false, shopWindow) vehicleGrid = guiGridListAddColumn(shopGrid, "Vehicle", 0.5) priceGrid = guiGridListAddColumn(shopGrid, "Price", 0.5) chooseLabel = guiCreateLabel(12, 24, 181, 15, "Choose one vehicle and click Buy", false, shopWindow) guiLabelSetColor(chooseLabel, 84, 238, 16) buyButton = guiCreateButton(12, 610, 98, 29, "Buy", false, shopWindow) colorButton = guiCreateButton(115, 610, 98, 29, "Choose Color", false, shopWindow) closeButton = guiCreateButton(218, 610, 98, 29, "Close", false, shopWindow) addEventHandler ( "onClientGUIClick", closeButton, hideShopWindow, false ) addEventHandler ( "onClientGUIClick", buyButton, buyVehicle, false ) for i, v in ipairs ( vehicles ) do local row = guiGridListAddRow ( shopGrid ) guiGridListSetItemText ( shopGrid, row, vehicleGrid, v[1], false, false ) guiGridListSetItemData ( shopGrid, row, vehicleGrid, v[2], false, false ) guiGridListSetItemText ( shopGrid, row, priceGrid, v[2], false, false ) end guiSetVisible (shopWndow, false) end ) function hideShopWindow () guiSetVisible (shopWindow, false) showCursor (false) end addEvent ( "showShopGui", true ) addEventHandler ( "showShopGui", root, function ( thePlayer ) if ( thePlayer == getLocalPlayer() ) then guiSetVisible ( shopWindow, true ) showCursor ( true ) end end ) function buyVehicle () local row = guiGridListGetSelectedItem ( shopGrid ) if ( row ~= -1 ) then local price = guiGridListGetItemData ( shopGrid, row, vehicleGrid ) local vehicleName = guiGridListGetItemText ( shopGrid, row, vehicleGrid ) triggerServerEvent ( "buyVehicle", getLocalPlayer(), getLocalPlayer(), price, vehicleName) else outputChatBox ( "Please make a selection first.", getLocalPlayer() ) end end server.lua local shopMarker = createMarker ( 2131.7788, -1149.8193, 23, "cylinder", 2, 255, 255, 0, 150 ) local shopBlip = createBlipAttachedTo ( shopMarker, 55 ) setBlipVisibleDistance ( shopBlip, 500 ); addEventHandler ( "onMarkerHit", shopMarker, function ( thePlayer ) if ( getElementType ( thePlayer ) == "player" ) then triggerClientEvent ( "showShopGui", thePlayer, thePlayer ) end end ) addEvent ( "buyVehicle", true ) addEventHandler ( "buyVehicle", root, function ( thePlayer, price, vehicle ) local playerMoney = getPlayerMoney ( thePlayer ) if ( playerMoney >= price ) then local model = getVehicleModelFromName ( vehicle ) local accName = getAccountName ( getPlayerAccount ( thePlayer )) local insertQry = ( "INSERT INTO `vehicles` ( VehicleModel, VehicleColor1, VehicleColor2, VehicleColor3, VehicleColor4, VehicleX, VehicleY, VehicleZ, VehicleRot, VehicleFuel, VehicleHealth, VehicleOwner, VehiclePlate ) VALUES ( '".. model .."', '".. tostring ( color1 ) .."', '".. tostring ( color2 ) .."', '".. tostring ( color3 ) .."', '".. tostring ( color4 ) .."', '2134', '-1135', '26', '100.85', '100', '1000', '".. ( accName ) .."', '".. tostring ( plate ) .."' )" ); if ( insertQry ) then triggerClientEvent ( "hideShopGui", thePlayer, thePlayer ) outputChatBox ( "Your purchase has been completed successfully, you can now spawn it using the vehicle menu. ( /vehiclemenu )", thePlayer ); takePlayerMoney ( thePlayer, price ) else outputChatBox ( "Something went wrong, please notify an administrator about this.", thePlayer ); end else outputChatBox ( "You can't afford this vehicle.", thePlayer ) end end ) features-c.lua local marked = false; local markedBlip = nil; local markedDbid = nil; local markedTimer = nil; addEventHandler ( "onClientResourceStart", getResourceRootElement ( getThisResource() ), function() featuresWindow = guiCreateWindow(976, 290, 294, 429, "Vehicle Features", false) guiWindowSetSizable(featuresWindow, false) guiSetAlpha(featuresWindow, 0.95) chosenLabel = guiCreateLabel(10, 32, 204, 15, "No Vehicles Selected", false, featuresWindow) guiLabelSetColor(chosenLabel, 76, 116, 228) featuresGrid = guiCreateGridList(10, 116, 273, 238, false, featuresWindow) vehicleColumnGrid = guiGridListAddColumn(featuresGrid, "Vehicle", 0.5) healthColumnGrid = guiGridListAddColumn(featuresGrid, "Health", 0.5) recoverButton = guiCreateButton(9, 78, 59, 32, "Recover", false, featuresWindow) lockButton = guiCreateButton(224, 78, 59, 32, "Un/Lock", false, featuresWindow) blipButton = guiCreateButton(159, 78, 59, 32, "Un/Blip", false, featuresWindow) pickButton = guiCreateButton(9, 364, 50, 34, "Pick", false, featuresWindow) sellButton = guiCreateButton(69, 364, 50, 34, "Sell", false, featuresWindow) hideButton = guiCreateButton(129, 364, 50, 34, "Hide", false, featuresWindow) closeButton = guiCreateButton(210, 364, 73, 38, "Close", false, featuresWindow) addEventHandler ( "onClientGUIClick", pickButton, spawnVehicle, false ); addEventHandler ( "onClientGUIClick", blipButton, markVehicle, false ); addEventHandler ( "onClientGUIClick", closeButton, closeMenu, false ); guiSetVisible ( featuresMain, false ); end ) function spawnVehicle () local row = guiGridListGetSelectedItem ( featuresGrid ); if ( row ~= -1 ) then local dbid = guiGridListGetItemData ( featuresGrid, row, vehicleColumnGrid ); triggerServerEvent ( "spawnVehicle", getLocalPlayer(), getLocalPlayer(), dbid ); else outputChatBox ( "Please select a vehicle first.", getLocalPlayer() ); end end function markVehicle () if ( marked ) then outputChatBox ( "Your vehicle is still marked.", getLocalPlayer() ); else local row = guiGridListGetSelectedItem ( featuresGrid ); if ( row ~= -1 ) then local dbid = guiGridListGetItemData ( featuresGrid, row, vehicleColumnGrid ); for i, v in ipairs ( getElementsByType ( "vehicle" ) ) do if ( getElementData ( v, "vehicle:dbid" ) == tonumber ( dbid ) ) then markedBlip = createBlipAttachedTo ( v, 41 ); marked = true; markedDbid = tonumber ( dbid ); markedTimer = setTimer ( function () destroyElement ( markedBlip ); marked = false; markedBlip = nil; markedDbid = nil; markedTimer = nil; end, 12000, 1 ); return; end end end end end addEventHandler ( "onClientVehicleEnter", root, function ( thePlayer ) if ( thePlayer == getLocalPlayer() ) then if ( getElementData ( source, "vehicle:dbid" ) ~= nil ) then if ( getElementData ( source, "vehicle:dbid" ) == markedDbid ) then destroyElement ( markedBlip ); marked = false; markedBlip = nil; markedDbid = nil; if ( isTimer ( markedTimer ) ) then killTimer ( markedTimer ); markedTimer = nil; end end end end end ); function closeMenu () triggerEvent ( "showVehicleMenu", getLocalPlayer(), getLocalPlayer() ); end features-s.lua addCommandHandler ( "vehiclemenu", function ( thePlayer ) local vehicles = getPlayerVehicles ( thePlayer ); triggerClientEvent ( "showVehicleMenu", thePlayer, thePlayer, vehicles ); end ); function getPlayerVehicles ( thePlayer ) if not ( thePlayer ) then return; end local accName = getAccountName ( getPlayerAccount ( thePlayer ) ); outputDebugString ( thePlayer ); local query = ( "SELECT * FROM `vehicles` WHERE `VehicleOwner` = '".. ( accName ) .."'" ); if ( query[1] ~= nil ) then return query; end return {}; end addEvent ( "getPlayerVehicles", true ); addEventHandler ( "getPlayerVehicles", getRootElement(), getPlayerVehicles ); addEvent ( "spawnVehicle", true ); addEventHandler ( "spawnVehicle", root, function ( plr, dbid ) for i, e in ipairs ( getElementsByType ( "vehicle" ) ) do if ( getElementData ( e, "vehicle:dbid" ) == tonumber ( dbid ) ) then local owner = getElementData ( e, "vehicle:owner" ); local dbid = getElementData ( e, "vehicle:dbid" ); local fuel = getElementData ( e, "vehicle:fuel" ); local model = getElementModel ( e ); local x, y, z = getElementPosition ( e ); local rotX, rotY, rotZ = getElementRotation ( e ); local health = getElementHealth ( e ); local update = ( "UPDATE `vehicles` SET `VehicleX` = '".. x .."', `VehicleY` = '".. y .."', `VehicleZ` = '".. z .."', `VehicleFuel` = '".. fuel .."', `VehicleRot` = '".. rotX .."', `VehicleHealth` = '".. health .."' WHERE `VehicleId` = '".. dbid .."'" ); destroyElement ( e ); local vehicle = ( "SELECT * FROM `vehicles` WHERE `VehicleId` = '".. dbid .."'" ); if ( vehicle[1] ~= nil ) then local v = nil; local x, y, z = getElementPosition ( plr ); v = createVehicle ( vehicle [ 1 ] [ "VehicleModel"], x, y, z ); warpPedIntoVehicle ( plr, v ); else v = createVehicle ( vehicle [ 1 ] [ "VehicleModel"], vehicle [ 1 ] [ "VehicleX" ], vehicle [ 1 ] [ "VehicleY" ], vehicle [ 1 ] [ "VehicleZ" ] ); end setElementRotation ( v, 0, 0, vehicle [ 1 ] [ "VehicleRot" ] ); setElementData ( v, "vehicle:engine", false ); setElementData ( v, "vehicle:fuel", tonumber ( vehicle [ 1 ] [ "VehicleFuel" ] ) ); setElementHealth ( v, vehicle [ 1 ] [ "VehicleHealth" ] ); setElementData ( v, "vehicle:dbid", tonumber ( vehicle [ 1 ] [ "VehicleId" ] ) ); setElementData ( v, "vehicle:owner", getAccountName ( getPlayerAccount ( plr ) ) ); end end end ) addEventHandler ( "onVehicleStartEnter", root, function ( plr ) local owner = getElementData ( source, "vehicle:owner" ); if ( owner == getAccountName ( getPlayerAccount ( plr ) ) ) then setVehicleLocked ( source, false ); end end ); addEventHandler ( "onPlayerSpawn", root, function () bindKey ( source, "F2", "down", "vehiclemenu" ); end ); meta.xml <meta> <script src="server.lua" type="server" /> <script src="client.lua" type="client" /> <script src="features-s.lua" type="server" /> <script src="features-c.lua" type="client" /> </meta>
