-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
No es posible hacer tal cosa.
-
You're welcome.
-
See if it works when you switch weapons, because it didn't work out on my local server, but I think it's because of one of my scripts messing around.
-
local invalidWeapons = -- Define a table with the weapons that won't be checked. { [ 0 ] = true, [ 1 ] = true, [ 2 ] = true, [ 3 ] = true, [ 4 ] = true, [ 5 ] = true, [ 6 ] = true, [ 7 ] = true, [ 8 ] = true, [ 9 ] = true, [ 10 ] = true, [ 11 ] = true, [ 12 ] = true, [ 14 ] = true, [ 15 ] = true, [ 16 ] = true, [ 17 ] = true, [ 18 ] = true, [ 39 ] = true, [ 44 ] = true, [ 45 ] = true, [ 46 ] = true, [ 40 ] = true } addEventHandler ( "onClientPlayerWeaponFire", localPlayer, -- Add the event handler. function ( weapon ) if ( not invalidWeapons [ weapon ] ) then -- If the weapon the player used is not in the invalidWeapons table.. if ( getPedTotalAmmo ( localPlayer ) == 1 ) then -- Check if the weapon ammo is equal to 1, then.. toggleControl ( "fire", false ) -- Disable the fire control, so the player can no longer fire. end -- End the ammo check end -- End the invalid weapon check end -- End the function ) addEventHandler ( "onClientPlayerWeaponSwitch", localPlayer, -- Add the event handler. function ( ) toggleControl ( "fire", true ) -- Enable the fire control. local weapon = getPedWeapon ( localPlayer ) -- Get the player current weapon. if ( not invalidWeapons [ weapon ] ) then -- If the weapon the player is not in the invalidWeapons table.. if ( getPedTotalAmmo ( localPlayer ) == 1 ) then -- Check if the weapon ammo is equal to 1, then.. toggleControl ( "fire", false ) -- Disable the fire control, so the player can no longer fire. end -- End the ammo check end -- End the invalid weapon check end -- End the function )
-
There's no need to give the weapon back, since you can stop the player from using it again. By the way, "onWeaponFire" will be available in MTA 1.4, it's not available in current versions.
-
No offense, but that doesn't make any sense, and I mean no sense at all.
-
Post what you've tried.
-
local reputations = { [-1095] = "demon", [-795] = "evil", [-10] = "bad2", [-5] = "bad1", [0] = "normal", [5] = "good1", [10] = "good2", [795] = "good3", [1095] = "hero" } -- this function will return the reputation name giving him the reputation points -- i.e getReputationName(-120) will return "evil" function getReputationName( points ) for reppoints, repname in ipairs ( reputations ) do -- loop over all reputations result = repname --stop the loop if the rep from the table is higher than the rep of the player if reppoints > points then return result --we found it, so let's return it end end end -- this function will update the reputation name of the player -- if the player has -120, getElementData on "Reputation.status" will return "evil" function updateReputationName( player ) local repPoints = getElementData(killer, "Reputation.points") or 0 local newRepName = getReputationName( repPoints ) setElementData(player, "Reputation.status", newRepName) end function reputation(ammo, killer, weapon, bodypart) if killer and killer ~= source then --Reputation points of the guy who died local dRPoints = getElementData(source, "Reputation.points") or 0 --Reputation points of the guy who killed him local kRPoints = getElementData(killer, "Reputation.points") or 0 if ( dRPoints < 0 or dRPoints == kRPoints ) then -- the guy who died was a bad guy kRPoints = kRPoints + 5 else --was a good guy kRPoints = kRPoints - 5 end setElementData(killer, "Reputation.points", kRPoints) updateReputationName( killer ) -- update the reputation name for the killer end end addEventHandler( "onPlayerWasted", getRootElement(), reputation) function onLogin (_, account) local defaultPoints = 0 --you can change the default points a guy should have here local defaultRepName = getReputationName( defaultPoints ) --do not modify here setElementData(source, "Reputation.status", getAccountData(account, "rep") or defaultRepName) setElementData(source, "Reputation.points", getAccountData(account, "re.p") or defaultPoints) end addEventHandler ("onPlayerLogin", root, onLogin) function saveData(thePlayer, theAccount) if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "rep", getElementData(thePlayer, "Reputation.status")) setAccountData (theAccount, "re.p", getElementData(thePlayer, "Reputation.points")) end end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end)
-
Remove the "local" infront of "veh".
-
Lo de "bad model specified" quiere decir que el modelo que se especifico es invalido. Lo de "admin security" no es nada que yo sepa.
-
local x, y = guiGetScreenSize ( ) local nev = "" local reason = "" local reasons = { [ "unknown" ] = "Ismeretlen.", [ "quit" ] = "Kilépett.", [ "kicked" ] = "Kirúgva.", [ "banned" ] = "Kitiltva.", [ "bad connection" ] = "Rossz kapcsolat.", [ "timed out" ] = "Idotúllépés.", } function drawCsatlakozas ( ) -- 1411, 228, 269, 84 dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.08, tocolor(0, 0, 0, 125), true) -- 1411, 312, 269, 21 dxDrawRectangle(x*0.83988, y*0.297142, x*0.160119, y*0.02, tocolor(0, 0, 0, 185), true) -- 1411, 228, 269, 21 dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.02, tocolor(245, 140, 20, 200), true) -- 1425, 234, 1680, 244 dxDrawText("Csatlakozás / Kilépés", x*0.848214, y*0.2228571, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) -- 1430, 453, 1680, 244 dxDrawText("CoreGaming", x*0.8511904, y*0.380952, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) -- 1465, 249, 1657, 280 dxDrawText(nev, x*0.872023, y*0.237142, x*0.985, y*0.266666, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) -- 1455, 285, 1675, 302 dxDrawText("csatlakozott a szerverre.", x*0.8660714, y*0.271428, x*0.99702, y*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) end function drawKilepes( ) -- 1411, 228, 269, 110 dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.104761, tocolor(0, 0, 0, 125), true) dxDrawRectangle(x*0.83988, 338, x*0.160119, y*0.02, tocolor(0, 0, 0, 185), true) dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.02, tocolor(245, 140, 20, 200), true) dxDrawText("Csatlakozás / Kilépés", x*0.848214, y*0.2228571, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) -- 1430, 453, 1680, 244 dxDrawText("CoreGaming", x*0.8511904, y*0.430952, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) -- 1465, 249, 1657, 280 dxDrawText(nev, x*0.872023, y*0.237142, x*0.985, y*0.266666, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("lecsatlakozott a szerverrol.", x*0.8660714, y*0.271428, x*0.99702, y*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) -- 1455, 340, 1675, 302 dxDrawText("[ " .. tostring ( reason ) .." ]", x*0.866071, y*0.3238095, x*0.99702, y*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) end addEventHandler ( "onClientPlayerJoin", root, function ( ) nev = getPlayerName ( source ) reason = "" addEventHandler ( "onClientRender", root, drawCsatlakozas ) local sound = playSound ( "bip.wav" ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, drawCsatlakozas ) end ,5000, 1 ) end ) addEventHandler ( "onClientPlayerQuit", root, function ( reason ) removeEventHandler ( "onClientRender", root, drawKilepes ) nev = getPlayerName ( source ) reason = reasons [ reason:lower ( ) ] addEventHandler("onClientRender", root, drawKilepes) local sound = playSound("bip.wav") setTimer ( function ( ) removeEventHandler ( "onClientRender", root, drawKilepes ) end ,5000, 1 ) end )
-
There's an example on the wiki, try to adapt it to your script.
-
You're welcome.
-
Ah, I get it now, well, it depends on how you are planning on making this GUI. To get the wanted level use: getPlayerWantedLevel
-
I guess that you can check everytime when they use the weapon to see if the ammo is 1, then if it is, disable the fire control, and also do the same for when they switch weapons. Events: onClientPlayerWeaponFire onClientPlayerWeaponSwitch Functions: getPedTotalAmmo toggleControl
-
And what is the problem? is this a vehicle spawner script? because if it is, then you must create the vehicle server side, if you don't, players won't be able to use them.
-
addCommandHandler createObject createColTube To create the GUI you can use the "GUIeditor" resource. I didn't get the last part: "Also i would like to have it so if u got 5 stars only 1 2 3 4 5 are showing up and not 1-6 for example."
-
The grid list contains vehicle names or vehicle models?
-
Ah, I just checked your code again to see what was the difference and found it: if ( source == killer ) then I missed that when first checked it
-
Any errors in the debugscript? does it do anything at all?
-
The first argument of onPlayerWasted is the total ammo, so you must change your function arguments to this: function addBlueOnDamage ( totalAmmo, killer )
-
So, you want the admins to play sounds for everyone in the server? if so, use the following functions: addCommandHandler getPlayerAccount getAccountName isObjectInACLGroup triggerClientEvent playSound
-
Try making the whole script server side.
-
Yo diria que el element data "parent" es nil, tenes que verificar que sea un elemento asi no da el error: function setVehiclesFuelPerMinute ( ) for _, veh in ipairs ( getElementsByType ( "vehicle" ) ) do if ( getVehicleEngineState ( veh ) == true ) then local parent = getElementData ( veh, "parent" ) if isElement ( parent ) then if ( getElementData ( parent, "fuel" ) >= 0 ) then setElementData ( parent, "fuel", getElementData ( parent, "fuel" ) - getVehicleFuelRemove ( getElementModel ( veh ), parent ) ) else setVehicleEngineState ( veh, false ) end end end end end
-
You're welcome.