Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. function nextmap(source,cmd,...) nextmapname = table.concat({...}," ") nextmap = nil for k,v in ipairs(getResources()) do local name = getResourceInfo(v,'name') if name == nextmapname then nextmap = v end end if nextmap then outputChatBox("Nextmap set to "..getResourceName(nextmap),source) end end addCommandHandler("nm",nextmap) addEvent("onGamemodeMapStop") addEventHandler("onGamemodeMapStop",root,function() if (nextmap) then local map = nextmap startResource(map) nextmap = nil end end )
  2. I'm afraid you can't, I think it was "fixed", even when I wouldn't call this a bug .
  3. copVehicles = { [523]=true,[598]=true,[596]=true,[597]=true,[599]=true } copTeams = {["Team"]=true,["Team2"]=true} function copenterVehicle ( player, seat, jacked ) if ( copVehicles[getElementModel ( source )] ) and ( not copTeams[getTeamName(getPlayerTeam( player ))] ) and ( seat == 0 ) then removePedFromVehicle ( player )--force the player out of the vehicle outputChatBox ( "You aren't a Police Officer , you mayn't drive this.", player ) --and tell the player why end end addEventHandler ( "onVehicleEnter", getRootElement(), copenterVehicle )
  4. Yes, but after you said that, I fixed the error, then he got confused I guess.
  5. Who's asking for help? you or me? if you remove it, it won't make any error. P.S: I'm sure you added the ")" because Cadu12 said so, right?
  6. You have an extra ")" in line 2, remove it.
  7. brad, I think you should use the Spanish section, most times we don't get your problem/question.
  8. Meh, I don't think offering 1 dollar will get you someone.
  9. Castillo

    question

    But, that won't go of screen? because when there are about 50 ( or less ) players, the rectangle will be too big, I think you'll need a kind of scroll panel.
  10. I added the missing variables. local rx, ry, rz = getElementRotation(value)
  11. I think he's talking about the ranking board, when you die your name is added with the time you survived( I think ), if you want to get this colored, then you'll need to make some changes, first, convert the way it works to DX drawing, because right now I think it uses GUI. There's a function in the forums called dxDrawColorText, search for it.
  12. You haven't got these variables at all, that's why the error. I guess rx, ry, rz is the element rotation. local chatting = 0 local chatters = { } function checkForChat() local recon = getElementData(getLocalPlayer(), "reconx") if not (reconx) then if (isChatBoxInputActive() and chatting==0) then chatting = 1 triggerServerEvent("chat1", getLocalPlayer()) elseif (not isChatBoxInputActive() and chatting==1) then chatting = 0 triggerServerEvent("chat0", getLocalPlayer()) end end end setTimer(checkForChat, 100, 0) function addChatter() for key, value in ipairs(chatters) do if ( value == source ) then return end end table.insert(chatters, source) end addEvent("addChatter", true) addEventHandler("addChatter", getRootElement(), addChatter) function delChatter() for key, value in ipairs(chatters) do if ( value == source ) then table.remove(chatters, key) end end end addEvent("delChatter", true) addEventHandler("delChatter", getRootElement(), delChatter) addEventHandler("onClientPlayerQuit", getRootElement(), delChatter) function render() local x, y, z = getElementPosition(getLocalPlayer()) local reconx = getElementData(getLocalPlayer(), "reconx") for key, value in ipairs(chatters) do if (isElement(value)) then if getElementType(value) == "player" then local px, py, pz = getPedBonePosition(value, 6) local dist = getDistanceBetweenPoints3D(x, y, z, px, py, pz) if isElementOnScreen(value) and not getElementData(value, "reconx") and not getElementData(value, "freecam:state") then if (dist>25) then chatters[value] = nil return end local lx, ly, lz = getCameraMatrix() local vehicle = getPedOccupiedVehicle(value) local rx, ry, rz = getElementRotation(value) local collision, cx, cy, cz, element = processLineOfSight(lx, ly, lz, rx, ry, rz+1, true, true, true, true, false, false, true, false, vehicle or value) if not (collision) or (reconx) then local screenX, screenY = getScreenFromWorldPosition(px, py, pz+0.5) if (screenX and screenY) then dist = dist / 5 if (dist<1) then dist = 1 end if (dist>4 and reconx) then dist = 4 end local offset = 70 / dist local draw = dxDrawImage(screenX, screenY, 60 / dist, 60 / dist, "chat.png") end end end else chatters[key] = nil end else chatters[key] = nil end end end addEventHandler("onClientRender", getRootElement(), render) chaticon = true function toggleChatIcon() if (chaticon) then triggerServerEvent("chaticon0", getLocalPlayer()) outputChatBox("Chat icons are now disabled.", 255, 0, 0) chaticon = false removeEventHandler("onClientRender", getRootElement(), render) else triggerServerEvent("chaticon1", getLocalPlayer()) outputChatBox("Chat icons are now enabled.", 0, 255, 0) chaticon = true addEventHandler("onClientRender", getRootElement(), render) end end addCommandHandler("togglechaticons", toggleChatIcon, false) addCommandHandler("togchaticons", toggleChatIcon, false)
  13. No point in putting another mirror, I already posted one. P.S: It does work, I use it, but you have to change the encoding to UTF-8 without BOM.
  14. Nice work, if you get a way to replace PED's I'll love you .
  15. You are using 'vehicle' argument, but the player will not be always in one, so you should do this instead: local collision, cx, cy, cz, element = processLineOfSight(lx, ly, lz, rx, ry, rz+1, true, true, true, true, false, false, true, false, vehicle or player)
  16. function toggleGGun(player) if exports.global:isPlayerAdmin(player) then local on = not exports.gravity_gun:isGravityGunEnabled(player) exports.gravity_gun:togglePlayerGravityGun(player,on) outputChatBox("gravity gun "..(on and "on" or "off"),player) else outputChatBox("You don't have permission to use this command.", player, 255, 194, 14) end end addCommandHandler("ggun",toggleGGun) Try with that.
  17. Castillo

    Problems

    outputChatBox client side does not require a player argument.
  18. TAPL, would be nice if you could stop posting off-topic, everything has a risk, if you post it here, someone else could take the code without help, but others may help you.
  19. MTA 1.1 is the latest release, why wouldn't you use it? it has a lot of bug fixes, new functions/events, I see no point in using the old version. P.S: Most servers already moved to 1.1, sooner or later 1.0.5 will have no servers/players at all.
  20. I'm not sure if Basemode has events for map finishing.
  21. Link: http://www.mediafire.com/?5et60em7mog3yms
  22. Para usar un "else" necesitas primero un "if", y con cada "if" necesitas un "end" al final de la funcion, dejo un ejemplo abajo. function prueba(pl,cmd,arg) if arg then outputChatBox("As introducido ".. tostring(arg) ..".",pl,0,255,0) else outputChatBox("Ningun argumento introducido.",pl,255,0,0) end end addCommandHandler("probar",prueba) ipairs y pairs se usan en los "for" loops. Los loops son para cuando tienes una tabla para buscar los datos de ella usas un loop. Ejemplo para enviar al chatbox los nombres de los jugadores online. function jugadores(pl,cmd) for indice, jugador in pairs(getElementsByType("player")) do -- getElementsByType("player") es una tabla con los jugadores online. outputChatBox(getPlayerName(jugador)) end end addCommandHandler("jugadores",jugadores)
  23. Ese error significa que la funcion no existe, estoy seguro de que pusiste el script como server side (como dijo Edikosh), anda al meta.xml y cambia type="server" a type="client".
×
×
  • Create New...