Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. Try to make it by yourself, then post the script if it doesn't work.
  2. Verifica si el jugador que toco el marker es el cliente con: if ( theplayer == localPlayer ) then -- Tu codigo aqui. end
  3. When they spawn, set their nametag color to their team color. onPlayerSpawn getPlayerTeam getTeamColor setPlayerNametagColor
  4. Castillo

    Bots

    You want to make fake players? or bots that actually play?
  5. Seguro que tenes la ultima nightly? Necesitas por lo menos esta version: 1.3.1 r4935.
  6. Porque mezclaste client side y server side, las funciones de GUI son todas client side. Postea tu script completo ( ambas partes: client y server side ).
  7. That's only temporary saver.
  8. -- GUI local resX,resY = guiGetScreenSize() local width,height = 422,217 local X = (resX/2) - (width/2) local Y = (resY/2) - (height/2) window = guiCreateWindow(X,Y,width,height,"Send A Message",false) guiWindowSetSizable(window,false) guiSetVisible(window,false) playerList = guiCreateGridList(10,25,403,109,false,window) guiGridListSetSelectionMode(playerList,2) column = guiGridListAddColumn(playerList,"Players",0.9) ed_msg = guiCreateEdit(89,138,320,38,"",false,window) btn_send = guiCreateButton(9,180,180,28,"Send!",false,window) btn_close = guiCreateButton(209,180,201,28,"Cancel",false,window) lbl_msg = guiCreateLabel(21,147,62,25,"Message:",false,window) guiSetProperty(btn_send,"HoverTextColour","ffffff000") guiSetProperty(btn_close,"HoverTextColour","fff000000") guiLabelSetColor(lbl_msg,0,255,0) guiSetFont(lbl_msg,"default-bold-small") guiEditSetMaxLength(ed_msg,80) -- Open GUI bindKey("h", "down", function ( ) guiSetVisible(window, not guiGetVisible ( window )) showCursor(guiGetVisible ( window )) if ( guiGetVisible ( window ) ) then guiGridListClear ( playerList ) if ( column ) then for id, player in ipairs ( getElementsByType ( "player" ) ) do local row = guiGridListAddRow ( playerList ) local r, g, b = getPlayerNametagColor ( player ) guiGridListSetItemText ( playerList, row, column, getPlayerName ( player ), false, false ) guiGridListSetItemColor ( playerList, row, column, r, g, b ) end end end end ) -- Close Button addEventHandler("onClientGUIClick",btn_close, function () if (source == btn_close) then guiSetVisible(window, false) showCursor(false,false) end end ) -- Send function send() local row, col = guiGridListGetSelectedItem ( playerList ) if ( row and col and row ~= -1 and col ~= -1 ) then local who = guiGridListGetItemText ( playerList, row, 1 ) local msg = tostring(guiGetText(ed_msg)) if ( msg == "" ) then ouputChatBox ( "Error: You need to enter a message.",255,0,0 ) else outputChatBox("Message sent to "..who,0,255,255) end end end addEventHandler("onClientGUIClick",btn_send,send,false)
  9. Castillo

    Ayuda

    Hay muchos, aca te dejo algunos: https://community.multitheftauto.com/ind ... ls&id=1479 https://community.multitheftauto.com/ind ... ls&id=5430 https://community.multitheftauto.com/ind ... ls&id=1484 No se si alguno de esos los mutea, pero algunos remplazan la palabra por otra.
  10. I remember when I used account data long ago, I stored weapons as JSON string, it ended cutting the string because of limit.
  11. Usan al ultima version del MTA ( una nightly build ).
  12. local pickups = { [1]={ 2060.7685546875, -1941.1181640625, 13.14103603363 }, [2]={ 2114.5068359375, -1611.302734375, 13.167269706726 }, [3]={ 1932.9521484375, -1776.1259765625, 13.16081237793 }, [4]={ 1057.41796875, -1568.4853515625, 13.166387557983 } } local dropoffss = { [1]={ 1965.54296875 , -1883.013671875, 13.160305023193 }, [2]={ 1467.3916015625, -1736.419921875, 13.242918014526 }, [3]={ 2376.1064453125, -1728.4091796875, 13.162055015564 }, [4]={ 1066.5029296875, -1200.86328125, 18.405519485474 } } local pedCus = { [1]={ 9 }, [2]={ 10 }, [3]={ 14 }, [4]={ 15 }, [5]={ 37 } } Teame = createTeam("Taxi Driver", 0, 255, 0) taxiTeams = { [Teame] = true } taxiVehs = { [420] = true } function teamSet ( ) local team = getTeamFromName ( "Taxi Driver" ) if team then setPlayerTeam ( source, team ) setPlayerNametagColor ( source, 0, 255, 0 ) setElementModel(source, 57) outputChatBox("You are now employed as a Taxi Driver!", thePlayer) else local teamw = getTeamFromName ( "Taxi Driver" ) if teamw then cancelEvent() outputChatBox("You are already a Taxi driver!", source) end end end addEvent ( "sTeame", true) addEventHandler ( "sTeame", root, teamSet ) function enterVehicle ( thePlayer, seat, jacked ) -- when a player enters a vehicle if getElementType ( thePlayer ) == "player" then if ( taxiVehs[getElementModel ( source )] ) and ( not taxiTeams[getPlayerTeam( thePlayer )] ) then -- if the vehicle is one of 4 police cars, and the skin is not a police skin removePedFromVehicle( thePlayer )-- force the player out of the vehicle outputChatBox("Only Taxi Drivers can drive this vehicle!", thePlayer) end end end addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) markers = { } blips = { } peds = { } function startJob ( thePlayer ) local x, y, z = unpack ( pickups [ math.random ( #pickups ) ] ) markers [ thePlayer ] = createMarker ( x, y, z, "cylinder", 5.0, 255, 0, 0, 0 ) local skins = unpack ( pedCus [ math.random ( #pedCus ) ] ) peds [ thePlayer ] = createPed( skins, x, y, z ) blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) addEventHandler ( "onMarkerHit", markers [ thePlayer ], warpit ) end function inVEH ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then if ( getElementModel ( source ) == 420 ) then startJob ( thePlayer ) end end end addEventHandler ( "onVehicleEnter", getRootElement(), inVEH ) function warpit ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then local vehicle = getPedOccupiedVehicle ( thePlayer ) if ( getElementModel ( vehicle ) == 420 ) then setTimer ( warpPedIntoVehicle, 2000, 1, peds [ thePlayer ], vehicle, 2 ) destroyJob ( thePlayer ) local x, y, z = unpack ( dropoffss [ math.random ( #dropoffss ) ] ) markers [ thePlayer ] = createMarker ( x, y, z - 1, "cylinder", 5.0, 255, 0, 0, 50 ) blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) addEventHandler ( "onMarkerHit", markers [ thePlayer ], pickmeup ) end end end function pickmeup ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then givePlayerMoney ( thePlayer, 500 ) outputChatBox ( "You have earned $500!", thePlayer, 255, 124, 0 ) destroyJob ( thePlayer ) setTimer ( function ( ) if ( isElement ( peds [ thePlayer ] ) ) then destroyElement ( peds [ thePlayer ] ) end startJob ( thePlayer ) end ,3000, 1 ) end end function deleteOnExit ( thePlayer ) if ( isElement ( markers [ thePlayer ] ) ) then destroyElement ( markers [ thePlayer ] ) end if ( isElement ( blips [ thePlayer ] ) ) then destroyElement ( blips [ thePlayer ] ) end if ( isElement ( peds [ thePlayer ] ) ) then destroyElement ( peds [ thePlayer ] ) end end addEventHandler ( "onVehicleExit", getRootElement(), deleteOnExit ) function destroyJob ( thePlayer ) if ( isElement ( markers [ thePlayer ] ) ) then destroyElement ( markers [ thePlayer ] ) end if ( isElement ( blips [ thePlayer ] ) ) then destroyElement( blips [ thePlayer ] ) end end
  13. Castillo

    Help Grid

    Ok, that was what I was going to suggest.
  14. Not really what I meant, no. chat_range = 100 addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"u","down","chatbox","localchat") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"u","down","chatbox","localchat") end end) function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChat(player,_,...) local px,py,pz = getElementPosition(player) local msg = table.concat({...}, " ") local nick = getPlayerName(player) local r,g,b = getTeamColor(getPlayerTeam(player)) if ( isPlayerMuted ( player ) ) then return end for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("(Local) "..nick..":#FFFFFF "..msg,v,r,g,b,true) end triggerEvent ( "onLocalChatMessage", v, player, msg ) end end addCommandHandler("localchat",onChat)
  15. When they try to send a message, check if they are muted with: isPlayerMuted
  16. Castillo

    Help Grid

    Is that your whole script?
  17. Castillo

    Help Grid

    The grid list got created?
  18. Castillo

    Help Grid

    What do you mean that you get "nil value"?
  19. You can update the text when the element data of the FPS resource changes I think, or make something else to update it.
  20. Well, you can download a FPS script, create a new text above the map name, and use the FPS script you downloaded to update it.
  21. function teamSet ( ) local team = getTeamFromName ( "Taxi Driver" ) if team then setPlayerTeam ( source, team ) setPlayerNametagColor ( source, 0, 255, 0 ) setElementModel(source, 57) outputChatBox("You are now employed as a Taxi Driver!", thePlayer) else local teamw = getTeamFromName ( "Taxi Driver" ) if teamw then cancelEvent() outputChatBox("You are already a Taxi driver!", source) end end end addEvent ( "sTeame", true) addEventHandler ( "sTeame", root, teamSet ) function enterVehicle ( thePlayer, seat, jacked ) -- when a player enters a vehicle if getElementType ( thePlayer ) == "player" then if ( taxiVehs[getElementModel ( source )] ) and ( not taxiTeams[getPlayerTeam( thePlayer )] ) then -- if the vehicle is one of 4 police cars, and the skin is not a police skin removePedFromVehicle( thePlayer )-- force the player out of the vehicle outputChatBox("Only Taxi Drivers can drive this vehicle!", thePlayer) end end end addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) markers = { } blips = { } peds = { } function startJob ( thePlayer ) local x, y, z = unpack ( pickups [ math.random ( #pickups ) ] ) markers [ thePlayer ] = createMarker ( x, y, z, "cylinder", 3.5, 255, 0, 0 ) local skins = unpack ( pedCus [ math.random ( #pedCus ) ] ) peds [ thePlayer ] = createPed( skins, x, y, z ) blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) addEventHandler ( "onMarkerHit", markers [ thePlayer ], warpit ) end function inVEH ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then if ( getElementModel ( source ) == 420 ) then startJob ( thePlayer ) end else if ( isElement ( markers [ thePlayer ] ) ) then destroyElement ( markers [ thePlayer ] ) end if ( isElement ( blips [ thePlayer ] ) ) then destroyElement( blips [ thePlayer ] ) end end end addEvent("onVehicleEnter", true) addEventHandler ( "onVehicleEnter", getRootElement(), inVEH ) function warpit ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then local vehicle = getPedOccupiedVehicle ( thePlayer ) if ( getElementModel ( vehicle ) == 420 ) then warpPedIntoVehicle ( peds [ thePlayer ], vehicle, 2 ) dropoff ( thePlayer ) end end end function dropoff ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then local vehiclee = getPedOccupiedVehicle ( thePlayer ) if ( getElementModel ( vehiclee ) == 420 ) then local x, y, z = unpack ( dropoffss [ math.random ( #dropoffss ) ] ) markers [ thePlayer ] = createMarker ( x, y, z - 1, "cylinder", 3.5, 255, 0, 0, 50 ) blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) addEventHandler ( "onMarkerHit", markers [ thePlayer ], pickmeup ) end end end function pickmeup( thePlayer ) if ( isElement ( markers [ thePlayer ] ) ) then destroyElement ( markers [ thePlayer ] ) end if ( isElement ( blips [ thePlayer ] ) ) then destroyElement( blips [ thePlayer ] ) end givePlayerMoney( thePlayer, 500 ) setTimer(destroyElement, 3000, 1, peds [ thePlayer ]) setTimer(outputChatBox, 1000, 1, "Customer : Thank you very much!", thePlayer) setTimer(outputChatBox, 1000, 1, "You have eaerned $500!", thePlayer, 255, 124, 0) triggerEvent("nowLie", getRootElement()) end function deleteOnExit( thePlayer ) if ( isElement ( markers [ thePlayer ] ) ) then destroyElement ( markers [ thePlayer ] ) end if ( isElement ( blips [ thePlayer ] ) ) then destroyElement( blips [ thePlayer ] ) end if ( isElement ( peds [ thePlayer ] ) ) then destroyElement( peds [ thePlayer ] ) end end addEventHandler("onVehicleExit", getRootElement(), deleteOnExit)
×
×
  • Create New...