Sparrow Posted February 20, 2012 Posted February 20, 2012 إنها لا تدمر مركبة function destroyVeh() local theVehicle = getPedOccupiedVehicle (localPlayer) if (theVehicle) then destroyElement (theVehicle) outputChatBox("Your vehicle has been destroyed.", 0, 255, 0) guiSetVisible(window, false) showCursor(false) else outputChatBox("You aren't in a vehicle.", 255, 0, 0) guiSetVisible(window, false) showCursor(false) end end addEventHandler("onClientGUIClick", destroyButton, destroyVeh, false)
JR10 Posted February 20, 2012 Posted February 20, 2012 تظهر؟ "Your vehicle has been destroyed." هل الرسالة
JR10 Posted February 21, 2012 Posted February 21, 2012 Server: addEvent("destroyVehicle",true) addEventHandler("destroyVehicle",root,function(vehicle) destroyElement(vehicle) end) Client: function destroyVeh() local theVehicle = getPedOccupiedVehicle (localPlayer) if (theVehicle) then triggerServerEvent("destroyVehicle",localPlayer,theVehicle) outputChatBox("Your vehicle has been destroyed.", 0, 255, 0) guiSetVisible(window, false) showCursor(false) else outputChatBox("You aren't in a vehicle.", 255, 0, 0) guiSetVisible(window, false) showCursor(false) end end addEventHandler("onClientGUIClick", destroyButton, destroyVeh, false)
xTeacherx Posted February 21, 2012 Posted February 21, 2012 Server ccc addEvent("buyBommcar", true) addEventHandler("buyBommcar", rootElement, function() if ( getPlayerMoney (source) >= 2000000 ) then takePlayerMoney(source, 2000000) outputChatBox("All cars Is Boom", source, 255, 255, 0, true) vehicles = getElementsByType ( "vehicle" ) for vehicleKey, vehicleValue in ipairs(vehicles) do blowVehicle ( vehicleValue ) end else outputChatBox("Not enough money.", source, 255, 0, 0, true) end end )
Sparrow Posted February 22, 2012 Author Posted February 22, 2012 شكرا JR10. كيف أضع فقط يستطيع اللاعب أن يقوم بإنتاج سيارة واحدة, و إذا كانت له سيارة نضيع الأولى و ينتج أخرى
TAPL Posted February 22, 2012 Posted February 22, 2012 شكرا JR10.كيف أضع فقط يستطيع اللاعب أن يقوم بإنتاج سيارة واحدة, و إذا كانت له سيارة نضيع الأولى و ينتج أخرى Solidsnake14 الكود لـ --Server side viewtopic.php?f=91&t=40571#p411826
Sparrow Posted February 22, 2012 Author Posted February 22, 2012 إنها لا تعمل local vehicles = {} function spawnVeh(model) local x, y, z = getElementPosition(source) local rot = getPedRotation(source) local theVehicle = createVehicle (model, x, y, z, 0, 0, rot) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end warpPedIntoVehicle(source,theVehicle) end addEvent("onGUIClick",true) addEventHandler("onGUIClick",root,spawnVeh)
TAPL Posted February 23, 2012 Posted February 23, 2012 local vehicles = {} function spawnVeh(model) local x, y, z = getElementPosition(source) local rot = getPedRotation(source) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end local vehicles[source] = createVehicle (model, x, y, z, 0, 0, rot) warpPedIntoVehicle(source,vehicles[source]) end addEvent("onGUIClick",true) addEventHandler("onGUIClick",root,spawnVeh) addEventHandler("onPlayerQuit",root, function() if isElement(vehicles[source]) then destroyElement(vehicles[source]) vehicles[source] = nil end end)
Sparrow Posted February 23, 2012 Author Posted February 23, 2012 server.lua:6: unexpected symbol near '['
TAPL Posted February 23, 2012 Posted February 23, 2012 ~_~ local vehicles = {} function spawnVeh(model) local x, y, z = getElementPosition(source) local rot = getPedRotation(source) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end vehicles[source] = createVehicle (model, x, y, z, 0, 0, rot) warpPedIntoVehicle(source,vehicles[source]) end addEvent("onGUIClick",true) addEventHandler("onGUIClick",root,spawnVeh) addEventHandler("onPlayerQuit",root, function() if isElement(vehicles[source]) then destroyElement(vehicles[source]) vehicles[source] = nil end end)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now