-
Posts
605 -
Joined
-
Last visited
-
Days Won
1
Everything posted by JeViCo
-
+ onPlayerLogin event + set/getElementData @Samking
-
function wczytaj() txd = engineLoadTXD ( "models/ak47.txd" ) dff = engineLoadDFF ( "models/ak47.dff" ) --outputChatBox ( "wczytano podmianki" ) end addEventHandler( "onClientResourceStart", resourceRoot, wczytaj ) function podmiankibronki () local bronka = getPlayerWeapon ( localPlayer ) if(getElementData(localPlayer,"currentweapon_1") == "AK47" and bronka == 31) then engineImportTXD ( txd, 356 ) engineReplaceModel ( dff, 356 ) outputChatBox ( "wczytano ak47" ) end end addEventHandler( "onClientPlayerWeaponSwitch", localPlayer, podmiankibronki ) @IStarkI
-
it's a shared function. The main difference between server and client: server contains player variable. client-side example: bindKey("g","down",function() -- your function here end) -- "g" - key to press -- "down" - key pressed ("up" if key released) server-side example: addEventHandler("onPlayerLogin",getRootElement(),function() bindKey(source,"g","down",function() -- your function here end) end) -- source - player variable in this event -- "g" - key to press -- "down" - key pressed ("up" if key released) @MRThinker
-
Hello! I'm trying to make the player rotate +-30° in both directions with onClientCursorMove event something like this -- aX is an absolute position of cursor in this event local w, h = guiGetScreenSize() aX = aX - w / 2 local h_rot = rz+aX/2 -- aX/2 - make rotation smoother if h_rot >= 360 then h_rot = h_rot - 360 elseif h_rot < 0 then h_rot = 360 + h_rot end --local crot_l = sh.camrot - 30 --local crot_r = sh.camrot + 30 --print("h_rot: "..math.floor(h_rot)..", crot: "..math.floor(crot)) --if h_rot >= crot_l and h_rot <= crot_r then setElementRotation(localPlayer,0,0,h_rot) --end
-
(I guess i understood you) You can use createColSphere function server-side, attach colSphere to vehicle. After that, use onVehicleExplode event + isElementWithinColShape function to kill players nearby a car @KINGKHAN that's even better :3
-
1. onClientPedDamage (2-nd parameter). cancelEvent() will disable damage 2. element data . You can store it into database by using triggerServerEvent triggerServerEvent("your_event_name",localPlayer,getElementData(localPlayer,"name") ) 3. I can't undestand this question a little bit. @wlasser
-
I highly recommend you to use sqlite/mysql database to save everything. Anyway, if you use xml, you should create child with player's account name and store information such as drift points with xmlNodeSetAttribute @Pedro001
-
Those animations are visible only when ped's muscle stat has 1000 value. You can change this stat only when you're using CJ skin.
-
yes. If you can find similar player animations, you can avoid skin change
-
Look. Player is standing, running, crouching. Muscular and normal animations are almost same but their nameы differ. I can't find normal ones in ped category. It might help you too (sorry if you can't understand me )
-
uhh i know. Same problem. I asked for animation names earlier but i didn't get any good replies. I also tried to look for it on GTA forums :\
-
replace it, change skin to CJ and paste setPedStat(localPlayer,23,1000) (it is client-side now but you can make it server-side anytime)
-
it won't affect on animation now. Download this animation and replace with original. I downloaded them from another video
-
it isn't a walking style. muscular.ifp provides it. Replace this ifp + CJ skin + setPedStat (23-rd stat) + value 1000 and you'll get that animations @Dretax
-
local sx, sy = guiGetScreenSize ( ) function centerGUI ( guiElement ) local width, height = guiGetSize ( guiElement, false ) local x, y = ( sx / 2 - width / 2 ), ( sy / 2 - height / 2 ) guiSetPosition ( guiElement, x, y, false ) end function showHide() if isElement(wind) then destroyElement(wind) showCursor(false) removeEventHandler("onClientGUIClick",getRootElement(),buttonClick) end end addEventHandler("showHide",getLocalPlayer(),showHide) function showGUI (event) wind = guiCreateWindow(423, 331, 523, 367, "", false) guiWindowSetSizable(wind, false) showCursor(true) centerGUI(wind) -- tabpanel = guiCreateTabPanel(11, 109, 502, 241, false, wind) bt_close = guiCreateButton(5, 5, 153, 42, "Закрыть", false, wind) local memo = guiCreateMemo(11, 109, 502, 241,event['description'],false,wind) guiMemoSetReadOnly(memo, true) bt_accept = guiCreateButton(5, 55, 153, 42, "Принять", false, wind) eventButton = event addEventHandler("onClientGUIClick",getRootElement(),buttonClick) end addEvent("showEventGUI", true) addEventHandler( "showEventGUI", localPlayer, showGUI ) function buttonClick(bt, st) if bt == "left" and st == "down" then if source == bt_close then showHide() elseif source == bt_accept then -- triggerServerEvent("startEvent") --function startEvent(eventId, player) triggerServerEvent("startEvent",resourceRoot, localPlayer, eventButton['id']) -- there is event_id? showHide() end end end i made a little edit. Now it should work properly @wlasser
-
Tieing function to onMarkerHit results in looping teleport
JeViCo replied to Sorata_Kanda's topic in Scripting
I guess i understood you. Use cylinder marker type (most common). You can also test range with onMarkerLeave -
local sx, sy = guiGetScreenSize ( ) function centerGUI ( guiElement ) local width, height = guiGetSize ( guiElement, false ) local x, y = ( sx / 2 - width / 2 ), ( sy / 2 - height / 2 ) guiSetPosition ( guiElement, x, y, false ) end function showHide() if guiGetVisible(wind) then guiSetVisible(wind,false) showCursor(false) removeEventHandler("onClientGUIClick",getRootElement(),buttonClick) elseif guiGetVisible(wind) == false then guiSetVisible(wind,true) showCursor(true) addEventHandler("onClientGUIClick",getRootElement(),buttonClick) end end addEventHandler("showHide",getLocalPlayer(),showHide) function showGUI (event) wind = guiCreateWindow(423, 331, 523, 367, "", false) guiWindowSetSizable(wind, false) showCursor(true) centerGUI(wind) -- tabpanel = guiCreateTabPanel(11, 109, 502, 241, false, wind) bt_close = guiCreateButton(5, 5, 153, 42, "Закрыть", false, wind) local memo = guiCreateMemo(11, 109, 502, 241,event['description'],false,wind) guiMemoSetReadOnly(memo, true) bt_accept = guiCreateButton(5, 55, 153, 42, "Принять", false, wind) eventButton = event end addEvent("showEventGUI", true) addEventHandler( "showEventGUI", localPlayer, showGUI ) function buttonClick(bt, st) if bt == "left" and st == "down" then if source == bt_close then showHide() elseif source == bt_accept then -- triggerServerEvent("startEvent") --function startEvent(eventId, player) triggerServerEvent("startEvent",resourceRoot, localPlayer, eventButton['id']) -- there is event_id? showHide() end end end @wlasser
-
saving with in-game id is a bad idea. Try getAccountID to get id of referal account and getAccountByID to give this guy a reward @Mσнαмα∂ Hєℓιѕн
-
function enterVehicle (player, seat) if getElementModel(source) == 412 and seat == 0 then local accName = getAccountName(getPlayerAccount (player)) if not isPlayerInGroup (player, "VIP") then cancelEvent() outputChatBox ( "you must be VIP to use this vehicle", player) end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) --------- addCommandHandler( 'givemoney', function( source,_,player,amount ) if amount then if isPlayerInGroup(source,"Admin") then local find = findPlayer( player ) if find then if amount then -- If player type amount ( full command /givemoney [nickname][amount] ) givePlayerMoney( find,tonumber( amount ) ) -- give money for player outputChatBox( '[givemoney]:You transfer $'..amount..' to '..getPlayerName( find ),source,255,0,0 ) else -- player not type full command ( /givemoney [nickname][amount] ) outputChatBox( '[givemoney]:/givemoney [playername][amount]!',source,255,0,0 ) end else outputChatBox( '[givemoney]:Player not found!',source,255,0,0 ) end end else if isPlayerInGroup (source, "VIP") then giveCash (source) else outputChatBox ("You must be VIP to use this command.", source,255,0, 0,true) end end end ) -- useful functions function findPlayer(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 function isPlayerInGroup (player, group) local playerAccount = getPlayerAccount ( player ) if playerAccount then local accName = getAccountName ( playerAccount ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( group ) ) then return true end end return false end @Samking
-
@SSKE you can replace banPlayer function with setAccountData at admin-panel resource. But you have to check getAccountData and show your GUI window instead of login panel to prevent bug abusing
-
Tieing function to onMarkerHit results in looping teleport
JeViCo replied to Sorata_Kanda's topic in Scripting
as i said you teleport to the next marker and hit it even if you nearby so it causes a loop -- Table of spawn location when entering/leaving Burger Shot local burgershotSpawn = { enter = { x = 364.4189453125, y = -74.154296875, z = 1001.5078125, rot = 313.42001342773 }, exit = { x = -2334.7392578125, y = -166.7958984375, z = 35.5546875, rot = 221.95193481445 } } --Entry/Exit marker grabbed from .map file local burgershotEnter = getElementByID("burgershotEnter") local burgershotExit = getElementByID("burgershotExit") -- i created markers to test it --[[ local ent = burgershotSpawn.enter local exi = burgershotSpawn.exit local burgershotEnter = createMarker(exi.x,exi.y,exi.z,"cylinder",1) local burgershotExit = createMarker(ent.x,ent.y,ent.z,"cylinder",1) setElementInterior(burgershotExit,10) --]] -- Debug stuff whether coordinates of entry/exit markers are the same as defined in .map (which in this case, it is) local enterPosX, enterPosY, enterPosZ = getElementPosition(burgershotEnter) local exitPosX, exitPosY, exitPosZ = getElementPosition(burgershotExit) outputChatBox ( "Enter: " .. tostring(burgershotEnter) .. " " .. enterPosX .. ", " .. enterPosY .. ", " .. enterPosZ ) outputChatBox ( "Exit: " .. tostring(burgershotExit) .. " " .. exitPosX .. ", " .. exitPosY .. ", " .. exitPosZ ) --------------------------------------- function burgershotEnterHit( player ) if not getElementData(player,"player:denyMarker") then -- can player interact with marker or not outputChatBox("Welcome to Burger Shot! If you want to order something, click on the ped.") setElementInterior( player, 10, burgershotSpawn["enter"]["x"], burgershotSpawn["enter"]["y"], burgershotSpawn["enter"]["z"]) --setPlayerRotation( burgershotSpawn["enter"]["rot"] ) setElementData(player,"player:denyMarker",true) -- disable that loop setTimer(removeElementData,2000,1,player,"player:denyMarker") -- return ability to interact with markers ( 2 seconds delay) end end function burgershotExitHit( player ) if not getElementData(player,"player:denyMarker") then -- can player interact with marker or not outputChatBox("Thanks for visiting Burger Shot! Come again soon!") setElementInterior( player, 0, burgershotSpawn["exit"]["x"], burgershotSpawn["exit"]["y"], burgershotSpawn["exit"]["z"]) --setPlayerRotation( burgershotSpawn["exit"]["rot"] ) setElementData(player,"player:denyMarker",true) -- disable that loop setTimer(removeElementData,2000,1,player,"player:denyMarker") -- return ability to interact with markers end end addEventHandler( "onMarkerHit", burgershotEnter, burgershotEnterHit ) addEventHandler( "onMarkerHit", burgershotExit, burgershotExitHit ) @Sorata_Kanda -
wtf =D those answers... @#_iMr,[E]coo use dxDrawImageSection + mask shader ( link ) <- radar to draw radar areas use dxDrawCircle. To make circle areas use createColCircle <- radar areas
-
could you explain more? What problems do you have in your code?