-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
Eso es porque n otenes que poner updateText... ese es el nombre de la funcion, tenes que poner solamente: texto.
-
'n' how you gon' prove that? Get yo' facts strait mane. Pretty sure you sayin dis cus u wanna know how he made it uh-uh know what am sayin How to prove it? how about with A Concerned Citizen's idea?
-
local mutedSerials = { } function muteSomeone ( player, cmd, target, time, ... ) local reason = table.concat ( { ... }, " " ) if ( target and reason and time ) then local target = getPlayerFromNamePart ( target ) if ( not isElement ( target ) ) then outputChatBox ( "There is no player with this name", player, 255, 255, 0 ) return end local time = tonumber ( time ) if ( time and time >= 1 and not isPlayerMuted ( target ) ) then local milliseconds = math.floor ( time * 60000 ) outputChatBox ( getPlayerName ( target ) .." has been muted for ".. tostring ( time ) .." minutes (".. reason ..") .", root, 255, 0, 0 ) setPlayerMuted ( target, true ) local timer = setTimer ( unMute, milliseconds, 1, target ) mutedSerials [ getPlayerSerial ( target ) ] = { milliseconds, timer } else outputChatBox ( "Syntax: /mmute player reason time and player cannot be muted", player, 255, 255, 0 ) end end end addCommandHandler ( "mmute", muteSomeone ) function getPlayerFromNamePart(name) if name then for i, player in ipairs(getElementsByType("player")) do if string.find(getPlayerName(player):lower(), tostring(name):lower(), 1, true) then return player end end end return false end function afterreconnect ( local serial = getPlayerSerial ( source ) local muted = mutedSerials [ serial ] if ( type ( muted ) == "table" ) then if ( muted [ 1 ] ) then setPlayerMuted ( source, true ) local timer = setTimer ( unMute, muted [ 1 ], 1, source ) mutedSerials [ serial ] [ 2 ] = timer return end end setPlayerMuted ( source, false ) end addEventHandler ( "onPlayerJoin", getRootElement(), afterreconnect ) addEventHandler ( "onPlayerQuit", root, function ( ) local serial = getPlayerSerial ( source ) local muted = mutedSerials [ serial ] if ( type ( muted ) == "table" ) then if isTimer ( muted [ 2 ] ) then killTimer ( muted [ 2 ] ) end end end ) function unMute ( thePlayer ) if isElement ( thePlayer ) then setPlayerMuted ( thePlayer, false ) mutedSerials [ getPlayerSerial ( thePlayer ) ] = nil outputChatBox ( "You have been unmuted.", thePlayer, 0, 255, 0 ) end end That should fix the 3 problems.
-
It could still be a weapon mod as the guy above said.
-
Defini una variable con el texto y cada X tiempo cambias la variable.
-
Es joda eso? estas agregando el event handler cada 0.1 segundo.
-
And this is on MTA? because there are some mods which does it on the single player ( if I'm right ), so, maybe post with proof of being in MTA?
-
Como estas ejecutando "texto1"?
-
You have to first clear the gridlist, then when it finds a match, add a new row.
-
Eh... why are you getting the selected item?
-
local Line1 = createColCircle ( 1800.2021484375, 1714.71691, 1000) local timers = { } function Destroy( element ) local Speed = getElementSpeed( element ) if getElementType ( element ) == "vehicle" then if Speed == 0 then destroyElement( element ) end end end function DSC( element ) if source == Line1 then if getElementType ( element ) == "vehicle" then if ( isElementWithinColShape( element, source ) ) then timers [ element ] = setTimer ( Destroy , 10000, 0, element ) end end end end addEventHandler ( "onColShapeHit", resourceRoot, DSC ) function DSCDT ( thePlayer ) if source == Line1 then if isTimer ( timers [ thePlayer ] ) then killTimer ( timers [ thePlayer ] ) end end end addEventHandler ( "onColShapeLeave", resourceRoot, DSCDT ) function getElementSpeed(element,unit) if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.8 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end
-
What's the problem of using tables? is not hard.
-
Use the event: onClientGUIChanged then, loop all the items of the grid list and see if any has part of the string entered on the edit box ( guiGetText ).
-
If you set the timer to local, then you won't be able to kill it, because it won't exist outside of that function. Also, you'll need to use a table to store timers.
-
You are defining the function after you set the element data.
-
The spaces have nothing to do with that, the code I posted has to work.
-
You messed it up, there's no need for guiGetText, and you had to define x, y, z from getElementPosition. function tele ( ) local x, y, z = getElementPosition ( localPlayer ) guiSetText ( myEdit2, x ) guiSetText ( myEdit3, y ) guiSetText ( myEdit4, z ) end addEventHandler ( "onClientGUIClick", myButton2, tele, false ) Also, is "localPlayer" not "localplayer".
-
function spawnPlayer(x, y, z, player) spawnPlayer(player, x, y, z) end addEvent("spawnPlayer", true) addEventHandler("spawnPlayer", getRootElement(), spawnPlayer) There's the problem, you named the function the same as the native one you are using, so, is executing over and over again. Rename it, like this: function spawnPlayer_(x, y, z, player) spawnPlayer(player, x, y, z) end addEvent("spawnPlayer", true) addEventHandler("spawnPlayer", getRootElement(), spawnPlayer_)
-
You're welcome.
-
No need for loops. function makeList() local file = xmlLoadFile("spawnpoints.xml") if file then for _, spawns in ipairs (xmlNodeGetChildren(file)) do local row = guiGridListAddRow(glistMainList) local name = xmlNodeGetAttribute(spawns, "name") local x = xmlNodeGetAttribute(spawns, "x") local y = xmlNodeGetAttribute(spawns, "y") local z = xmlNodeGetAttribute(spawns, "z") guiGridListSetItemText(glistMainList, row, 1, name, false, false) guiGridListSetItemData(glistMainList, row, 1, {x, y, z}) end xmlUnloadFile(file) end end function spawnHandler(button, state) if button == "left" and state == "up" then local row, col = guiGridListGetSelectedItem(glistMainList) local data = guiGridListGetItemData(glistMainList, row, col) if row and col and row ~= -1 and col ~=-1 then local x, y, z = unpack ( data ) outputChatBox(x) outputChatBox(y) outputChatBox(z) end end end
-
local msgs = { 'noob', 'murio', 'diee!' } function playerDied ( totalAmmo, killer, killerWeapon, bodypart ) local text = msgs [ math.random ( 1, #msgs ) ] outputChatBox ( getPlayerName ( source ) .. text, root, 255, 255, 255, true ) end addEventHandler ( "onPlayerWasted", getRootElement(), playerDied )
-
Get the selected item with guiGridListGetSelectedItem, then use guiGridListGetItemData.
-
You can unpack the table stored on the grid list. unpack