Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. That's how "freecam" works.
  2. You mean fly around like spectating? if so, you can use the resource: "freecam".
  3. You can just create the ped client side, noone else but the client will see it.
  4. Castillo

    Health kit

    There's no function to create a weapon like the default ones, I guess you can do it via scripting.
  5. -- client side: guiGridListGetSelectedItem guiGridListGetItemText -- server side: getPlayerFromName getPlayerAccount getAccountName
  6. addEventHandler ( "onClientResourceStart", resourceRoot, function ( ) GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Grid = {} Panel = guiCreateWindow(138,146,499,282,"Panel",false) GUIEditor_Grid[1] = guiCreateGridList(363,59,127,195,false,Faction) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) guiGridListAddColumn(GUIEditor_Grid[1],"Players in F",0.5) Players = guiCreateGridList(9,58,127,196,false,Faction) guiGridListSetSelectionMode(Players,2) guiGridListAddColumn(Players,"Players",0.5) Add = guiCreateButton(177,60,135,49,"Add Player",false,Faction) Remove = guiCreateButton(174,132,142,51,"Remove Player",false,Faction) Leader = guiCreateButton(173,203,145,48,"Give Leader",false,Faction) addEventHandler ( "onClientGUIClick", Add, STARS, false ) -- El evento tiene que ir dentro de esta funcion. loadPlayers ( ) end ) function addP ( ) guiSetVisible ( Panel, true ) showCursor ( true ) end addCommandHandler("AFP",addP) function closePanel ( ) if guiGetVisible ( Panel ) then guiSetVisible ( Panel, false ) showCursor ( false ) end end addCommandHandler ( "CFP", closePanel ) function STARS ( ) triggerServerEvent ( "addST", localPlayer, accountName ) end function loadPlayers ( ) guiGridListClear ( Players ) for index, player in ipairs ( getElementsByType ( "player" ) ) do guiGridListSetItemText ( Players, guiGridListAddRow ( Players ), 1, tostring ( getPlayerName ( player ) ), false, false ) end end addEventHandler ( "onClientPlayerJoin", root, loadPlayers ) addEventHandler ( "onClientPlayerQuit", root, loadPlayers ) addEventHandler ( "onClientPlayerChangeNick", root, loadPlayers ) Mira el comentario que hice. P.D: Para que esto funcione, vas a tener que enviar el nombre del jugador al server side y ahi obtener el jugador y luego su cuenta.
  7. "accountName " no esta definido en ninguna parte ( client side ).
  8. Castillo

    Health kit

    I never heard of such thing, although I could be wrong.
  9. Castillo

    Guimecanico

    Eso es porque la GUI aun no se creo. function AsdfAbsd () Panel = guiCreateWindow(749,180,617,462,"Gui de mecanico",false) guiSetAlpha(Panel,0.69999998807907) guiWindowSetMovable(Panel,true) guiWindowSetSizable(Panel,false) Repair = guiCreateButton(12,29,84,39,"Reparar",false,Panel) addEventHandler ( "onClientGUIClick", Repair, RepararVehiculo, false ) guiSetAlpha(Repair,0.69999998807907) guiSetFont(Repair,"default-bold-small") Chapa1 = guiCreateButton(115,29,84,39,"Chapa1",false,Panel) addEventHandler ( "onClientGUIClick", Chapa1, Cambiarpintura1, false ) guiSetAlpha(Chapa1,0.69999998807907) guiSetFont(Chapa1,"default-bold-small") Chapa2 = guiCreateButton(216,30,84,39,"Chapa2",false,Panel) addEventHandler ( "onClientGUIClick", Chapa2, Cambiarpintura2, false ) guiSetAlpha(Chapa2,0.69999998807907) guiSetFont(Chapa2,"default-bold-small") Chapa3 = guiCreateButton(322,30,84,39,"Chapa3",false,Panel) addEventHandler ( "onClientGUIClick", Chapa3, Cambiarpintura3, false ) guiSetAlpha(Chapa3,0.69999998807907) guiSetFont(Chapa3,"default-bold-small") Cerrar = guiCreateButton(140,407,84,42,"Cerrar",false,Panel) addEventHandler ( "onClientGUIClick", Cerrar, Exit, false ) guiSetFont(Cerrar,"default-bold-small") Info = guiCreateMemo(436,24,172,428,"Informacion de precios\n\nReparar = 100$\nChapas = 250$\nNitrox10 = 750$",false,Panel) guiSetAlpha(Info,0.69999998807907) Sopiler = guiCreateButton(12,88,84,39,"Nitrox10",false,Panel) guiSetAlpha(Sopiler,0.69999998807907) guiSetFont(Sopiler,"default-bold-small") addEventHandler ( "onClientGUIClick", Sopiler, Sopiler1, false ) Saltoar = guiCreateButton(114,88,84,39,"Hydraulics",false,Panel) guiSetFont(Saltoar,"default-bold-small") guiSetAlpha(Saltoar,0.69999998807907) addEventHandler ( "onClientGUIClick", Saltoar, Salto, false ) Rued = guiCreateButton(216,88,84,39,"Ruedas",false,Panel) guiSetFont(Rued,"default-bold-small") guiSetAlpha(Rued,0.69999998807907) addEventHandler ( "onClientGUIClick", Rued, RuedasPanel, false ) Pita = guiCreateButton(322,88,84,39,"Tunning",false,Panel) guiSetFont(Pita,"default-bold-small") guiSetAlpha(Pita,0.69999998807907) addEventHandler ( "onClientGUIClick", Pita, Tunninga, false ) end function guiToggleVisible ( ) if ( not isElement ( Panel ) ) then AsdfAbsd ( ) else guiSetVisible ( Panel, not guiGetVisible ( Panel ) ) end end addEvent( "onAbrirmierda", true ) addEventHandler( "onAbrirmierda", getRootElement(), guiToggleVisible) function RepararVehiculo () triggerServerEvent("onFix", getLocalPlayer()) end function Cambiarpintura1 () triggerServerEvent("onPintura", getLocalPlayer()) end function Cambiarpintura2 () triggerServerEvent("onPintura2", getLocalPlayer()) end function Cambiarpintura3 () triggerServerEvent("onPintura3", getLocalPlayer()) end function Exit () guiSetVisible (Panel, not guiGetVisible ( Panel ) ) end function Sopiler1 () player = localPlayer local price_nitro10x = 0 money = getPlayerMoney (source) if (money >= price_nitro10x) and getPedOccupiedVehicle(player) then outputChatBox ("Instalo un nitro x10 en el coche", 255, 255, 255, true) takePlayerMoney(price_nitro10x) addVehicleUpgrade( getPedOccupiedVehicle(player), 1010 ) end end function Salto () player = localPlayer local price_hydraulics = 0 money = getPlayerMoney (source) if (money >= price_hydraulics) and getPedOccupiedVehicle(player) then takePlayerMoney(price_hydraulics) addVehicleUpgrade( getPedOccupiedVehicle(player), 1087 ) elseif not getPedOccupiedVehicle(player) then outputChatBox("You should be in a vehicle.", 255, 0, 0) end end function RuedasPanel() PanelRuedas = guiCreateWindow(290,201,357,410,"Ruedas",false) Rueda1 = guiCreateButton(13,30,67,36,"1",false,PanelRuedas) addEventHandler ( "onClientGUIClick", Rueda1, Ruedaa1, false ) Rueda2 = guiCreateButton(100,30,67,36,"2",false,PanelRuedas) addEventHandler ( "onClientGUIClick", Rueda2, Ruedaa2, false ) Rueda3 = guiCreateButton(183,30,67,36,"3",false,PanelRuedas) addEventHandler ( "onClientGUIClick", Rueda3, Ruedaa3, false ) Rueda5 = guiCreateButton(15,82,67,36,"5",false,PanelRuedas) addEventHandler ( "onClientGUIClick", Rueda5, Ruedaa5, false ) Rueda8 = guiCreateButton(271,83,67,36,"8",false,PanelRuedas) addEventHandler ( "onClientGUIClick", Rueda8, Ruedaa8, false ) Rueda7 = guiCreateButton(184,82,67,36,"7",false,PanelRuedas) addEventHandler ( "onClientGUIClick", Rueda7, Ruedaa7, false ) Rueda6 = guiCreateButton(100,82,67,36,"6",false,PanelRuedas) addEventHandler ( "onClientGUIClick", Rueda6, Ruedaa6, false ) Rueda4 = guiCreateButton(271,29,67,36,"4",false,PanelRuedas) addEventHandler ( "onClientGUIClick", Rueda4, Ruedaa4, false ) Rueda12 = guiCreateButton(271,129,67,36,"12",false,PanelRuedas) addEventHandler ( "onClientGUIClick", Rueda12, Ruedaa12, false ) Rueda11 = guiCreateButton(183,128,67,36,"11",false,PanelRuedas) addEventHandler ( "onClientGUIClick", Rueda11, Ruedaa11, false ) Rueda10 = guiCreateButton(99,129,67,36,"10",false,PanelRuedas) addEventHandler ( "onClientGUIClick", Rueda10, Ruedaa10, false ) Rueda9 = guiCreateButton(13,130,67,36,"9",false,PanelRuedas) addEventHandler ( "onClientGUIClick", Rueda9, Ruedaa9, false ) Rueda13 = guiCreateButton(132,193,67,36,"13",false,PanelRuedas) addEventHandler ( "onClientGUIClick", Rueda13, Ruedaa13, false ) Salirr = guiCreateButton(58,314,223,53,"X",false,PanelRuedas) addEventHandler ( "onClientGUIClick", Salirr, Salir, false ) end function Ruedaa1() triggerServerEvent("onRuedaa1", getLocalPlayer()) end function Ruedaa2() triggerServerEvent("onRuedaa2", getLocalPlayer()) end function Ruedaa3() triggerServerEvent("onRuedaa3", getLocalPlayer()) end function Ruedaa5() triggerServerEvent("onRuedaa5", getLocalPlayer()) end function Ruedaa8() triggerServerEvent("onRuedaa8", getLocalPlayer()) end function Ruedaa7() triggerServerEvent("onRuedaa7", getLocalPlayer()) end function Ruedaa6() triggerServerEvent("onRuedaa6", getLocalPlayer()) end function Ruedaa4() triggerServerEvent("onRuedaa4", getLocalPlayer()) end function Ruedaa12() triggerServerEvent("onRuedaa12", getLocalPlayer()) end function Ruedaa11() triggerServerEvent("onRuedaa11", getLocalPlayer()) end function Ruedaa10() triggerServerEvent("onRuedaa10", getLocalPlayer()) end function Ruedaa9() triggerServerEvent("onRuedaa9", getLocalPlayer()) end function Ruedaa13() triggerServerEvent("onRuedaa13", getLocalPlayer()) end function Salir() guiSetVisible (PanelRuedas, not guiGetVisible ( PanelRuedas ) ) end function Tunninga () Tunning = guiCreateWindow(579,243,414,443,"Tunning",false) Spoliers = guiCreateLabel(60,28,274,23,"Spoilers",false,Tunning) guiLabelSetColor(Spoliers,255,0,0) guiLabelSetVerticalAlign(Spoliers,"center") guiLabelSetHorizontalAlign(Spoliers,"center",false) guiSetFont(Spoliers,"default-bold-small") S1 = guiCreateButton(33,53,57,26,"1",false,Tunning) addEventHandler ( "onClientGUIClick", S1, SP1, false ) S2 = guiCreateButton(297,52,57,26,"3",false,Tunning) addEventHandler ( "onClientGUIClick", S2, SP2, false ) S3 = guiCreateButton(169,53,57,26,"2",false,Tunning) addEventHandler ( "onClientGUIClick", S3, SP3, false ) Respiradores = guiCreateLabel(25,93,344,24,"Respiraderos",false,Tunning) guiLabelSetColor(Respiradores,255,0,0) guiLabelSetVerticalAlign(Respiradores,"center") guiLabelSetHorizontalAlign(Respiradores,"center",false) guiSetFont(Respiradores,"default-bold-small") R1 = guiCreateButton(34,129,57,26,"1",false,Tunning) R2 = guiCreateButton(125,128,57,26,"2",false,Tunning) R3 = guiCreateButton(312,128,57,26,"4",false,Tunning) R4 = guiCreateButton(226,128,57,26,"3",false,Tunning) Cerradura = guiCreateButton(226,250,57,26,"Cerrar",false,Tunning) addEventHandler ( "onClientGUIClick", Cerradura, Colse, false ) end function Colse ( ) guiSetVisible ( Tunning, not guiGetVisible ( Tunning ) ) end function SP1 ( ) triggerServerEvent ( "onSSP1", getLocalPlayer() ) end function SP2 ( ) triggerServerEvent ( "onSSP2", getLocalPlayer() ) end function SP3 ( ) triggerServerEvent ( "onSSP3", getLocalPlayer() ) end
  10. Castillo

    Guimecanico

    function Coches ( thePlayer ) if exports.factions:isPlayerInFaction ( thePlayer, 2 ) then triggerClientEvent ( thePlayer, "onAbrirmierda", thePlayer ) end end addCommandHandler ( "guimecanico",Coches)
  11. Castillo

    Guimecanico

    Creas el comando server side, ahi checkeas si esta en la faccion, luego usas triggerClientEvent para mostrar el GUI.
  12. Castillo

    Guimecanico

    Porque la funcion esa es server side, no client side.
  13. Castillo

    play Sound

    You're welcome.
  14. Castillo

    play Sound

    You should set the URL as item data. local sTations = { { "Power 181", "http://www.181.fm/asx.php?station=181-uktop40&style=&a..scription=" }, } addEventHandler( "onClientResourceStart", getRootElement( ), function ( ) for i, n in pairs ( sTations ) do local row = guiGridListAddRow ( stationGridList ) guiGridListSetItemText ( stationGridList, row, column, n [ 1 ], false, false ) guiGridListSetItemData ( stationGridList, row, column, n [ 2 ], false, false ) end end ) function test ( ) local statioURL = guiGridListGetItemData ( stationGridList, guiGridListGetSelectedItem ( stationGridList ), 1 ) playSound ( stationURL ) end addEventHandler ( "onClientGUIClick", player, test )
  15. You're welcome. And I doubt I would accept, I got enough with my own server .
  16. onVehicleEnter getPlayerTeam getTeamColor setVehicleColor
  17. Ok, I've added a 1 second timer and it's working now. function RecyclePlayerStats ( thePlayer ) local PlayerSTATTable = { } PlayerSTATTable.PlayerWeapons = makeClientWeaponsTable ( thePlayer ) PlayerSTATTable.POSX, PlayerSTATTable.POSY, PlayerSTATTable.POSZ = getElementPosition ( thePlayer ) return PlayerSTATTable end function makeClientWeaponsTable ( thePlayer ) local temptable = { } for slot = 0, 11 do --12 possible weapons local weapon = getPedWeapon ( thePlayer, slot ) if ( weapon ~= 0 ) then temptable [ weapon ] = getPedTotalAmmo ( thePlayer, slot ) end end return temptable end addEventHandler ( "onPlayerWasted", getRootElement(), function ( ) local PlayerTable = RecyclePlayerStats ( source ) --Tell death --Spawn the player setTimer ( function ( thePlayer, stats ) if spawnPlayer ( thePlayer, stats.POSX, stats.POSY, stats.POSZ ) then --Give the player his weapons for Weapon, Ammo in pairs ( stats.PlayerWeapons ) do outputChatBox ( tostring ( Weapon ) ) --DEBUG giveWeapon ( thePlayer, Weapon, Ammo ) end fadeCamera ( thePlayer, true ) setCameraTarget ( thePlayer, thePlayer ) end end ,1000, 1, source, PlayerTable ) end )
  18. Your ACL seems to be fine, you set the script as server side, right?
  19. function RecyclePlayerStats ( source ) local PlayerSTATTable = { } PlayerSTATTable.PlayerWeapons = makeClientWeaponsTable ( source ) PlayerSTATTable.POSX, PlayerSTATTable.POSY, PlayerSTATTable.POSZ = getElementPosition ( source ) return PlayerSTATTable end function makeClientWeaponsTable ( source ) local temptable = { } for slot = 0, 11 do --12 possible weapons local weapon = getPedWeapon ( source, slot ) if ( weapon ~= 0 ) then temptable [ weapon ] = getPedTotalAmmo ( source, slot ) end end return temptable end
  20. -- server side: addEvent ( "addST", true ) addEventHandler ( "addST", getRootElement(), function ( accountName ) local usuario = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup ( "user.".. usuario, aclGetGroup ( "LiderFTFP" ) ) then if ( accountName ) then local pname = getPlayerName ( source ) aclGroupAddObject ( aclGetGroup ( "FTFP" ), "user.".. accountName ) outputChatBox ( tostring ( pname ) .." agrego a '".. accountName .."' a S.T.A.R.S", getRootElement(), 0, 255, 255, true ) end end end ) -- client side: function STARS ( ) triggerServerEvent ( "addST", localPlayer, accountName ) end addEventHandler ( "onClientGUIClick", Add, STARS, false )
×
×
  • Create New...