DarkBeautyDZ Posted February 14, 2019 Share Posted February 14, 2019 (edited) 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 Edited February 14, 2019 by DarkBeautyDZ Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now