-
Posts
1,491 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Walid
-
debugscript ??
-
try this and tell me what happen function changeColor() if isElement(dogvan) then local index = math.random(#colorTable) local r,g,b = colorTable[index][1], colorTable[index][2], colorTable[index][3] setVehicleColor ( dogvan, r,g,b) end end addCommandHandler("color",changeColor)
-
-- ServerSide: function Spwan3 ( ) if ( isElement( vehicle ) ) then destroyElement ( vehicle ) end x, y, z = getElementPosition( source ) vehicle = createVehicle( 462, x, y, z ) warpPedIntoVehicle( source, vehicle ) setVehicleColor(vehicle, 255, 255, 255) end addEvent( 'show4', true ) addEventHandler( 'show4', root, Spwan3 )
-
Because it's a local variable. vehicle = createVehicle( 462, x, y, z )
-
it change the color but only onClientResourceStart , it mean the color will be changed every time you login.
-
post your PHP file here.
-
Try onClientPedWasted() it should work.
-
i already tested it and it's working fine.
-
Try this it should work -- Server side function onTrainHornUse (player, key, keyState) if isPedInVehicle (player) then local theVehicle = getPedOccupiedVehicle(player) if (getElementModel(theVehicle) == 537) or (getElementModel(theVehicle) == 538) then if (keyState == "down") then triggerClientEvent(root,"onStartTrainHorn",root,theVehicle) elseif (keyState == "up") then triggerClientEvent(root, "stopTrainHorn", root) end end end end function onBindPlayerTrain(player) bindKey(player, "h", "down", onTrainHornUse) bindKey(player, "h", "up", onTrainHornUse) end function bindHorn () onBindPlayerTrain(source) end addEventHandler("onPlayerJoin",getRootElement(), bindHorn) function Train () for index, player in pairs(getElementsByType("player")) do onBindPlayerTrain(player) end end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), Train) -- Client side function onStartTrainHorn(vehicle) local x, y, z = getElementPosition(localPlayer) getTrainSound = playSound3D("addons/trainhorn/trainhorn.wav", x, y, z) setSoundVolume(getTrainSound, 1.0) setSoundMaxDistance(getTrainSound, 190) attachElements(getTrainSound, vehicle) end addEvent("onStartTrainHorn", true) addEventHandler("onStartTrainHorn", getRootElement(), onStartTrainHorn) function stopTrainHorn() if isElement(getTrainSound) then stopSound(getTrainSound) end end addEvent("stopTrainHorn", true) addEventHandler("stopTrainHorn", getRootElement(), stopTrainHorn)
-
there is nothing wrong try to use sth like this addEventHandler("onClientMouseEnter", guiRoot, function() if (getElementType(source) == "gui-button") then playSound("sounds/Enter.mp3", false) end end )
-
-- Client side addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), function() if (source == login_but) then username = guiGetText(the_user) password = guiGetText(the_pass) if username ~= "" and password ~= "" then triggerServerEvent("loginPlayer", localPlayer, username, password) else outputChatBox("[Login] Please complet username and password!", 255, 0, 0) return end end end) -- Server side addEvent("loginPlayer", true) addEventHandler("loginPlayer", getRootElement(), function(username,password) local acc = getAccount(username,password) if acc then logIn(source, acc, password) else outputChatBox("[Login] Check username and password!", source, 255, 0, 0, true) return end end)
-
Nice, it needed to change player2 with target, Thanks solved Appreciate it. np.
-
Replace player2 with target. and use my function.
-
just check the element before using the specific function.
-
try to use a timer setTimer(setCameraTarget,5000,1,player2, player2)
-
Try this it should work addEventHandler("onClientMouseEnter", guiRoot, function(aX, aY) if source == spawn then local sound = playSound("sounds/Enter.mp3") setSoundVolume(sound, 1.0) end end)
-
Try this it should work addCommandHandler ("revive", function(player, cmd, player2) local target = getPlayerFromPartialName(player2) if target then if isPedDead(target) then local x, y, z = getElementPosition(target) spawnPlayer(target, x, y, z) outputChatBox ("You've Revived"..target, player, 0, 255, 0, false) outputChatBox (getPlayerName(player).."revived you", target, 0, 255, 0, false) end else outputChatBox("This player does no longer exist!", player) end end) function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end
-
the sourceElement is the element that performed the action.
-
as i told you read the wiki page sourceElement: The element that is the source of the event.
-
You can find every thing on the wiki page about triggerClientEvent. triggerClientEvent (sendTo, theEventName,sourceElement, arg...) sendTo: The event will be sent to all players that are children of the specified element. By default this is the root element, and hence the event is sent to all players. If you specify a single player it will just be sent to that player. This argument can also be a table of player elements.
-
it should work addEventHandler ("onPlayerWasted", root, function() triggerClientEvent (source,"showButton", source) end
-
as i can see u didn't use onClientPlayerWasted event in ur code, i think it's just a part. post full code here.
-
do it by yourself then post your code here and we will help you. setCameraMatrix()
-
We don't give support with leaked scripts.