Soren Posted February 18, 2012 Share Posted February 18, 2012 (edited) Hola a todos como ya saben mi gamemode ya tiene server pero no esta terminado ( ni de coña) por que necesito ayuda con estos scripts y despues le agregare modelos etc etc en fin 1 Script Quiero convertir este script en un commando: Mi intento: checking = 0 addCommandHandler ("fps" function ( ) function FPSStart (startedresource) if startedresource == getThisResource() then local x,y,z = getElementPosition( getLocalPlayer() ) Body = createObject (983, x, y, z ) attachElements ( Body, getLocalPlayer(), 0, -0.1, 0.45, 90, 0, 90) setElementAlpha( Body, 0) setTimer ( setElementAlpha,1000, 1, getLocalPlayer(), 0) end end addEventHandler ( "onClientResourceStart", getRootElement(), FPSStart) function invisOnSpawn() setElementAlpha(getLocalPlayer(), 0) end addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), invisOnSpawn ) function climbcheck() setElementCollisionsEnabled(Body, false) if checking == 0 then checking = 1 stopclimbcheck = setTimer ( stopCcheck, 1200, 1 ) addEventHandler ("onClientRender", getRootElement(), areyouclimbing) elseif checking == 1 then killTimer(stopclimbcheck) stopclimbcheck = setTimer ( stopCcheck, 1200, 1 ) end end bindKey ("jump", "down", climbcheck ) function stopCcheck() setElementCollisionsEnabled(Body, true) removeEventHandler("onClientRender", getRootElement(), areyouclimbing) setCameraTarget (getLocalPlayer()) checking = 0 end function areyouclimbing() hx,hy,hz = getPedBonePosition ( getLocalPlayer(), 8 ) local rot = getPedRotation (getLocalPlayer()) radRot = math.rad ( rot ) local radius = .5 local tx = hx + radius * math.sin(radRot) local ty = hy + -(radius) * math.cos(radRot) local tz = hz setCameraMatrix(tx,ty,tz,hx,hy,hz) if ( isPedDoingTask ( getLocalPlayer(), "TASK_SIMPLE_CLIMB" ) ) then killTimer(stopclimbcheck) doneclimbyet = setTimer ( finishCcheck, 400, 1 ) end end function finishCcheck() if ( isPedDoingTask ( getLocalPlayer(), "TASK_SIMPLE_CLIMB" ) ) then doneclimbyet = setTimer ( finishCcheck, 400, 1 ) else finishedclimbing() end end function finishedclimbing() checking = 0 removeEventHandler("onClientRender", getRootElement(), areyouclimbing) setElementCollisionsEnabled(Body, true) setCameraTarget (getLocalPlayer()) end function FPSStop (startedresource) if startedresource == getThisResource() then setElementAlpha( getLocalPlayer(), 255) setCameraTarget (getLocalPlayer()) end end addEventHandler ( "onClientResourceStop", getRootElement(), FPSStop) function shakeCamera(weapon) x,y,z = getPedBonePosition ( getLocalPlayer(), 26 ) if weapon == 24 then createExplosion ( x,y,z + 10,12,false,0.4,false) elseif weapon == 25 then createExplosion ( x,y,z + 10,12,false,0.5,false) elseif weapon == 26 then createExplosion ( x,y,z + 10,12,false,0.7,false) elseif weapon == 27 then createExplosion ( x,y,z + 10,12,false,0.5,false) elseif weapon == 29 then createExplosion ( x,y,z + 10,12,false,0.2,false) elseif weapon == 30 then createExplosion ( x,y,z+10,12,false,0.2,false) elseif weapon == 31 then createExplosion ( x,y,z + 10,12,false,0.3,false) elseif weapon == 33 then createExplosion ( x,y,z + 10,12,false,0.3,false) elseif weapon == 34 then createExplosion ( x,y,z + 10,12,false,0.3,false) elseif weapon == 22 then createExplosion ( x,y,z + 10,12,false,0.1,false) elseif weapon == 28 then createExplosion ( x,y,z + 10,12,false,0.2,false) elseif weapon == 32 then createExplosion ( x,y,z + 10,12,false,0.2,false) elseif weapon == 38 then createExplosion ( x,y,z + 10,12,false,0.6,false) end end addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), shakeCamera ) function carcheck(player) if player == getLocalPlayer() then abortCarEnterCheck = setTimer ( checkCarTask, 100, 1 ) setElementCollisionsEnabled(Body, false) setElementAlpha(getLocalPlayer(), 255) end end addEventHandler ( "onClientVehicleStartEnter", getRootElement(), carcheck ) function checkCarTask() local stask = getPedSimplestTask(getLocalPlayer()) if (stask == "TASK_SIMPLE_CAR_GET_IN") or (stask == "TASK_SIMPLE_GO_TO_POINT") or (stask == "TASK_SIMPLE_CAR_OPEN_DOOR_FROM_OUTSIDE") or (stask == "TASK_SIMPLE_CAR_ALIGN") or (stask == "TASK_SIMPLE_CAR_CLOSE_DOOR_FROM_INSIDE") or (stask == "TASK_SIMPLE_CAR_SHUFFLE") or (stask == "TASK_SIMPLE_CAR_DRIVE") or (stask == "TASK_SIMPLE_ACHIEVE_HEADING") then abortCarEnterCheck = setTimer ( checkCarTask, 100, 1 ) elseif (isPedInVehicle(getLocalPlayer()) == false) then --enter vehicle was aborted setElementCollisionsEnabled(Body, true) setElementAlpha(getLocalPlayer(), 0) end end function carexit(player) if player == getLocalPlayer() then setElementCollisionsEnabled(Body, true) setElementAlpha(getLocalPlayer(), 0) end end addEventHandler ( "onClientVehicleExit", getRootElement(), carexit ) end) Script original: checking = 0 function FPSStart (startedresource) if startedresource == getThisResource() then local x,y,z = getElementPosition( getLocalPlayer() ) Body = createObject (983, x, y, z ) attachElements ( Body, getLocalPlayer(), 0, -0.1, 0.45, 90, 0, 90) setElementAlpha( Body, 0) setTimer ( setElementAlpha,1000, 1, getLocalPlayer(), 0) end end addEventHandler ( "onClientResourceStart", getRootElement(), FPSStart) function invisOnSpawn() setElementAlpha(getLocalPlayer(), 0) end addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), invisOnSpawn ) function climbcheck() setElementCollisionsEnabled(Body, false) if checking == 0 then checking = 1 stopclimbcheck = setTimer ( stopCcheck, 1200, 1 ) addEventHandler ("onClientRender", getRootElement(), areyouclimbing) elseif checking == 1 then killTimer(stopclimbcheck) stopclimbcheck = setTimer ( stopCcheck, 1200, 1 ) end end bindKey ("jump", "down", climbcheck ) function stopCcheck() setElementCollisionsEnabled(Body, true) removeEventHandler("onClientRender", getRootElement(), areyouclimbing) setCameraTarget (getLocalPlayer()) checking = 0 end function areyouclimbing() hx,hy,hz = getPedBonePosition ( getLocalPlayer(), 8 ) local rot = getPedRotation (getLocalPlayer()) radRot = math.rad ( rot ) local radius = .5 local tx = hx + radius * math.sin(radRot) local ty = hy + -(radius) * math.cos(radRot) local tz = hz setCameraMatrix(tx,ty,tz,hx,hy,hz) if ( isPedDoingTask ( getLocalPlayer(), "TASK_SIMPLE_CLIMB" ) ) then killTimer(stopclimbcheck) doneclimbyet = setTimer ( finishCcheck, 400, 1 ) end end function finishCcheck() if ( isPedDoingTask ( getLocalPlayer(), "TASK_SIMPLE_CLIMB" ) ) then doneclimbyet = setTimer ( finishCcheck, 400, 1 ) else finishedclimbing() end end function finishedclimbing() checking = 0 removeEventHandler("onClientRender", getRootElement(), areyouclimbing) setElementCollisionsEnabled(Body, true) setCameraTarget (getLocalPlayer()) end function FPSStop (startedresource) if startedresource == getThisResource() then setElementAlpha( getLocalPlayer(), 255) setCameraTarget (getLocalPlayer()) end end addEventHandler ( "onClientResourceStop", getRootElement(), FPSStop) function shakeCamera(weapon) x,y,z = getPedBonePosition ( getLocalPlayer(), 26 ) if weapon == 24 then createExplosion ( x,y,z + 10,12,false,0.4,false) elseif weapon == 25 then createExplosion ( x,y,z + 10,12,false,0.5,false) elseif weapon == 26 then createExplosion ( x,y,z + 10,12,false,0.7,false) elseif weapon == 27 then createExplosion ( x,y,z + 10,12,false,0.5,false) elseif weapon == 29 then createExplosion ( x,y,z + 10,12,false,0.2,false) elseif weapon == 30 then createExplosion ( x,y,z+10,12,false,0.2,false) elseif weapon == 31 then createExplosion ( x,y,z + 10,12,false,0.3,false) elseif weapon == 33 then createExplosion ( x,y,z + 10,12,false,0.3,false) elseif weapon == 34 then createExplosion ( x,y,z + 10,12,false,0.3,false) elseif weapon == 22 then createExplosion ( x,y,z + 10,12,false,0.1,false) elseif weapon == 28 then createExplosion ( x,y,z + 10,12,false,0.2,false) elseif weapon == 32 then createExplosion ( x,y,z + 10,12,false,0.2,false) elseif weapon == 38 then createExplosion ( x,y,z + 10,12,false,0.6,false) end end addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), shakeCamera ) function carcheck(player) if player == getLocalPlayer() then abortCarEnterCheck = setTimer ( checkCarTask, 100, 1 ) setElementCollisionsEnabled(Body, false) setElementAlpha(getLocalPlayer(), 255) end end addEventHandler ( "onClientVehicleStartEnter", getRootElement(), carcheck ) function checkCarTask() local stask = getPedSimplestTask(getLocalPlayer()) if (stask == "TASK_SIMPLE_CAR_GET_IN") or (stask == "TASK_SIMPLE_GO_TO_POINT") or (stask == "TASK_SIMPLE_CAR_OPEN_DOOR_FROM_OUTSIDE") or (stask == "TASK_SIMPLE_CAR_ALIGN") or (stask == "TASK_SIMPLE_CAR_CLOSE_DOOR_FROM_INSIDE") or (stask == "TASK_SIMPLE_CAR_SHUFFLE") or (stask == "TASK_SIMPLE_CAR_DRIVE") or (stask == "TASK_SIMPLE_ACHIEVE_HEADING") then abortCarEnterCheck = setTimer ( checkCarTask, 100, 1 ) elseif (isPedInVehicle(getLocalPlayer()) == false) then --enter vehicle was aborted setElementCollisionsEnabled(Body, true) setElementAlpha(getLocalPlayer(), 0) end end function carexit(player) if player == getLocalPlayer() then setElementCollisionsEnabled(Body, true) setElementAlpha(getLocalPlayer(), 0) end end addEventHandler ( "onClientVehicleExit", getRootElement(), carexit ) 2 Script Este lo hise mas sin embargo no cambio los modelos .... Por que? Script: function() local skinTXD = engineLoadTXD ( "Models/469.txd" ) --Sparrow/Ovni "aliens engineImportTXD ( skinTXD , 469 ) local skinDFF = engineLoadDFF("Models/469.dff", 469 ) engineReplaceModel(skinDFF , 469) local skinTXD = engineLoadTXD ( "Models/522.txd" ) --Nrg-500/Aerosphere "aliens" engineImportTXD ( skinTXD , 522 ) local skinDFF = engineLoadDFF("Models/469.dff", 522 ) engineReplaceModel(skinDFF , 522) end Meta: <meta> <info author="iSoRen" description="Random and replace skin" type="script" /> <script src="repleace.lua" /> <file src="Models/469.txd" /> <file src="Models/469.dff" /> <file src="Models/522.txd" /> <file src="Models/522.dff" /> </meta> 3 Script Este es el famoso script de Armas de Ghotem pero tengo un bug supremo Cual es ese bug? Deja el rastro de las armas de las espaladas es estresante y mete lag! aqui esta el script local jugadores = {} local lplayer = getLocalPlayer() local info = {} local sx,sy = guiGetScreenSize() function crearArma(jug,arma) local model = obtenerObjeto(arma) local slot = getSlotFromWeapon(arma) jugadores[jug][slot] = createObject(model,0,0,0) setElementCollisionsEnabled(jugadores[jug][slot],false) end function destruirArma(jug,slot) destroyElement(jugadores[jug][slot]) jugadores[jug][slot] = nil end addEventHandler("onClientResourceStart",getResourceRootElement(),function() for k,v in ipairs(getElementsByType("player",root,true)) do jugadores[v] = {} info[v] = {true,isPedInVehicle(v)} end end,false) addEventHandler("onClientPlayerQuit",root,function() if jugadores[source] and source ~= lplayer then for k,v in pairs(jugadores[source]) do destroyElement(v) end jugadores[source] = nil info[source] = nil end end) addEventHandler("onClientElementStreamIn",root,function() if getElementType(source) == "player" and source ~= lplayer then jugadores[source] = {} info[source] = {true,isPedInVehicle(source)} end end) addEventHandler("onClientElementStreamOut",root,function() if jugadores[source] and source ~= lplayer then for k,v in pairs(jugadores[source]) do destroyElement(v) end jugadores[source] = nil info[source] = nil end end) addEventHandler("onClientPlayerSpawn",root,function() if jugadores[source] then info[source][1] = true end end) addEventHandler("onClientPlayerWasted",root,function() if jugadores[source] then for k,v in pairs(jugadores[source]) do destruirArma(source,k) end info[source][1] = false end end) addEventHandler("onClientPlayerVehicleEnter",root,function() if jugadores[source] then for k,v in pairs(jugadores[source]) do destruirArma(source,k) end info[source][2] = true end end) addEventHandler("onClientPlayerVehicleExit",root,function() if jugadores[source] then info[source][2] = false end end) addEventHandler("onClientPreRender",root,function() for k,v in pairs(jugadores) do local x,y,z = getPedBonePosition(k,3) local rot = math.rad(90-getPedRotation(k)) local i = 15 local wep = getPedWeaponSlot(k) local ox,oy = math.cos(rot)*0.22,-math.sin(rot)*0.22 local alpha = getElementAlpha(k) for q,w in pairs(v) do if q == wep then destruirArma(k,q) else setElementRotation(w,0,70,getPedRotation(k)+90) setElementAlpha(w,alpha) if q==2 then local px,py,pz = getPedBonePosition(k,51) local qx,qy = math.sin(rot)*0.11,math.cos(rot)*0.11 setElementPosition(w,px+qx,py+qy,pz) elseif q==4 then local px,py,pz = getPedBonePosition(k,41) local qx,qy = math.sin(rot)*0.06,math.cos(rot)*0.06 setElementPosition(w,px-qx,py-qy,pz) else setElementPosition(w,x+ox,y+oy,z-0.2) setElementRotation(w,-17,-(50+i),getPedRotation(k)) i=i+15 end end end if info[k][1] and not info[k][2] then for i=1,7 do local arma = getPedWeapon(k,i) if arma~=wep and arma>0 and not jugadores[k][i] then crearArma(k,arma) end end end end end) function obtenerObjeto(arma) local m if arma > 1 and arma < 9 then m = 331 + arma elseif arma == 9 then m = 341 elseif arma == 15 then m = 326 elseif (arma > 21 and arma < 30) or (arma > 32 and arma < 39) or (arma > 40 and arma < 44) then m = 324 + arma elseif arma > 29 and arma < 32 then m = 325 + arma elseif arma == 32 then m = 372 end return m end Espero su ayuda Pronto Gracias Y una preguntita mas esta va especial para Solidsnake14 ves el banner de mi server abajo? como puedo hacer que cuando le pique se conecte a mi server? Edited February 18, 2012 by Guest Link to comment
Castillo Posted February 18, 2012 Share Posted February 18, 2012 1: checking = 0 function FPSStart () local x,y,z = getElementPosition( getLocalPlayer() ) Body = createObject (983, x, y, z ) attachElements ( Body, getLocalPlayer(), 0, -0.1, 0.45, 90, 0, 90) setElementAlpha( Body, 0) setTimer ( setElementAlpha,1000, 1, getLocalPlayer(), 0) end addCommandHandler("fps",FPSStart) function invisOnSpawn() setElementAlpha(getLocalPlayer(), 0) end addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), invisOnSpawn ) function climbcheck() setElementCollisionsEnabled(Body, false) if checking == 0 then checking = 1 stopclimbcheck = setTimer ( stopCcheck, 1200, 1 ) addEventHandler ("onClientRender", getRootElement(), areyouclimbing) elseif checking == 1 then killTimer(stopclimbcheck) stopclimbcheck = setTimer ( stopCcheck, 1200, 1 ) end end bindKey ("jump", "down", climbcheck ) function stopCcheck() setElementCollisionsEnabled(Body, true) removeEventHandler("onClientRender", getRootElement(), areyouclimbing) setCameraTarget (getLocalPlayer()) checking = 0 end function areyouclimbing() hx,hy,hz = getPedBonePosition ( getLocalPlayer(), 8 ) local rot = getPedRotation (getLocalPlayer()) radRot = math.rad ( rot ) local radius = .5 local tx = hx + radius * math.sin(radRot) local ty = hy + -(radius) * math.cos(radRot) local tz = hz setCameraMatrix(tx,ty,tz,hx,hy,hz) if ( isPedDoingTask ( getLocalPlayer(), "TASK_SIMPLE_CLIMB" ) ) then killTimer(stopclimbcheck) doneclimbyet = setTimer ( finishCcheck, 400, 1 ) end end function finishCcheck() if ( isPedDoingTask ( getLocalPlayer(), "TASK_SIMPLE_CLIMB" ) ) then doneclimbyet = setTimer ( finishCcheck, 400, 1 ) else finishedclimbing() end end function finishedclimbing() checking = 0 removeEventHandler("onClientRender", getRootElement(), areyouclimbing) setElementCollisionsEnabled(Body, true) setCameraTarget (getLocalPlayer()) end function FPSStop (startedresource) if startedresource == getThisResource() then setElementAlpha( getLocalPlayer(), 255) setCameraTarget (getLocalPlayer()) end end addEventHandler ( "onClientResourceStop", getRootElement(), FPSStop) function shakeCamera(weapon) x,y,z = getPedBonePosition ( getLocalPlayer(), 26 ) if weapon == 24 then createExplosion ( x,y,z + 10,12,false,0.4,false) elseif weapon == 25 then createExplosion ( x,y,z + 10,12,false,0.5,false) elseif weapon == 26 then createExplosion ( x,y,z + 10,12,false,0.7,false) elseif weapon == 27 then createExplosion ( x,y,z + 10,12,false,0.5,false) elseif weapon == 29 then createExplosion ( x,y,z + 10,12,false,0.2,false) elseif weapon == 30 then createExplosion ( x,y,z+10,12,false,0.2,false) elseif weapon == 31 then createExplosion ( x,y,z + 10,12,false,0.3,false) elseif weapon == 33 then createExplosion ( x,y,z + 10,12,false,0.3,false) elseif weapon == 34 then createExplosion ( x,y,z + 10,12,false,0.3,false) elseif weapon == 22 then createExplosion ( x,y,z + 10,12,false,0.1,false) elseif weapon == 28 then createExplosion ( x,y,z + 10,12,false,0.2,false) elseif weapon == 32 then createExplosion ( x,y,z + 10,12,false,0.2,false) elseif weapon == 38 then createExplosion ( x,y,z + 10,12,false,0.6,false) end end addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), shakeCamera ) function carcheck(player) if player == getLocalPlayer() then abortCarEnterCheck = setTimer ( checkCarTask, 100, 1 ) setElementCollisionsEnabled(Body, false) setElementAlpha(getLocalPlayer(), 255) end end addEventHandler ( "onClientVehicleStartEnter", getRootElement(), carcheck ) function checkCarTask() local stask = getPedSimplestTask(getLocalPlayer()) if (stask == "TASK_SIMPLE_CAR_GET_IN") or (stask == "TASK_SIMPLE_GO_TO_POINT") or (stask == "TASK_SIMPLE_CAR_OPEN_DOOR_FROM_OUTSIDE") or (stask == "TASK_SIMPLE_CAR_ALIGN") or (stask == "TASK_SIMPLE_CAR_CLOSE_DOOR_FROM_INSIDE") or (stask == "TASK_SIMPLE_CAR_SHUFFLE") or (stask == "TASK_SIMPLE_CAR_DRIVE") or (stask == "TASK_SIMPLE_ACHIEVE_HEADING") then abortCarEnterCheck = setTimer ( checkCarTask, 100, 1 ) elseif (isPedInVehicle(getLocalPlayer()) == false) then --enter vehicle was aborted setElementCollisionsEnabled(Body, true) setElementAlpha(getLocalPlayer(), 0) end end function carexit(player) if player == getLocalPlayer() then setElementCollisionsEnabled(Body, true) setElementAlpha(getLocalPlayer(), 0) end end addEventHandler ( "onClientVehicleExit", getRootElement(), carexit ) end) 2: Te falto agregarle un evento para la funcion. addEventHandler("onClientResourceStart",resourceRoot, function() local skinTXD = engineLoadTXD ( "Models/469.txd" ) --Sparrow/Ovni "aliens engineImportTXD ( skinTXD , 469 ) local skinDFF = engineLoadDFF("Models/469.dff", 469 ) engineReplaceModel(skinDFF , 469) local skinTXD = engineLoadTXD ( "Models/522.txd" ) --Nrg-500/Aerosphere "aliens" engineImportTXD ( skinTXD , 522 ) local skinDFF = engineLoadDFF("Models/469.dff", 522 ) engineReplaceModel(skinDFF , 522) end ) Link to comment
Soren Posted February 18, 2012 Author Share Posted February 18, 2012 Muchisimas gracias Edit: El commando no funciono Link to comment
ghost050 Posted February 19, 2012 Share Posted February 19, 2012 <meta> <info author="iSoRen" description="Random and replace skin" type="script" /> <script src="repleace.lua" type="client" /> <file src="Models/469.txd" /> <file src="Models/469.dff" /> <file src="Models/522.txd" /> <file src="Models/522.dff" /> </meta> el meta estaba mal Link to comment
Recommended Posts