Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tagTextures={
- ["Sons of Anarchy"]="images/Reaper.png"
- ["Tuga Turks"]="images/TugaTurks.png",
- ["Hell soldiers"]="images/Nigger.png",
- }
- local tags={}
- local tagShaders={}
- local tagModel=1528
- local tagTexture="seville"
- local selectedTag=nil
- local screenx,screeny=guiGetScreenSize()
- local acceptableAmmo={[5]=true,[125]=true,[250]=true,[375]=true,[450]=true}
- function selectTag(fileName)
- if fileExists(fileName) then
- selectedTag=fileName
- return true
- end
- end
- function selectTagCommand(command,index)
- local index=tonumber(index)
- if tagTextures[index]~=nil then
- selectedTag=tagTextures[index]
- end
- end
- addCommandHandler("tag",selectTagCommand)
- selectTag("images/Anarchy.png")
- selectTag("images/SoA.png")
- selectTag("images/Reaper.png")
- function applyShaderToTag(tag)
- if isElement(tag) then
- local correspondingShader=tagShaders[selectedTag]
- if correspondingShader~=nil then
- engineApplyShaderToWorldTexture(correspondingShader,tagTexture,tag)
- end
- end
- end
- function spraycan(weapon,ammo,ammoInClip,hitX,hitY,hitZ,hitElement)
- if weapon==41 and acceptableAmmo[ammoInClip]==true then
- local player=source
- if hitElement==nil then
- local midX,midY=screenx*0.5,screeny*0.5
- local x,y,z=getWorldFromScreenPosition(midX,midY,3)
- local x2,y2,z2=getWorldFromScreenPosition(midX,midY,6)
- local hit,hx,hy,hz,element=processLineOfSight(x,y,z,x2,y2,z2,true,true,false,true)
- local deltaX,deltaY=hx-x,hy-y
- local x,y=x+deltaX*0.95,y+deltaY*0.95
- if hit==true and x and y and z then
- local rx,ry,rz=getElementRotation(player)
- local rz=rz+83
- local tag=createObject(tagModel,x,y,z,rx,ry,rz)
- applyShaderToTag(tag)
- --local tagMarker=createMarker(x,y,z,"corona")
- end
- end
- end
- end
- addEventHandler("onClientPlayerWeaponFire",getRootElement(),spraycan)
- function setupAllShaders()
- for id,textureName in pairs(tagTextures) do
- local myShader
- myShader, tec = dxCreateShader ( "tagShader.fx" )
- local myTexture = dxCreateTexture (textureName)
- dxSetShaderValue ( myShader, "CUSTOMTEX0", myTexture );
- tagShaders[textureName]=myShader
- end
- end
- addEventHandler( "onClientResourceStart",resourceRoot,setupAllShaders)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement