Ryuto Posted December 14, 2014 Share Posted December 14, 2014 Hola amigos estube haciendo un script y me aparece este error SCRIPT ERROR: asesino\matar.lua:13: unexpected symbol near ´local´ Aqui dejo el lua local itigoo_gentsugatenshou = function(player,k,ks) if isPedInVehicle(player) then return end if(getPedWeapon(player)~=5) then return end setPedAnimation(player,"SWORD","sword_4",-1,false,true,false,false) local x,y,z = getElementPosition(player) local r = getPedRotation(player) triggerClientEvent("CreateNinjaSound",root,player,"risa.mp3") local nx = x+math.sin(math.rad(-r))*0.5 local ny = y+math.cos(math.rad(-r))*0.5 triggerClientEvent("CreateMoveLine",root,player,{nx,ny,z,2,1000,r,0.2}) end addEventHandler("onGentsuHit",root, local onGentsuHit = function(p,k,hame) if(k==nil) and(hame==nil) then setPedAnimation(p,"ped","KO_skid_front",-1,false,true,false,false) local h = getElementHealth(p) local vidae = (getElementData(p,"PedExtraHealth")) or 0 if(vidae>40) then setElementData(p,"PedExtraHealth",vidae-40) else if(h>40)then setElementHealth(p,h-40) else killPed(p,client) end end elseif(k) and (hame==nil)then setPedAnimation(p,"ped","KO_skid_front",-1,false,true,false,false) local h = getElementHealth(p) local vidae = (getElementData(p,"PedExtraHealth")) or 0 if(vidae>80) then setElementData(p,"PedExtraHealth",vidae-80) else if(h>80)then setElementHealth(p,h-80) else killPed(p,client) end end elseif(k) and (hame=="hame")then setPedAnimation(p,"ped","BIKE_fallR",-1,false,true,false,false) local h = getElementHealth(p) local vidae = (getElementData(p,"PedExtraHealth")) or 0 if(vidae>100) then setElementData(p,"PedExtraHealth",vidae-100) else if(h>100)then setElementHealth(p,h-100) else killPed(p,client) end end elseif(k) and (hame=="genki")then local x,y,z = getElementPosition(p) createExplosion(x,y,z,0) setPedAnimation(p,"ped","BIKE_fallR",-1,false,true,false,false) local h = getElementHealth(p) local vidae = (getElementData(p,"PedExtraHealth")) or 0 if(vidae>200) then setElementData(p,"PedExtraHealth",vidae-200) else killPed(p,client) end end end end addCommandHandler ("magia-asesino", itigoo_gentsugatenshou) addCommandHandler ("magia-asesino", onGentsuHit) Por favor ayudenme con este error Link to comment
Tomas Posted December 14, 2014 Share Posted December 14, 2014 Cuando utilizas por ejemplo: addEventHandler("onClientPreRender",root, no se puede nombrar la función, ese es el problema que te pasa a ti, utiliza esto: local itigoo_gentsugatenshou = function(player,k,ks) if isPedInVehicle(player) then return end if(getPedWeapon(player)~=5) then return end setPedAnimation(player,"SWORD","sword_4",-1,false,true,false,false) local x,y,z = getElementPosition(player) local r = getPedRotation(player) triggerClientEvent("CreateNinjaSound",root,player,"risa.mp3") local nx = x+math.sin(math.rad(-r))*0.5 local ny = y+math.cos(math.rad(-r))*0.5 triggerClientEvent("CreateMoveLine",root,player,{nx,ny,z,2,1000,r,0.2}) end addEventHandler("onGentsuHit",root,function(p,k,hame) if(k==nil) and(hame==nil) then setPedAnimation(p,"ped","KO_skid_front",-1,false,true,false,false) local h = getElementHealth(p) local vidae = (getElementData(p,"PedExtraHealth")) or 0 if(vidae>40) then setElementData(p,"PedExtraHealth",vidae-40) else if(h>40)then setElementHealth(p,h-40) else killPed(p,client) end end elseif(k) and (hame==nil)then setPedAnimation(p,"ped","KO_skid_front",-1,false,true,false,false) local h = getElementHealth(p) local vidae = (getElementData(p,"PedExtraHealth")) or 0 if(vidae>80) then setElementData(p,"PedExtraHealth",vidae-80) else if(h>80)then setElementHealth(p,h-80) else killPed(p,client) end end elseif(k) and (hame=="hame")then setPedAnimation(p,"ped","BIKE_fallR",-1,false,true,false,false) local h = getElementHealth(p) local vidae = (getElementData(p,"PedExtraHealth")) or 0 if(vidae>100) then setElementData(p,"PedExtraHealth",vidae-100) else if(h>100)then setElementHealth(p,h-100) else killPed(p,client) end end elseif(k) and (hame=="genki")then local x,y,z = getElementPosition(p) createExplosion(x,y,z,0) setPedAnimation(p,"ped","BIKE_fallR",-1,false,true,false,false) local h = getElementHealth(p) local vidae = (getElementData(p,"PedExtraHealth")) or 0 if(vidae>200) then setElementData(p,"PedExtraHealth",vidae-200) else killPed(p,client) end end end end addCommandHandler ("magia-asesino", itigoo_gentsugatenshou) addCommandHandler ("magia-asesino", onGentsuHit) Link to comment
Ryuto Posted December 14, 2014 Author Share Posted December 14, 2014 Cuando utilizas por ejemplo: addEventHandler("onClientPreRender",root, no se puede nombrar la función, ese es el problema que te pasa a ti, utiliza esto: local itigoo_gentsugatenshou = function(player,k,ks) if isPedInVehicle(player) then return end if(getPedWeapon(player)~=5) then return end setPedAnimation(player,"SWORD","sword_4",-1,false,true,false,false) local x,y,z = getElementPosition(player) local r = getPedRotation(player) triggerClientEvent("CreateNinjaSound",root,player,"risa.mp3") local nx = x+math.sin(math.rad(-r))*0.5 local ny = y+math.cos(math.rad(-r))*0.5 triggerClientEvent("CreateMoveLine",root,player,{nx,ny,z,2,1000,r,0.2}) end addEventHandler("onGentsuHit",root,function(p,k,hame) if(k==nil) and(hame==nil) then setPedAnimation(p,"ped","KO_skid_front",-1,false,true,false,false) local h = getElementHealth(p) local vidae = (getElementData(p,"PedExtraHealth")) or 0 if(vidae>40) then setElementData(p,"PedExtraHealth",vidae-40) else if(h>40)then setElementHealth(p,h-40) else killPed(p,client) end end elseif(k) and (hame==nil)then setPedAnimation(p,"ped","KO_skid_front",-1,false,true,false,false) local h = getElementHealth(p) local vidae = (getElementData(p,"PedExtraHealth")) or 0 if(vidae>80) then setElementData(p,"PedExtraHealth",vidae-80) else if(h>80)then setElementHealth(p,h-80) else killPed(p,client) end end elseif(k) and (hame=="hame")then setPedAnimation(p,"ped","BIKE_fallR",-1,false,true,false,false) local h = getElementHealth(p) local vidae = (getElementData(p,"PedExtraHealth")) or 0 if(vidae>100) then setElementData(p,"PedExtraHealth",vidae-100) else if(h>100)then setElementHealth(p,h-100) else killPed(p,client) end end elseif(k) and (hame=="genki")then local x,y,z = getElementPosition(p) createExplosion(x,y,z,0) setPedAnimation(p,"ped","BIKE_fallR",-1,false,true,false,false) local h = getElementHealth(p) local vidae = (getElementData(p,"PedExtraHealth")) or 0 if(vidae>200) then setElementData(p,"PedExtraHealth",vidae-200) else killPed(p,client) end end end end addCommandHandler ("magia-asesino", itigoo_gentsugatenshou) addCommandHandler ("magia-asesino", onGentsuHit) Muchas gracias ya funciono pero tengo un nuevo error SCRIPT ERROR: asesino\matar.lua:66: ´)´ expected (to close ´(´ at line 13) near ´end´ Link to comment
TheOskar Posted December 14, 2014 Share Posted December 14, 2014 local itigoo_gentsugatenshou = function(player,k,ks) if isPedInVehicle(player) then return end if(getPedWeapon(player)~=5) then return end setPedAnimation(player,"SWORD","sword_4",-1,false,true,false,false) local x,y,z = getElementPosition(player) local r = getPedRotation(player) triggerClientEvent("CreateNinjaSound",root,player,"risa.mp3") local nx = x+math.sin(math.rad(-r))*0.5 local ny = y+math.cos(math.rad(-r))*0.5 triggerClientEvent("CreateMoveLine",root,player,{nx,ny,z,2,1000,r,0.2}) end addEventHandler("onGentsuHit",root,function(p,k,hame) if(k==nil) and(hame==nil) then setPedAnimation(p,"ped","KO_skid_front",-1,false,true,false,false) local h = getElementHealth(p) local vidae = (getElementData(p,"PedExtraHealth")) or 0 if(vidae>40) then setElementData(p,"PedExtraHealth",vidae-40) else if(h>40)then setElementHealth(p,h-40) else killPed(p,client) end end elseif(k) and (hame==nil)then setPedAnimation(p,"ped","KO_skid_front",-1,false,true,false,false) local h = getElementHealth(p) local vidae = (getElementData(p,"PedExtraHealth")) or 0 if(vidae>80) then setElementData(p,"PedExtraHealth",vidae-80) else if(h>80)then setElementHealth(p,h-80) else killPed(p,client) end end elseif(k) and (hame=="hame")then setPedAnimation(p,"ped","BIKE_fallR",-1,false,true,false,false) local h = getElementHealth(p) local vidae = (getElementData(p,"PedExtraHealth")) or 0 if(vidae>100) then setElementData(p,"PedExtraHealth",vidae-100) else if(h>100)then setElementHealth(p,h-100) else killPed(p,client) end end elseif(k) and (hame=="genki")then local x,y,z = getElementPosition(p) createExplosion(x,y,z,0) setPedAnimation(p,"ped","BIKE_fallR",-1,false,true,false,false) local h = getElementHealth(p) local vidae = (getElementData(p,"PedExtraHealth")) or 0 if(vidae>200) then setElementData(p,"PedExtraHealth",vidae-200) else killPed(p,client) end end end ) addCommandHandler ("magia-asesino", itigoo_gentsugatenshou) addCommandHandler ("magia-asesino", onGentsuHit) ?) Link to comment
Recommended Posts