-
Posts
6,063 -
Joined
-
Last visited
-
Days Won
209
Everything posted by IIYAMA
-
Of course it isn't working it is much more complicated then that. You can try this, which I am 10% sure it will work. I have build something like this before, except I can't remember me how I wrote it. local gunTable = { 23, 30, 32, 20, 9 } local weaponDisable = function (slotChange) local validSlots = {0,1,2,3,4,5,6,7,8,9,10,11,12} local lastSlot = getPedWeaponSlot ( localPlayer ) for slot=0,12 do local weapon = getPedWeapon(localPlayer,slot) for wI=#gunTable,1,-1 do--inverse loop > table.remove if weapon == gunTable[wI] then table.remove(validSlots,slot) break end end end local lastSlotFound = false if slotChange == 1 then local saveTheLastPositions = {} for i=1,#validSlots do-- don't break this loop local slot = validSlots[i] if slot == lastSlot then lastSlotFound = i end saveTheLastPositions[i]=slot end if lastSlotFound then if saveTheLastPositions[lastSlotFound+1] then setPedWeaponSlot(localPlayer,saveTheLastPositions[lastSlotFound+1]) elseif saveTheLastPositions[1] then setPedWeaponSlot(localPlayer,saveTheLastPositions[1]) else error("something went very bad....") end elseif saveTheLastPositions[1] then error("player is not using a valid slot.") setPedWeaponSlot(localPlayer,saveTheLastPositions[1]) end elseif slotChange == -1 then local saveTheLastPositions = {} for i=#validSlots,1,-1 do-- don't break this loop local slot = validSlots[i] if slot == lastSlot then lastSlotFound = i end saveTheLastPositions[i]=slot end if lastSlotFound then if saveTheLastPositions[lastSlotFound-1] then setPedWeaponSlot(localPlayer,saveTheLastPositions[lastSlotFound-1]) elseif saveTheLastPositions[#saveTheLastPositions] then setPedWeaponSlot(localPlayer,saveTheLastPositions[#saveTheLastPositions]) else error("something went very bad....") end elseif saveTheLastPositions[#saveTheLastPositions] then error("player is not using a valid slot.") setPedWeaponSlot(localPlayer,saveTheLastPositions[#saveTheLastPositions]) end end end addEventHandler("onClientResourceStart",resourceRoot, function () bindKey("next_weapon","both",weaponDisable,1) bindKey("previous_weapon","both",weaponDisable,-1) end) addEventHandler("onClientResourceStop",resourceRoot, function () toggleControl ("next_weapon", true ) toggleControl ("previous_weapon", true ) end) addEventHandler("onClientRender",root, function () toggleControl ("next_weapon", false ) toggleControl ("previous_weapon", false ) end)
-
Of course it isn't working. You should not use math random in the first place. Every type has it's own texture's and models. See wiki example: https://wiki.multitheftauto.com/wiki/Ge ... yTypeIndex function scriptNextClothes ( thePlayer, key, clothesType ) local currentTexture, currentModel = getPedClothes ( thePlayer, clothesType ) -- get the current clothes on this slot local clothesIndex = -1 if ( currentTexture ) then -- if he had clothes of that type local tempA, tempB = getTypeIndexFromClothes ( currentTexture, currentModel ) -- get the type and index for these clothes, so we can increase it to get the next set in the list if ( tempA and tempB ) then -- if we found them clothesType, clothesIndex = tempA, tempB end end clothesIndex = clothesIndex + 1 local texture, model = getClothesByTypeIndex ( clothesType, clothesIndex ) -- get the new texture and model if ( texture == false ) then -- if we've reached the end of the list removePedClothes ( thePlayer, clothesType ) else addPedClothes ( thePlayer, texture, model, clothesType ) end end addCommandHandler ( "nextClothes", scriptNextClothes )
-
Only the client version can get this information. Also this event can be cancelled. "onClientVehicleDamage" local lastDamageTime = 0 function VehicleGetDamageDayZ ( attacker, weapon, loss, x, y, z, tyre ) local vehicle = getPedOccupiedVehicle( localPlayer ) local timeNow = getTickCount() if timeNow > lastDamageTime and source == vehicle and not getElementData ( localPlayer, "tempodosexo" ) then if weapon and weapon > 1 and attacker and getElementType(attacker) == "player" then lastDamageTime = timeNow+300 -- can only be executed every 300 ms. setTimer (deslogger, 10000, 1, localPlayer) setTimer ( setElementData, 10000, 1, localPlayer, "tempodosexo", false ) setElementData ( localPlayer, "tempodosexo", true ) outputChatBox ( "Your car received damage! Do not log out in 10 seconds or you will die!", localPlayer, 255, 5, 0 ) end end end You used getLocalPlayer instead of getLocalPlayer() or localPlayer.
-
I am not sure if you understand what I mean. You have to debug the data before it got saved and after it has been loaded. outputDebugString(tostring(getPedWeapon (source, 0))) Also if that is fine, debug the result of the functions tostring(setAccountData(....)) and tostring(getAccountData(....)) Simply checking the data that goes in and out..... btw getPedTotalAmmo doesn't work always correctly.
-
I don't see anything wrong with the code. Why don't you debug it yourself with outputDebugString()?
-
https://wiki.multitheftauto.com/wiki/Anti-cheat_guide
-
Maybe you should send the player name too? https://wiki.multitheftauto.com/wiki/TriggerServerEvent triggerServerEvent ( string event, element theElement, [arguments...] ) triggerServerEvent("mute", player,playerName)
-
function serverfire (thePlayer) local team = getTeamFromName( "Los Santos Fire Department" ) if team then for k, v in ipairs ( getPlayersInTeam (team) ) do outputChatBox("[RADIO] This is dispatch, We've got a report from a fire at " .. randomfire[4] .. " via the emergency line, over.", v, 245, 40, 135) outputChatBox("[RADIO] Please report there NOW.", v, 245, 40, 135) end else outputChatBox("ERROR: team doesn't exist.",thePlayer) end if exports.global:isPlayerAdmin(thePlayer) then triggerClientEvent( "burnbabyburn", getRootElement(), jevifire ) triggerClientEvent( "ringTheBell", root, fdbell ) outputChatBox("Fiiiire!", thePlayer) end end addCommandHandler ( "jevifire" , serverfire )
-
Moeilijk om mensen te helpen? Niemand kan je helpen met een antwoord als dat... zeker als men je meerdere malen moet vragen voor een beter/ander antwoord. Moet je ook niet raar op gaan kijken als mensen je voor een kleuter houden. Wat wij verwachten is dat je de resource namen neerschrijft of de auteurs of een link naar de resources. Dit slaat echt helemaal nergens op.
-
Laat maar, hij is 9 of zo. Ik ga daar geen moeite in stoppen.
-
https://forum.multitheftauto.com/viewtopic.php?f=108&t=27006&start=0&st=0&sk=t&sd=a
-
This is how you solve that problem. local healthLoss = 30 addCommandHandler("kill", function() local health = getElementHealth(localPlayer) if healh =< healthLoss then setElementHealth(localPlayer,0) else setElementHealth(localPlayer,healh-healthLoss) end end) Health gets refilled because you can't have negative health for players.
-
function dxDrawImageX() local rotz = getElementRotation(getLocalPlayer()) local now = rotz local End = 360 local progress = now / End dxDrawImageSection(65+(progress*250),516,500, 50, 65, 0, 100, 50, "360.png") end addEventHandler("onClientRender", getRootElement(), dxDrawImageX) As you said image is 500x 50 and not 165x50 which you did. Does the image move or what? And at what value does the image starts? Is the 0 in the middle? You have to see dxImageSection as a photoshop masker(except it isn't moving with the image). Between those arguments the image is visible: [b]u:[/b] the absolute X coordinate of the top left corner of the section which should be drawn from image [b]v:[/b] the absolute Y coordinate of the top left corner of the section which should be drawn from image [b]usize:[/b] the absolute width of the image section [b]vsize:[/b] the absolute height of the image section My screen is 1920x1080. And I want to show an image on my screen which has a non pixel border(50 px). Then I would use those values: posX = [color=#FF8000]0[/color] posY = [color=#FF8000]0[/color] width =[color=#FF8000] 1920[/color] height =[color=#FF8000] 1080[/color] u =[color=#FF8000] 50[/color] v =[color=#FF8000] 50[/color] usize = [color=#FF8000]1870[/color][color=#00FF00] -- 1920-50[/color] vsize = [color=#FF8000]1030[/color] [color=#00FF00]-- 1080-50[/color]
-
Er zijn heel veel login panels en spawn panels.(zo als ik al gezegd heb) Het lijkt er op dat je scripts niet samen kunnen werken. Hoe je dat oplost is aan jouw, zoek scripts die wel kunnen samenwerken of pas de code aan.
-
@Dzsozi Did you know that with your code every player has to be in a vehicle to hear a sound? and if they are not they get 3 warnings at clientside? Because you don't check if the vehicle does exist. try: -- server triggerClientEvent ("onMotorSerult",veh) -- client addEvent ("onMotorSerult",true) addEventHandler ("onMotorSerult",root, function () if isElement(source) then local x, y, z = getElementPosition(source) local motor = playSound3D("startup.mp3", x, y, z, false) setSoundMaxDistance(motor, 30) end end )
-
By using the second example + cancelEvent() of my previous post. addEventHandler("onClientPlayerChoke", root, function (weapon,attacker) if weapon == 41 then outputChatBox("hit with spraycan > onClientPlayerChoke ") cancelEvent() end end) You have to read the information better from the event's. Only events that have information about cancelling events can do that, others cannot.
-
addEventHandler("onClientPlayerWeaponFire", root, function (weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement, startX, startY, startZ) local attacker = source if weapon == 41 then if getDistanceBetweenPoints3D (hitX, hitY, hitZ,startX, startY, startZ) < 3 then -- anti bug outputChatBox('spraycan hit') end else outputChatBox('1') end end) Or you can use:(this event can cancel the damage/animation) addEventHandler("onClientPlayerChoke", root, function (weapon,attacker) if weapon == 41 then outputChatBox("hit with spraycan > onClientPlayerChoke ") end end)
-
-- Server: -- create your colshape function onColEvent( p ) if ( getElementType ( p ) == "vehicle" ) then p = getVehicleOccupant ( p ) end if ( not isElement ( p ) ) then return end if ( eventName == "onColShapeHit" ) then setElementData ( p, "isClientInProtectedArea", true ) else setElementData ( p, "isClientInProtectedArea", false ) end triggerClientEvent ( p, "onClientProtectedAreaEventChange", p, eventName ) end addEventHandler ( "onColShapeHit", CSSZ1, onColEvent ) addEventHandler ( "onColShapeLeave", CSSZ1, onColEvent ) -- client addEventHandler ( "onClientPlayerDamage", root, function ( ) if ( getElementData ( source, "isClientInProtectedArea" ) ) then cancelEvent ( ) end end ) addEvent ( "onClientProtectedAreaEventChange", true ) addEventHandler ( "onClientProtectedAreaEventChange", root, function ( e ) if ( e == "onColShapeHit" and not isRender ) then [color=#FF0000] render = true[/color] addEventHandler ( "onClientRender", root, onClientRender ) elseif ( e == "onColShapeLeave" ) then [color=#FF0000] render = false[/color] end end ) [color=#FF8000]local[/color] [color=#FF0000]isRender = false[/color] local sWidth,sHeight = guiGetScreenSize() function onClientRender ( ) if ( not [color=#FF0000]isRender[/color] ) then removeEventHandler ( "onClientRender", root, onClientRender ) end dxDrawText("Protected Area Comp",sWidth*0.668, sHeight*0.952, sWidth*0.715, sHeight*0.997,tocolor(0,255,0,255),1.0,"pricedown","left","bottom",false,false,false) end It is obviously. The names don't match and the variable should be on top of the code (local variables).
-
ok very strange. You can report the bug if you want. https://bugs.multitheftauto.com/my_view_page.php But to solve your problem, you can use "onClientPlayerWeaponFire" + getDistanceBetweenPoints3D(because of the strange weapon range)
-
Line: 15 givePlayerMoney(killer,getPlayerMoney(killer) 0) I am not sure what you wanted to do. givePlayerMoney(killer,tonumber(getPlayerMoney(killer) .. 0)) -- or givePlayerMoney(killer,getPlayerMoney(killer)) -- or givePlayerMoney(killer,1000)
-
You sure there are no events get cancelled? (in another script)
-
Not really since that only get triggered when a player change from target and not when he starts aiming. The best result would be using bindkey, but will require more bandwidth.