GrubaS
Members-
Posts
100 -
Joined
-
Last visited
Everything posted by GrubaS
-
Hello, i have a question about Spectators it's possible to if someone is in team "Spectators" then not appear on map (race gamemode)
-
I tried that killerss = getPlayerName(getElementData(getPlayerFromPartialName(name),"lasthit")) but still doesnt work ;x
-
Hello, guys I have no idea how to fix it i want make on chatbox example. "Terrorist Died! (killed by Terrorist2)" its destruction derby script please help clinet side: function gowmo(name) killerss = getPlayerName(getElementData(getPlayerName(getLocalPlayer()),"lasthit")) alivePlayers = 0 for i ,v in ipairs (getElementsByType("player")) do if getElementData(v,"state") == "alive" then alivePlayers = alivePlayers + 1 end end if alivePlayers == 1 then setElementData(getPlayerFromPartialName(name),"lasthit",nil) end local team = getPlayerTeam(source) local r,g, b = getTeamColor(team) local hex = RGBToHex (r, g, b) outputChatBox("*"..hex..""..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." #FF6060died!"..killerss, 255, 96, 96, true) end addEventHandler("onClientPlayerWasted",getRootElement(), gowmo) function RGBToHex(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) else return string.format("#%.2X%.2X%.2X", red,green,blue) end end addEventHandler("onClientVehicleCollision",root, function(hitElement) if source == getPedOccupiedVehicle(localPlayer) then if hitElement and getElementType(hitElement) == 'vehicle' then local driver = getVehicleController(source) local hDriver = getVehicleController(hitElement) if hDriver and driver then setElementData(driver,"lasthit",hDriver) if isTimer(timer) then killTimer(timer) end timer = setTimer(setElementData,5000,1,driver,"lasthit",nil) end end end end ) function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end Debugscript 3 Lines,2:bad argument 'getelementdata' [Expecnted element at argument 1, got string 'Terrorist'] Lines,2: bad argument 'getelementdata' [Expected element at argument 1, got nil] Linse,10: bad argument 'getplayername'[Expected element at argument 1, got nil] Linse, 10: attempt to concatenate global 'killerss'(a boolean value)
-
but now its not showing any error and eye
-
I fixed it ( added to race_client local g_PickupStartTick = getTickCount()
-
it's my, but i thought dont need server side.
-
element-data can return anything whether it's a string, boolean, vehicle, etc... The problem is the element-data is returning a vehicle when you want it to return a ped. Try using this: if ( type ( getElementData(source,"dlspec") ) == "userdata" and getElementType ( getElementData(source,"dlspec") ) == "vehicle" and getVehicleController ( getElementData(source,"dlspec") ) == target ) then now in debugscript 3: race_client: 349, attempt to perform arihmetic on blobal 'g_PickupStartTick'(a nil value)
-
Hello, I'm making the script for specs on deathlist addEventHandler("onClientRender", root, function() for id, elem in pairs(playerLabel) do alphaElem[elem] = alphaElem[elem] + 2 if alphaElem[elem] > 255 then alphaElem[elem] = 255 elseif alphaElem[elem] < 0 then alphaElem[elem] = 0 end end for id, elem in pairs(posLabel) do alphaElem[elem] = alphaElem[elem] + 2 if alphaElem[elem] > 255 then alphaElem[elem] = 255 elseif alphaElem[elem] < 0 then alphaElem[elem] = 0 end end for id, elem in pairs(playerLabel) do if guiGetVisible(elem) and string.len(guiGetText(elem)) > 4 then local x,y = guiGetPosition(elem, false ) local a = guiGetAlpha(elem) * 255 if not getKeyState("tab") then if getElementData(elem,"spectated") then colorElem[elem] = {255,153,0} else colorElem[elem] = {30,30,30} end dxDrawColoredLabel(string.gsub(guiGetText(elem)," ", " #ffffff",1), 50,y,200,y+20, tocolor(255,255,255,alphaElem[elem]),{Cr,Cg,Cb,alphaElem[elem]}, 1, font, "left", "center", false,false,false) if getElementData(elem, "spectated") then dxDrawImage(20,y,16,16,"img/eye.png", 0,0,0,tocolor(255,255,255,255), false) end local target = getCameraTarget() if target then if isElement(localPlayer) then local spectatedperson = getCameraTarget() setElementData(localPlayer,"dlspec", spectatedperson) if getPedOccupiedVehicle(getElementData(source,"dlspec")) == target then dxDrawImage(20,y,16,16,"img/eye.png",tocolor(255,255,255,false)) end end end end if x < 100 then guiSetPosition(elem, sx+100,y,false) end end end for id, elem in pairs(posLabel) do if guiGetVisible(elem) and string.len(guiGetText(elem)) <= 4 then local x,y = guiGetPosition(elem, false ) local a = guiGetAlpha(elem) * 255 if not getKeyState("tab") then if getElementData(elem,"spectated") then dxDrawText(guiGetText(elem), 1,y+1,41,y+21, tocolor(0,0,0,alphaElem[elem]), 1, font, "right", "center", false,false,false) dxDrawText(guiGetText(elem), 0,y,40,y+20, tocolor(255,69,0,alphaElem[elem]), 1, font, "right", "center", false,false,false) else dxDrawText(guiGetText(elem), 1,y+1,41,y+21, tocolor(0,0,0,alphaElem[elem]), 1, font, "right", "center", false,false,false) dxDrawText(guiGetText(elem), 0,y,40,y+20, tocolor(255,255,255,alphaElem[elem]), 1, font, "right", "center", false,false,false) end end if x < 100 then guiSetPosition(elem, sx+100,y,false) end end end end ) + setTimer( function () local spectatedperson = getCameraTarget() setElementData(localPlayer,"dlspec", spectatedperson) end, 500,0) debugscript 3: if getPedOccupiedVehicle(getElementData(source,"dlspec")) == target then (Expected ped at argument 1, got vehicle)
-
Hello guys, I want make script in dxDrawRectangle example: "Ananas has killed Apple" local x,y = guiGetScreenSize() -- Get players resolution. local name = getPlayerName ( localPlayer ) -- Get players name. function drawStuff(name) killerss = getPlayerName(getElementData(getPlayerFromPartialName(name),"lasthit")) alivePlayers = 0 for i ,v in ipairs (getElementsByType("player")) do if getElementData(v,"state") == "alive" then alivePlayers = alivePlayers + 1 end end if alivePlayers == 1 then setElementData(getPlayerFromPartialName(name),"lasthit",nil) end dxDrawRectangle ( x/85.8, y/1.6, x/10.02, y/25, tocolor ( 0, 0, 0, 150 ) ) -- Create our black transparent MOTD background Rectangle. dxDrawText ( name.." has killed "..killers, x/85.5, y/1.6, x, y, tocolor ( 255, 255, 255, 255 ), 1, "bankgothic" ) -- Create Welcome title. end addEventHandler("onClientVehicleCollision",root, function(hitElement) if source == getPedOccupiedVehicle(localPlayer) then if hitElement and getElementType(hitElement) == 'vehicle' then local driver = getVehicleController(source) local hDriver = getVehicleController(hitElement) if hDriver and driver then setElementData(driver,"lasthit",hDriver) if isTimer(timer) then killTimer(timer) end timer = setTimer(setElementData,5000,1,driver,"lasthit",nil) end end end end )
-
I want make it (rainbowcolor) in gui but when i press button "Disco Car" its working for all Client Side! GUIEditor = { button = {}, window = {} } spawnScreenMenu = guiCreateWindow(146, 253, 359, 149, "", false) guiWindowSetSizable(spawnScreenMenu, false) guiSetAlpha(spawnScreenMenu, 0.46) guiSetVisible(spawnScreenMenu, false) guiWindowSetSizable(spawnScreenMenu, false) przycisk = guiCreateButton(10, 56, 124, 46, "Disco Car", false, spawnScreenMenu) guiSetFont(przycisk, "default-bold-small") guiSetProperty(przycisk, "NormalTextColour", "FF2BDF01") przycisk2 = guiCreateButton(225, 56, 124, 46, "Disco Lights", false, spawnScreenMenu) guiSetFont(przycisk2, "default-bold-small") guiSetProperty(przycisk2, "NormalTextColour", "FF2BDF01") addCommandHandler("gowno", function () guiSetVisible ( spawnScreenMenu, not guiGetVisible ( spawnScreenMenu ) ) showCursor ( guiGetVisible ( spawnScreenMenu ) ) end) function rainbowColor() triggerServerEvent ( "gowno1", resourceRoot ) end function discoheadlights() triggerServerEvent ( "gowno2", resourceRoot ) end isRainbowColor = false isLightRainbowColor = false addEventHandler("onClientGUIClick", root, function() if ( source == przycisk ) then if isRainbowColor then if isTimer(RainbowTimer) then killTimer(RainbowTimer) end isRanbowColor = false else RainbowTimer = setTimer(rainbowColor,500,0) isRanbowColor = true end elseif ( source == przycisk2 ) then if isLightRainbowColor then if isTimer(LightTimer) then killTimer(LightTimer) end isLightRainbowColor = false else LightTimer = setTimer(discoheadlights,500,0) isLightRainbowColor = true end end end ) Server Side! addEvent( "gowno1", true ) addEventHandler( "gowno1", resourceRoot, function () for id,player in ipairs(getElementsByType("player")) do local vehicle = getPedOccupiedVehicle(player) if vehicle then if getElementDimension(vehicle) == 0 then setVehicleColor(vehicle, math.random(0,255), math.random(0,255), math.random(0,255), math.random(0,255), math.random(0,255), math.random(0,255) ) end end end end addEvent( "gowno2", true ) addEventHandler( "gowno2", resourceRoot, function (btn) for id,player in ipairs(getElementsByType("player")) do local car = getPedOccupiedVehicle(player) if car and isElement(car) then local l1 = getVehicleLightState(car,0) if l1 == 0 then setVehicleHeadLightColor(car,math.random(0,255),math.random(0,255),math.random(0,255)) setVehicleLightState(car,0,1) setVehicleLightState(car,2,1) setVehicleLightState(car,1,0) setVehicleLightState(car,3,0) else setVehicleHeadLightColor(car,math.random(0,255),math.random(0,255),math.random(0,255)) setVehicleLightState(car,0,0) setVehicleLightState(car,2,0) setVehicleLightState(car,1,1) setVehicleLightState(car,3,1) end end end end
-
Hello guys, it's possible to make rainbow colors for one car? not for all? (every 5 secounds change colors) function randomVehColors() for i, car in ipairs( getElementsByType( "vehicle" ) ) do local color = {} color[1] = math.random(0,126) color[2] = math.random(0,126) color[3] = math.random(0,126) color[4] = math.random(0,126) setVehicleColor ( car, color[1], color[2], color[3], color[4] ) end end setTimer( randomVehColors, 500, 0 )
-
thanks for answer but i fixed it thanks
-
Hello guys, I want make script when Player join then it will be shows color team. I trying with setTimer bcz without setTimer it will be get "Spectators" team color after 2 secs CWSCRIPT moves players to team. (cwscript is decompiled) but when join players are in team "Spectators" It's my code. + this setTimer dont working function gowno(gowno) setTimer( function () local r,g,b = getTeamColor(getPlayerTeam(source)) local hex = RGBToHex(r,g,b) outputChatBox("* "..hex..""..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." #FF6464has joined the game", gowno, 255, 100, 100, true) end, 5000, 1) end addEventHandler('onPlayerJoin', root, gowno ) function RGBToHex(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) else return string.format("#%.2X%.2X%.2X", red,green,blue) end end Sorry for my bad english.
-
Debugscript: Attempt to call global 'outputChatBox' (a nil value)
-
nothing
-
I tried but it dont works
-
Hello, Why its dont work? when i made it on command it works without any problems function gowno() local r,g,b = getTeamColor(getPlayerTeam(source)) local hex = RGBToHex(r,g,b) outputChatBox('dead'..hex..""..getPlayerName(source), getRootElement(), 255,255,255,true) end addEventHandler( "onPlayerWasted", getRootElement( ), gowno) function RGBToHex(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) else return string.format("#%.2X%.2X%.2X", red,green,blue) end end
-
still dont working client.lua.46 Bad Argument @ 'guiSetText' [Expected string at argument 2, got boolean] client.lua.46 Bad Argument @ 'getPlayerName' [Expected string at argument 1, got nil]
