Jump to content

DarkBeautyDZ

Members
  • Posts

    21
  • Joined

  • Last visited

Posts posted by DarkBeautyDZ

  1. Hi guys can you please ,please,please  help me with this script , i have problem triggering the server side Event from a gui button  as Below , the client side works just fine but the server side doesnt work it should change the Range of the  random number according to the chosen difficulty :

    Client Side :

    function MKH_OPENHACK (localPlayer)
    
    	if (source == GUIEditor.button[1]) then                                 ----------the Button open the Hack panel
    		guiSetVisible(GUIEditor.window[1], false)
    		guiSetVisible(ATM.window[1], true)
    		output ("Hacking started..." )    
    		LabelHackTimer = guiCreateLabel ( 0.61,0.61, 0.68, 0.48, "", true, ATM.window[1] ) 
    		guiLabelSetColor(LabelHackTimer,255,0,0)
    		guiSetFont(LabelHackTimer, "sa-header")
    		guiSetAlpha ( LabelHackTimer, 1 )
    		local Difficulty = guiComboBoxGetItemText(GUIEditor.combobox[1], guiComboBoxGetSelected(GUIEditor.combobox[1]))--- combobox with 3 Difficulties
    		if Difficulty and Difficulty ~= "" then
    			
    			triggerServerEvent("onHacking",localPlayer,Difficulty)  	    ----- probably the mistake here 
    			
          												
          ------------------------ all Below working just fine
    			if Difficulty == "Easy" then                     -------------easy difficulty (the Difference is in time )
    		HackingStart = setTimer(function()
    			output ( "Time Out" )
    			destroyElement(LabelHackTimer) 
    			guiSetVisible(ATM.window[1], false)
    			showCursor(false)
    				end,30000,1)       
    			elseif   Difficulty == "Medium" then   	        --------------Medium
    				HackingStart = setTimer(function()
    					output ( "Time Out" )
    					destroyElement(LabelHackTimer)		 
    					guiSetVisible(ATM.window[1], false)
    					showCursor(false)
    						end,120000,1) 					
    			elseif   Difficulty == "Hard" then  						 ----- ------------Hard
    						HackingStart = setTimer(function()	
    							output ( "Time Out" )
    							destroyElement(LabelHackTimer)	 
    							guiSetVisible(ATM.window[1], false)
    							showCursor(false)
    								end,300000,1)       
    						
    				end			
    			end					
    		end
    	end
    addEventHandler("onClientGUIClick", root, MKH_OPENHACK)		

    Server Side :

     

    
    function HackingRange(source, Difficulty)
    if source then 
    	if Difficulty == "Easy" then
    	local randomNumber = math.random(1, 1000)              -----------------Range should change in each Difficulty + chat (both not working)
    	executeSQLQuery("DROP TABLE ATMRobbery" )
    	executeSQLQuery("CREATE TABLE IF NOT EXISTS ATMRobbery (ATM TEXT, theNumber INT)")
    	executeSQLQuery( "INSERT INTO ATMRobbery(ATM, theNumber) VALUES(?,?)", "ATMs", randomNumber)
    	outputDebugString ("ATM Robbery: SQL Database has been created!")
    	outputDebugString ("ATM Robbery: The Number is "..randomNumber)
    	outputChatBox("Difficulty has been set to Easy you've got 30 Sec ",source, 0, 255, 0)
    	ATM_ROBBERY = true
    	elseif Difficulty == "Medium" then
    		local randomNumber = math.random(1, 1000000)
    		executeSQLQuery("DROP TABLE ATMRobbery" )
    		executeSQLQuery("CREATE TABLE IF NOT EXISTS ATMRobbery (ATM TEXT, theNumber INT)")
    		executeSQLQuery( "INSERT INTO ATMRobbery(ATM, theNumber) VALUES(?,?)", "ATMs", randomNumber)
    		outputDebugString ("ATM Robbery: SQL Database has been created!")
    		outputDebugString ("ATM Robbery: The Number is "..randomNumber)
    		outputChatBox("Difficulty has been set to Medium you've got 2 Minutes",source, 0, 255, 0)
    		ATM_ROBBERY = true
    	elseif Difficulty == "Hard" then
    		local randomNumber = math.random(1, 1000000000)
    		executeSQLQuery("DROP TABLE ATMRobbery" )
    		executeSQLQuery("CREATE TABLE IF NOT EXISTS ATMRobbery (ATM TEXT, theNumber INT)")
    		executeSQLQuery( "INSERT INTO ATMRobbery(ATM, theNumber) VALUES(?,?)", "ATMs", randomNumber)
    		outputDebugString ("ATM Robbery: SQL Database has been created!")
    		outputDebugString ("ATM Robbery: The Number is "..randomNumber)
    		outputChatBox("Difficulty has been set to Medium you've got 5 Minutes",source, 0, 255, 0)
    		ATM_ROBBERY = true
    
    	end
    end
    end
    addEvent("onHacking",true)
    addEventHandler("onHacking",resourceRoot,HackingRange)

     

  2. On 15/04/2019 at 22:37, Dzsozi (h03) said:

    Why don't you just use bone attach and attach a phone object to the player's hand?

    i thought about that but like this it's more realistic and if you thought about it enough you would realize that 43ID weapon is Camera so it's fit for phone you would be able to take pics it's more realistic that way so changing to camera will trigger the whole thing animation the walking style and the phone main page

     

  3. 12 hours ago, Ab-47 said:

    To answer your question, just use "takeWeapon" at the else. Also, it'd be more convenient using tables for these sorts of things. Element data is not the wisest choice.

    For example:

    local using_phone = {}

    function togglePhone(player)

         if (not using_phone[player]) then

               using_phone[player] = true

               --You could also add giveWeapon here (to continue your script)

               --Animation here

         else

              using_phone[player] = false

               --And here you could add takeWeapon here.

               --End animation here

         end

    end

    addCommandHandler("phone", togglePhone)

     

    Furthermore, I suggest you rethink your code, it doesn't look that great and you'll encounter issues in the future. For example, calling root to set a walking style.. First of, there's no need for the walking style as when the phone is enabled I assume you have a cursor enabled too, so the player couldn't move either way (unless you're using it as an idling position). Secondly, you're calling the root element of everything, not really efficient. You have "playerSource" defined, so just call it for "playerSource". Personal advice, remove that whole server function and client trigger for walking style. In addition to all this, I would add a triggerClientEvent to toggle the phone from this function and change the commandHandler to a bindKey. Drop a message if you need any help, we'll be of assistance. Good-luck.

    yes as you say Mr , changing command to bind is what i'm planning to do , but there is something alse about the animation the animation i want it to stop after 1.2 sec means timer after else is another animation 2nd one would be activated for another 1.2 sec (phone out - phone in ) , and about the cursor i got that covered so don't worry :)

  4. Phone Animation 



    Explanation
    Hi there i need HELP COMPLETING this Script for phone animation the Idea is replacing the camera with a phone and when ever i chose camera/phone 1st animation start for 2 sec bringing the "phone out" then triggering client event changing walking style to 137ID (modefied to phone walking style) and ofcourse the phone main page with it then when changing to other weapon or activating the "phone command again returning walking style to default and playing 2nd animation "phone in " and closing phone main page with it :

    mta-screen_2019-04-15_13-35-25.png?width

    well almost like this this is me making the script work but not exactly as i want :

    --------------------------


    The Script : 

    for now it only activate walking style 137 by command(i want to make him chose weapon 43id by that command) i want to disactivate it too by the same command:( 

    Client Side
     

    
    
    function togglephone() 
    
    	setPedWalkingStyle (localPlayer ,137)
    end
    addEvent("togglephone",true)
    addEventHandler("togglephone",root, togglephone)
    
    
      function replaceModel() 
      txd = engineLoadTXD("cellphone.txd", 367 )
      engineImportTXD(txd, 367)
      dff = engineLoadDFF("cellphone.dff", 367 )
      engineReplaceModel(dff, 367)
      end
    addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel)
    


    Server Side

    
    
    function togglephone ( playerSource )
    			giveWeapon ( source, 43, 200 )
    			triggerClientEvent(root, "togglephone", root)
    			
    	
    end
    addCommandHandler ( "phone", togglephone )
    

    2. i need to add the two animaions "phone_out " from ped.ifp block that i modified  for 1.2 sec then "phone_in" played when phone is disabled how to mix them both in one script 

    function togglephone(thePlayer)
    	if not getElementData(thePlayer, "phoning") then
        		giveWeapon ( thePlayer, 43, 200 ) --- this give weap but also how chosing it will trigger the animation thing 
    		setPedAnimation(thePlayer, "ped", "phone_out", -1, false, false, false, false)
    		setElementData(thePlayer, "phoning", true)
    	else
    		-- If you use again this command will play phone in animation need timer in both animations 
    		setPedAnimation(thePlayer, "ped", "phone_in", -1, false, false, false, false)
    		removeElementData(thePlayer, "phoning")
    	end
    end
    addCommandHandler("phone", togglephone)

     

  5. 56 minutes ago, <~KaMiKaZe~> said:
    
    local zones = {}
    local Fogo = {}
    function GrHabilit(Elemento)
    if Elemento and getElementData(source,"colGr") then
    if getElementModel(Elemento) ~= 78 then
    if getElementType(Elemento) == "player" or getElementType(Elemento) == "ped"  then
    setPedOnFire(Elemento,true)
    elseif getElementType(Elemento) == "vehicle" then --this to not blow his bike XD
    setElementHealth( Elemento, 200 )
    setTimer( setVehicleDamageProof, 100, 1, Elemento, true )
    end
    end
    end
    end
    addEventHandler("onColShapeHit",getRootElement(),GrHabilit)
    
    function fireon (thePlayer)
    if getElementModel(thePlayer) == 78  then
            local x, y, z = getElementPosition (thePlayer)		
           Fogo[thePlayer] = createObject( ObjectID, x, y, z )-- PUT HERE YOUR OBJECT ID ( objectID ).
            setElementCollisionsEnabled(Fogo[thePlayer], false)
            exports.bone_attach:attachElementToBone (Fogo[thePlayer], thePlayer, 8, -0, 0, -0.3, -125, 0, 0)
    		setElementAlpha( Fogo[thePlayer], 0 )
            zones[thePlayer] = createColCuboid(x, y, z, 3.1827392578125, 3.8387451171875, 2.4195971488953)
            attachElements(zones[thePlayer],thePlayer,0,0,0)
            setElementData(zones[thePlayer],"colGr",true)   -- to burn who ever get near him
            outputChatBox ( "#FFFF00Power #00FF00Revenge Fire ON", thePlayer, 0, 255, 0, true )
    end
    end
    addCommandHandler ("fireon", fireon)
    
    function fireoff (player)
    if getElementModel(player) == 78 then 
    if ( zones[player] ~= false ) then      -- check if player has burn zone
    destroyElement ( zones[player] )               -- destroy the burn zone  	
    destroyElement(Fogo[player])        --destroy the fire shape
    outputChatBox ( "#FFFF00Power #00FF00Revenge Fire OFF", player, 0, 255, 0, true )
    end
    end
    end
    addCommandHandler ("fireoff", fireoff)
    

     

    the problem isn't in fogo it's in zones (burn zone doesn't disapair)

  6. 1 hour ago, Oussema said:
    
    local zones = {}
    function GrHabilit(Elemento)
    if Elemento and getElementData(source,"colGr")   then
    if getElementModel(Elemento) ~= 78 then
    if getElementType(Elemento) == "player" or getElementType(Elemento) == "ped"  then
    setPedOnFire(Elemento,true)
    elseif getElementType(Elemento) == "vehicle" then --this to not blow his bike XD
    setElementHealth(Elemento, 200)
    end
    end
    end
    end
    addEventHandler("onColShapeHit",getRootElement(),GrHabilit)
    
    function fireon (thePlayer)
    if getElementModel(thePlayer) == 78  then
            local x, y, z = getElementPosition (thePlayer)		
            Fogo[4] = createObject(TabeladeFogo[ math.random( 1,#TabeladeFogo ) ], x, y, z)
            setElementCollisionsEnabled(Fogo[4], false)
            exports.bone_attach:attachElementToBone (Fogo[4], thePlayer, 8, -0, 0, -0.3, -125, 0, 0)
            zones[thePlayer] = createColCuboid(x, y, z, 3.1827392578125, 3.8387451171875, 2.4195971488953)
            attachElements(zones[thePlayer],thePlayer,0,0,0)
            setElementData(zones[thePlayer],"colGr",true)   -- to burn who ever get near him
            outputChatBox ( "#FFFF00Power #00FF00Revenge Fire ON", thePlayer, 0, 255, 0, true )
    end
    end
    addCommandHandler ("fireon", fireon)
    
    function fireoff (player)
    if getElementModel(player) == 78 then 
    if ( zones[player] ~= false ) then      -- check if player has burn zone
    destroyElement ( zones[player] )               -- destroy the burn zone  	
    destroyElement(Fogo[4])        --destroy the fire shape
    outputChatBox ( "#FFFF00Power #00FF00Revenge Fire OFF", player, 0, 255, 0, true )
    end
    end
    end
    addCommandHandler ("fireoff", fireoff)
    

    i didn't test it , but try and if there problem tell me ^^ 

    it doesn't burn any more i think it's because of this
     

    if Elemento and getElementData(source,"colGr")   then--i think source is what make the proublem  

    or this another zone in the script make his bike burn peds 
     

    function IniciarFogoNaMoto(Ve,Assento)
    if (Assento == 0) then
     if getElementModel(source) == 78 and getElementModel(Ve) == 463 and getElementData(source,"PLAYERGR") then
    setVehicleDamageProof ( Ve, true )
     local Mx,My,Mz = getElementPosition(Ve)
    	
    Fogo[1] = createObject(TabeladeFogo[ math.random( 1,#TabeladeFogo ) ],Mx,My,Mz)
     Fogo[2] = createObject(TabeladeFogo[ math.random( 1,#TabeladeFogo ) ],Mx,My,Mz)
     Fogo[3] = createObject(TabeladeFogo[ math.random( 1,#TabeladeFogo ) ],Mx,My,Mz)
    		setElementCollisionsEnabled(Fogo[1], false)
    			setElementCollisionsEnabled(Fogo[2], false)
    			setElementCollisionsEnabled(Fogo[3], false)
    			attachElements(Fogo[3],Ve,0,1,0)
    attachElements(Fogo[1],Ve,0,-1,0)
    attachElements(Fogo[2],Ve,-0.3,0,0)
    local zone = createColCuboid(Mx, My, Mz, 3.1827392578125, 3.8387451171875, 2.4195971488953)
    attachElements(zone,Ve,0,0,0)
    setElementData(zone,"colGr",true)-- here another zone
    
    		end
    	end
    end
    addEventHandler ( "onPlayerVehicleEnter", getRootElement(), IniciarFogoNaMoto)
    			

     

  7. Hi there i'm making this ghost rider script server side and i have trouble making the command fire off the fire shape got destroyed but the zone of burn didn't get destroyed help please :

     

    
    
    function GrHabilit(Elemento)
    if Elemento and getElementData(source,"colGr")   then
    if getElementModel(Elemento) ~= 78 then
    if getElementType(Elemento) == "player" or getElementType(Elemento) == "ped"  then
    setPedOnFire(Elemento,true)
    elseif getElementType(Elemento) == "vehicle" then --this to not blow his bike XD
    setElementHealth(Elemento, 200)
    end
    end
    end
    end
    addEventHandler("onColShapeHit",getRootElement(),GrHabilit)
    
    function fireon (source)
    	
    if getElementModel(source) == 78 then
            local x, y, z = getElementPosition (source)		
            Fogo[4] = createObject(TabeladeFogo[ math.random( 1,#TabeladeFogo ) ], x, y, z)
            setElementCollisionsEnabled(Fogo[4], false)
            exports.bone_attach:attachElementToBone (Fogo[4], source, 8, -0, 0, -0.3, -125, 0, 0)
            local zone1 = createColCuboid(x, y, z, 3.1827392578125, 3.8387451171875, 2.4195971488953)
            attachElements(zone1,source,0,0,0)
            setElementData(zone1,"colGr",true)   -- to burn who ever get near him
            outputChatBox ( "#FFFF00Power #00FF00Revenge Fire ON", source, 0, 255, 0, true )
        
    
    end
    end
    addCommandHandler ("fireon", fireon)
    
    function fireoff (source)
    
    if getElementModel(source) == 78 then 
    local x, y, z = getElementPosition (source)
    local zone1 = getElementAttachedTo ( source )
    if ( zone1 ~= false ) then      -- supposed to destroy the burn zone
    destroyElement ( zone1 )               -- supposed to destroy the burn zone  	
    destroyElement(Fogo[4])        --destroy the fire shape
    
    outputChatBox ( "#FFFF00Power #00FF00Revenge Fire OFF", source, 0, 255, 0, true )
    end
    end
    end
    addCommandHandler ("fireoff", fireoff
    
    

    please help ..

  8. 2 hours ago, R1S1NG said:

    Let me know, you need to block the skin of one gang to other players yes? Like the adm?

    yeah so the players who have admin can select the skin , but the other players can't

  9. hi guys i made a vip script the problem in the vip tag never show i don't know where is the error ?

    ---Tag---
    local VipIconGold = dxCreateTexture("img/Gold.png")
    local VipIconSilver = dxCreateTexture("img/Silver.png")
    local VipIconBronze = dxCreateTexture("img/Bronze.png")
    
    addEventHandler("onClientPreRender", root,
    	function()
    		for i, player in ipairs(getElementsByType("player")) do
    			if not (isPedInVehicle ( player )) and player ~= localPlayer then
    				local VIPType = getElementData(player, "VIPType") 
    or false 
    				local x, y, z = getPedBonePosition(player, 8)
    				if VIPType == "Gold" then
    					dxDrawMaterialLine3D(x, y, z+0.7, x, y, z+0.3, VipIconGold, 0.5, tocolor(255,255,255,255))
    				elseif VIPType == "Silver" then
    					dxDrawMaterialLine3D(x, y, z+0.7, x, y, z+0.3, VipIconSilver, 0.5, tocolor(255,255,255,255))
    				elseif VIPType == "Bronze" then
    					dxDrawMaterialLine3D(x, y, z+0.7, x, y, z+0.3, VipIconBronze, 0.5, tocolor(255,255,255,255))
    				end
    			end
    		end
    	end
    )

     

  10. i have this modified gangs wars mod script "client.lua" i want to change skin selection restriction in the start from "group" to "Acl group" this is the part that i need to change 

    if SelectedSkin == 278 and getElementData(localPlayer,"Group") ~= "[ARMY]" then output("this skin is only available to [ARMY] group only ! 
    ) return end

    i need to change restriction so only Acl Group "Admin" For example that can select that skin , please help ...

  11. 6 hours ago, Peti said:

    https://forum.multitheftauto.com/topic/113331-skins-save-system-resource-script-need-help/?tab=comments#comment-938686

     

    getPedSkin is deprecated, please use this: https://wiki.multitheftauto.com/wiki/GetElementModel

    And setPedSkin is deprecated too, use this instead: https://wiki.multitheftauto.com/wiki/SetElementModel

    If you want commands, you should know how addCommandHandler works: https://wiki.multitheftauto.com/wiki/AddCommandHandler

    
    function onPlayerSpawn ( player )
          local playeraccount = getPlayerAccount ( player )
          if ( playeraccount ) then
                local playerskin = getAccountData ( playeraccount, "skin1" )
                if ( playerskin ) then
                setElementModel ( source, playerskin )
                end
          end
    end
    addCommandHandler('save', onPlayerSpawn, false, false)
    
    function onPlayerWasted ( player )
          local playeraccount = getPlayerAccount ( source )
          if ( playeraccount ) then
                local playerskin = getElementModel ( source )
                setAccountData ( playeraccount, "skin1", playerskin )
          end
    end 
    addCommandHandler('load', onPlayerWasted, false, false)
    

     

    it didn't work for me and , it's not metter for the save and load to be related to respawning or player wasted just commands and to be able to use them any time.e
    ps. when i changed it to client lua it loaded on respawn another skin that it has been saved from the script i posted previously.

     

  12. Hi guys i'm trying to make a save system to save and load skin on command , i have another script but i don't know how to add a command handler to it :

    function onPlayerSpawn ( )
          local playeraccount = getPlayerAccount ( source )
          if ( playeraccount ) then
                local playerskin = getAccountData ( playeraccount, "skin1" )
                if ( playerskin ) then
                setPedSkin ( source, playerskin )
                end
          end
    end
    
    function onPlayerWasted ( )
          local playeraccount = getPlayerAccount ( source )
          if ( playeraccount ) then
                local playerskin = getPedSkin ( source )
                setAccountData ( playeraccount, "skin1", playerskin )
          end
    end 
    
    addEventHandler ( "onPlayerSpawn", getRootElement ( ), onPlayerSpawn )
    addEventHandler ( "onPlayerWasted", getRootElement ( ), onPlayerWasted )

    ..............................

    PS. i want to control it more by command and not an event .

  13. On 15/02/2019 at 02:39, Peti said:

    To make an inmortal ped, you need to cancel the event  'onClientPedDamage':

    
    function inmortal()
      cancelEvent()
    end
    addEventHandler("onClientPedDamage", yourPed, inmortal)
    

     

    i know this :
    it's like using this one

    addEventHandler("onClientPedDamage", thePed, function () cancelEvent() end)

    with this the ped take damage when his health become red =he  got replaced with another one then he multiply and after that even when i stop the mod he still there and the worst thing is that the chat interaction doesn't work anymore unless i restarted the mod 
    ... so it apear he take damage .
    PS. i tried them in both client and server side .

  14. i need help to add invinciblility to those peds after i finished the scripting i found my self forgetting making it invincible this my current script server lua :
     

    local peds = {

          -- Model, Posx, Posy, Posz, Rotation, Interior, Dimension, Ped Name, Ped Language

          {212, -1938.3562011719, 1340.9323730469, 7.1875, 180, 0, 0, "Alperto", "Spanish" },

          {100, 2039.4375, 1533.5224609375, 10.671875, 0, 0, 0, "samir", "English" }

    }

     

    local saludos = {

              ["Hasta "] = "Hasta luego señor, tenga un buen día", --------------------------here salut speech and NPc reply

    }

     

    local despidos = {

          ["Hasta luego"] = "Hasta luego señor, tenga un buen día",

          ["Nos vemos"] = "¡Claramente! Cuidese",

          ["Adiós"] = "Hasta luego muchacho",

    }

     

    local _peds = { }

     

    function creacionPeds ( )

        for k, v in ipairs ( peds ) do

            local skin = v[1]

            local x, y, z, rz = v[2], v[3], v[4], v[5]

                local interior, dimension = v[6], v[7]

                local nombre = v[8]

                local lenguaje = v[9]

            if ( skin and x and y and z and rz ) then

                local ped = createPed ( skin, x, y, z, rz )

                      _peds[ ped ] = { name = nombre, language = lenguaje }

                      setElementDimension ( ped, dimension )

                      setElementInteior ( ped, interior )

                      setElementFrozen ( ped, true )

     

            else

                outputDebugString ( "[Interaccion] No has colocado los datos de creación de PEDS bien." )

            end

        end

    end

    addEventHandler ( "onResourceStart", getRootElement(), creacionPeds )

     

    addEventHandler( "onPlayerChat", root,

          function( message, messageType )

                if messageType == 0 then

                      local peds = getElementsByType( 'ped' )

                      for i=1, #peds do

                            local value = peds

                            if value and _peds[ value ] and getElementType( value ) == "ped" then

                                 local name = _peds[ value ].name

                                 local language = _peds[ value ].language

                                 local x, y, z = getElementPosition( source )

                                 local x1, y1, z1 = getElementPosition( value )

                                 local distance = getDistanceBetweenPoints3D ( x, y, z, x1, y1, z1 )

                                 if distance < 1 then

                                       if saludos[ message ] then

                                             setTimer( function( )

                                                   outputChatBox ( "["..language.."] "..name..": "..saludos[message].."", source, 255, 255, 255 )

                                             end, 50, 1 )                                        

                                       else

                                             if despidos[ message ] then

                                             setTimer( function( )

                                                   outputChatBox ( "["..language.."] "..name..": "..despidos[message].."", source, 255, 255, 255 )

                                             end, 50, 1 )                                              

                                             end

                                       end

                                 end

                            end

                      end

                end

          end

    )

     

     sorry if my english is laking

    please help ....

     

    prety please : )

  15. i need help to add invinciblility to those peds after i finished the scripting i found my self forgetting making it invincible this my current script server lua :
     

    local peds = {

          -- Model, Posx, Posy, Posz, Rotation, Interior, Dimension, Ped Name, Ped Language

          {212, -1938.3562011719, 1340.9323730469, 7.1875, 180, 0, 0, "Alperto", "Spanish" },

          {100, 2039.4375, 1533.5224609375, 10.671875, 0, 0, 0, "samir", "English" }

    }

     

    local saludos = {

              ["Hasta "] = "Hasta luego señor, tenga un buen día", --------------------------here salut speech and NPc reply

    }

     

    local despidos = {

          ["Hasta luego"] = "Hasta luego señor, tenga un buen día",

          ["Nos vemos"] = "¡Claramente! Cuidese",

          ["Adiós"] = "Hasta luego muchacho",

    }

     

    local _peds = { }

     

    function creacionPeds ( )

        for k, v in ipairs ( peds ) do

            local skin = v[1]

            local x, y, z, rz = v[2], v[3], v[4], v[5]

                local interior, dimension = v[6], v[7]

                local nombre = v[8]

                local lenguaje = v[9]

            if ( skin and x and y and z and rz ) then

                local ped = createPed ( skin, x, y, z, rz )

                      _peds[ ped ] = { name = nombre, language = lenguaje }

                      setElementDimension ( ped, dimension )

                      setElementInteior ( ped, interior )

                      setElementFrozen ( ped, true )

     

            else

                outputDebugString ( "[Interaccion] No has colocado los datos de creación de PEDS bien." )

            end

        end

    end

    addEventHandler ( "onResourceStart", getRootElement(), creacionPeds )

     

    addEventHandler( "onPlayerChat", root,

          function( message, messageType )

                if messageType == 0 then

                      local peds = getElementsByType( 'ped' )

                      for i=1, #peds do

                            local value = peds

                            if value and _peds[ value ] and getElementType( value ) == "ped" then

                                 local name = _peds[ value ].name

                                 local language = _peds[ value ].language

                                 local x, y, z = getElementPosition( source )

                                 local x1, y1, z1 = getElementPosition( value )

                                 local distance = getDistanceBetweenPoints3D ( x, y, z, x1, y1, z1 )

                                 if distance < 1 then

                                       if saludos[ message ] then

                                             setTimer( function( )

                                                   outputChatBox ( "["..language.."] "..name..": "..saludos[message].."", source, 255, 255, 255 )

                                             end, 50, 1 )                                        

                                       else

                                             if despidos[ message ] then

                                             setTimer( function( )

                                                   outputChatBox ( "["..language.."] "..name..": "..despidos[message].."", source, 255, 255, 255 )

                                             end, 50, 1 )                                              

                                             end

                                       end

                                 end

                            end

                      end

                end

          end

    )

     

     sorry if my english is laking

  16. i'm still beginner in scripting but i'm trying to complete this script (client ) for saving a skin in a save slot 1 for example and load it again when the player want to do so , this is my script  :

    function saveplayerskin(player)

    addEventHandler("onResourceStart", resourceRoot,

    function()

                addCommandHandler("saveskin1",saveplayerskin)

                addCommandHandler("loadskin1",loadplayerskin) 

     

    addCommandHandler('saveskin1', function ( player )

          local playeraccount = getPlayerAccount ( source )

          if ( playeraccount ) then

                local playerskin = getPedSkin ( source )

                setAccountData ( playeraccount, "skin", playerskin ) then

            outputChatBox("skin saved in slot1!",player,255) return end

          end

    end

     

    addCommandHandler('loadskin1', function ( player )

          local playeraccount = getPlayerAccount ( source )

          if ( playeraccount ) then

                local playerskin = getAccountData ( playeraccount, "skin" )

                if ( playerskin ) then

                      setPedSkin ( source, playerskin )then

            outputChatBox("skin loaded from slot1!",player,255) return end

          end

    end

     

                addCommandHandler("saveskin1",saveplayerskin)

                addCommandHandler("loadskin1",loadplayerskin) 

     

    is there someone nice enough to help a girl in a trouble please  ?

×
×
  • Create New...