-
Posts
1,248 -
Joined
-
Last visited
Everything posted by WhoAmI
-
exports.resource_name:setPlayerTeam( source, getTeamFromName ( "Civilian" ) )
-
If it doesn't work try to export that function.
-
How you are setting player team?
-
Oh well, thats better!
-
But read my post again. If you want it works, you must use setPlayerTeam function, not from admin panel!!
-
But It won't draw text above your head. You have to get player position every render, and use this function: getScreenFromWorldPosition.
-
Ah yea. Thanks man, that means a lot to me.
-
It will works, If you change team by using setPlayerTeam function.
-
Of couse It would lag couse you are binding key every render. I made team change event, so in my idea it will look like _setPlayerTeam = setPlayerTeam addEvent( "onPlayerChangeTeam", true ) function setPlayerTeam ( thePlayer, theTeam ) triggerEvent ( "onPlayerChangeTeam", root, thePlayer, theTeam ) return _setPlayerTeam ( thePlayer, theTeam ) end function fixing ( player ) if ( isPedInVehicle ( player ) ) then local theVehicle = getPedOccupiedVehicle ( player ) if ( theVehicle ) then fixVehicle ( theVehicle ) end else return end end addEventHandler ( "onPlayerChangeTeam", root, function (player, team) if ( getTeamName ( team ) == "Stuntage Arena" ) then bindKey ( player, "R", "down", fixing ) else unbindKey ( player, "R", "down", fixing ) end end ) Everything serverside. It will work, If you are setting team using function setPlayerTeam.
-
It will looks like this addEventHandler ( "onPlayerChangeTeam", root, function ( player, team ) local teamName = getTeamName ( team ) if teamName ~= "Criminal" then destroyElement ( robhouseMarker ) destroyElement ( robhouseBlip ) end end )
-
Well, the event 'onPlayerChangeTeam' will be active when you would use setPlayerTeam.
-
So use my event. addEventHandler ( "onPlayerChangeTeam", root, function ( player, team ) --here destroyElement end )
-
I don't know if It works, but _setPlayerTeam = setPlayerTeam addEvent( "onPlayerChangeTeam", true ) function setPlayerTeam ( thePlayer, theTeam ) triggerEvent ( "onPlayerChangeTeam", root, thePlayer, theTeam ) return _setPlayerTeam ( thePlayer, theTeam ) end And then addEventHandler ( "onPlayerChangeTeam", root, function ( player, team ) outputChatBox ( getPlayerName ( player ) .. ": " .. getTeamName ( team ) ) end ) It should output message 'nick: team name'.
-
This guy is hilarious! Type /debugscript 3 in chat and show us error.
-
Thanks, I'd test it tomorrow, but I can already see It will work.
-
Ah yea. Client: addEvent("bassOn", true) addEventHandler("bassOn", root, function () local veh = getPedOccupiedVehicle(localPlayer) local x, y, z = getElementPosition(veh) local sound1 = playSound3D("sounds/sound.mp3", x, y, z, true) setSoundVolume(sound1, 0.7) setSoundMaxDistance( sound1, 40 ) attachElements(sound1, veh) end ) addEvent("bassOff", true) addEventHandler("bassOff", root, function (veh) local veh = getPedOccupiedVehicle(localPlayer) local elements = getAttachedElements(veh) if (#elements > 0) then for _,sound in ipairs(elements) do if (getElementType(sound) == "sound") then destroyElement(sound) end end end end ) Server: addCommandHandler("hardbasson", function (player) triggerClientEvent("bassOn", root) end ) addCommandHandler("hardbassoff", function (player) triggerClientEvent("bassOff", root) end ) And know other can't hear this. Only me.
-
Well, It works, but it doesn't attach sound to vehicle. addEvent("bassOn", true) addEventHandler("bassOn", root, function () local veh = getPedOccupiedVehicle(localPlayer) local x, y, z = getElementPosition(veh) local sound1 = playSound3D("sounds/sound.mp3", x, y, z, true) setSoundVolume(sound1, 0.7) setSoundMaxDistance( sound1, 40 ) attachElement(sound1, veh) end ) addEvent("bassOff", true) addEventHandler("bassOff", root, function (veh) local veh = getPedOccupiedVehicle(localPlayer) local elements = getAttachedElements(veh) if (#elements > 0) then for _,sound in ipairs(elements) do if (getElementType(sound) == "sound") then destroyElement(sound) end end end end ) Server addCommandHandler("hardbasson", function (player) triggerClientEvent("bassOn", root) end ) addCommandHandler("hardbassoff", function (player) triggerClientEvent("bassOff", root) end )
-
addCommandHandler("hardbasson", function (player) local veh = getPedOccupiedVehicle(player) triggerClientEvent("bassOn", root, veh) end ) addCommandHandler("hardbassoff", function (player) local veh = getPedOccupiedVehicle(player) triggerClientEvent("bassOff", root, veh) end ) Client local sound addEvent("bassOn", true) addEventHandler("bassOn", root, function (veh) if (isPedInVehicle(localPlayer)) then local x, y, z = getElementPosition(veh) local sound1 = playSound3D("sounds/sound.mp3", x, y, z, true) setSoundVolume(sound1, 0.7) setSoundMaxDistance( sound1, 30 ) attachElements(sound1, veh) end end ) addEvent("bassOff", true) addEventHandler("bassOff", root, function (veh) if (isPedInVehicle(localPlayer)) then local elements = getAttachedElements(veh) if (#elements > 0) then for _,sound in ipairs(elements) do if (getElementType(sound) == "sound") then destroyElement(sound) end end end end end ) It's only for 1 player.
-
That's all? addCommandHandler("hardbasson", function (player) triggerClientEvent(player, "bassOn", root) end ) addCommandHandler("hardbassoff", function (player) triggerClientEvent(player, "bassOff", root) end ) @EDIT: It doesn't work.
-
I got this addCommandHandler("zaczep", function ( ) if (isPedInVehicle(localPlayer)) then local veh = getPedOccupiedVehicle(localPlayer) local x, y, z = getElementPosition(veh) local sound1 = playSound3D("sounds/sound.mp3", x, y, z, true) setSoundVolume(sound1, 0.7) setSoundMaxDistance( sound1, 30 ) attachElements(sound1, veh) end end ) addCommandHandler("odczep", function ( ) if (isPedInVehicle(localPlayer)) then local veh = getPedOccupiedVehicle(localPlayer) local elements = getAttachedElements(veh) if (#elements > 0) then for _,sound in ipairs(elements) do if (getElementType(sound) == "sound") then destroyElement(sound) end end end end end ) How i can do that all people can hear the sound? Couse only client can hear it.
-
table.remove(table, [pos]) -- position of value in table, for example 1'st position is 1st text
-
Try to change 10000 to 5000.
