
Lukkaz
Members-
Posts
135 -
Joined
-
Last visited
Everything posted by Lukkaz
-
thanks guys, but now the speed isn't registering and just tell me "bad ped pointer" in the debug..... the function to tell the speed function weaponAim(target) if (target) then if (getElementType(target)=="vehicle") then if (getPedWeapon(localPlayer)==24) then local mode = getElementData(localPlayer, "deaglemode") if (mode==2) then actualspeed = exports.global:getVehicleVelocity(target) outputChatBox(getVehicleName(target) .. " clocked in at " .. actualspeed .. " km/h.", 255, 194, 14) end end end end end the global function function getVehicleVelocity(target) local driver = target if isPedInVehicle(driver) then local vx, vy, vz = getElementVelocity(getPedOccupiedVehicle(driver)) return math.sqrt(vx^2 + vy^2 + vz^2) * 161 end return 0 end Ideas? I'm stumped
-
Ohh, my only issue was localplayer, localplayer. Not "a lot" of errors lol and thank you and I apologize for how I requested help.Won't happen again.
-
Not working, doesn't switch modes or anything I tried a million things. Thanks server-side local time = 10 --In seconds, time, when player is frozen function deaglemodes(localPlayer, number) local mode = tonumber(number) if mode == 0 then --tazer setElementData(localPlayer,"deaglemode", 0) elseif mode == 1 then --leathal setElementData(localPlayer,"deaglemode", 1) elseif mode ==2 then --radar setElementData(localPlayer,"deaglemode", 2) end end addEvent("deaglemode", true) addEventHandler("deaglemode", getRootElement(), deaglemodes, thePlayer, number) function tazerShot(hitX, hitY, hitZ, hitElement) setPedFrozen ( source, true ) setPedAnimation( source, "ped", "FLOOR_hit_f") setTimer(setPedFrozen, time * 1000, 1, source, false) setTimer(setPedAnimation, time * 1000, 1, source) end addEvent("tazerFired", true) addEventHandler("tazerFired", getRootElement(), tazerShot, hitX, hitY, hitZ, hitElement) function killmebyped(target) --killed by ped blahhhh end client-side cooldown = 0 cooldownTimer = nil localPlayer = getLocalPlayer() --function isPD() -- return exports.factions:isPlayerInFaction( localPlayer, 1 ) --end function switchMode() if (getPedWeapon(localPlayer)==24) and (getPedTotalAmmo(localPlayer)>0) then -- has ammo local mode = getElementData(localPlayer, "deaglemode") if mode == 0 then -- tazer mode triggerServerEvent("deaglemode", localPlayer, 1) outputChatBox( "You switched your weapon mode to lethal.", 0, 255, 0 ) elseif mode == 1 -- and isPD() then -- lethal mode outputChatBox( "You switched your weapon to radar gun.", 0, 255, 0 ) triggerServerEvent("deaglemode", localPlayer, 2) elseif mode == 2 or mode == 1 then -- radar gun mode outputChatBox( "You switched your weapon to taser.", 0, 255, 0 ) triggerServerEvent("deaglemode", localPlayer, 0) end end end function bindKeys(res) bindKey("n", "down", switchMode) local mode = getElementData(localPlayer, "deaglemode") if not (mode) then triggerServerEvent("deaglemode", localPlayer, 0) end end addEventHandler("onClientResourceStart", getResourceRootElement(), bindKeys) function enableCooldown() cooldown = 1 cooldownTimer = setTimer(disableCooldown, 3000, 1) toggleControl("fire", false) setElementData(getLocalPlayer(), "deagle:reload", true) end function disableCooldown() cooldown = 0 toggleControl("fire", true) setElementData(getLocalPlayer(), "deagle:reload", false) if (cooldownTimer~=nil) then killTimer(cooldownTimer) cooldownTimer = nil end end addEventHandler("onClientPlayerWeaponSwitch", getRootElement(), disableCooldown) function weaponFire(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) if (weapon==24) then -- deagle local mode = getElementData(localPlayer, "deaglemode") if (mode==0) then -- tazer mode enableCooldown() local px, py, pz = getElementPosition(localPlayer) local distance = getDistanceBetweenPoints3D(hitX, hitY, hitZ, px, py, pz) if (distance<35) then fxAddSparks(hitX, hitY, hitZ, 1, 1, 1, 1, 10, 0, 0, 0, true, 3, 1) end playSoundFrontEnd(38) triggerServerEvent("tazerFired", localPlayer, hitX, hitY, hitZ, hitElement) end end end addEventHandler("onClientPlayerWeaponFire", localPlayer, weaponFire) function weaponAim(target) if (target) then if (getElementType(target)=="vehicle") then if (getPedWeapon(localPlayer)==24) then local mode = getElementData(localPlayer, "deaglemode") if (mode==2) then actualspeed = exports.global:getVehicleVelocity(target) outputChatBox(getVehicleName(target) .. " clocked in at " .. actualspeed .. " km/h.", 255, 194, 14) end end end end end addEventHandler("onClientPlayerTarget", getRootElement(), weaponAim) -- code for the target/tazed person function cancelTazerDamage(attacker, weapon, bodypart, loss) if (weapon==24) then -- deagle local mode = getElementData(attacker, "deaglemode") if (mode==0 or mode==2) then -- tazer mode / radar gun mode cancelEvent() end end end addEventHandler("onClientPlayerDamage", localPlayer, cancelTazerDamage) function showTazerEffect(x, y, z) fxAddSparks(x, y, z, 1, 1, 1, 1, 100, 0, 0, 0, true, 3, 2) playSoundFrontEnd(38) end addEvent("showTazerEffect", true ) addEventHandler("showTazerEffect", getRootElement(), showTazerEffect) local underfire = false local fireelement = nil local localPlayer = getLocalPlayer() local originalRot = 0 local shotsfired = 0 function onTargetPDPed(element) if (isElement(element)) then if (getElementType(element)=="ped") and (getElementModel(element)==282 or getElementModel(element)==280 or getElementModel(element)==285) and not (underfire) and (getControlState("aim_weapon")) then underfire = true fireelement = element originalRot = getPedRotation(element) addEventHandler("onClientRender", getRootElement(), makeCopFireOnPlayer) addEventHandler("onClientPlayerWasted", getLocalPlayer(), onDeath) end end end addEventHandler("onClientPlayerTarget", getLocalPlayer(), onTargetPDPed) function makeCopFireOnPlayer() if (underfire) and (fireelement) then local rot = getPedRotation(localPlayer) local x, y, z = getPedBonePosition(localPlayer, 7) setPedRotation(fireelement, rot - 180) setPedControlState(fireelement, "aim_weapon", true) setPedAimTarget(fireelement, x, y, z) setPedControlState(fireelement, "fire", true) shotsfired = shotsfired + 1 -- if (shotsfired>40) then -- triggerServerEvent("killmebyped", getLocalPlayer(), fireelement) -- end end end function onDeath() if (fireelement) and (underfire) then setPedControlState(fireelement, "aim_weapon", false) setPedControlState(fireelement, "fire", false) setPedRotation(fireelement, originalRot) fireelement = nil underfire = false removeEventHandler("onClientRender", getRootElement(), makeCopFireOnPlayer) removeEventHandler("onClientPlayerWasted", getLocalPlayer(), onDeath) end end
-
I figured that's what it could have been but I wasn't sure if labels had a character limit, thanks
-
Yeah it is in the tab but it doesn't scroll the text is cut off
-
addEventHandler( "onClientPlayerResourceStart", getRootElement( ), function() bindKey ( "F1", "down", toggleHelp) end ) GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(171,158,452,337,"Help Menu",false) GUIEditor_TabPanel[1] = guiCreateTabPanel(19,34,411,287,false,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Rules",GUIEditor_TabPanel[1]) GUIEditor_Label[1] = guiCreateLabel(14,9,368,247,"1. Roleplay at ALL times, 2. Respect everyone we will not tolerate hostile behavior (occly) 3. No PowerGaming or MetaGaming 4. When pulling out a weapon you MUST use a /me to pull out the weapon/object 5. No Deathmatching 6. No cheats, hacks or bug abuse is allowed 7. No Ninja jacking, Pushing cars into the roads, or destorying cars occly 8. No vehicle sale scams 9. No advertising of other servers 10. Do not mix OOC chat with IC chat 11. No revenge killing \n\n**Any violation of the rules may result in a kick, jail time or even a ban! You have been warned.**",false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",true) GUIEditor_Tab[2] = guiCreateTab("Commands",GUIEditor_TabPanel[1]) GUIEditor_Label[2] = guiCreateLabel(18,-4,5,5,"",false,GUIEditor_Tab[2]) guiLabelSetColor(GUIEditor_Label[2],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[2],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[2],"left",false) GUIEditor_Label[3] = guiCreateLabel(16,9,369,247,"The following commands are already bound to your keyboard:\n\nt - IC Chat, only roleplayed chat should be used b - local OOC chat o - global OOC chat (if enabled) i - view your inventory f2 - brings up the report window __________________________________________________________________\n**Useful text commands (used with t)**\n/animlist - a list of animations /gate - opens doors (some are faction based) ",false,GUIEditor_Tab[2]) guiLabelSetColor(GUIEditor_Label[3],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[3],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[3],"left",true) GUIEditor_Tab[3] = guiCreateTab("FAQ",GUIEditor_TabPanel[1]) scrollPane = guiCreateScrollPane(5,5,361,287,false,GUIEditor_Tab[3]) GUIEditor_Label[4] = guiCreateLabel(17,13,361,243,"Q. I just started playing on the server, what can I do?\nA. In Strange Gaming you can do anything you set your mind to, want to be a multi millionaire tycoon? Start a business, want to be in the mafia? Find members and get involved. Most of these activities require you to visit the forums (StrangeGaming.tk) and join the specific group. \nQ. What's a faction? \nA. Factions are groups that roleplay a specific role with more in depth scripting oppertunities. Anyone can create a faction but to become official you must show longitivity and high roleplaying skill. \nQ. I found a bug, what do I do?\nA. Simply use f2 and report it to an admin to have it taken care of. \nQ. Whats Power Gaming? \nA. PowerGaming is forcing a player to roleplay your way with little to no roleplay.\nQ. What is MetaGaming?\nA. MetaGaming is using OOC information to benifit your player IC \nQ. What is revenge killing? \nA. Revenge killing is killing a player after he has RPly killed your character. When you die you should have no memory of your killer and go after him. If you must revenge your dealth find a good RP reason to if you can not DON'T DO IT.",false,scrollPane) guiLabelSetColor(GUIEditor_Label[4],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[4],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[4],"left",true) GUIEditor_Tab[4] = guiCreateTab("Sources",GUIEditor_TabPanel[1]) GUIEditor_Label[5] = guiCreateLabel(17,11,360,248,"Forums: [url=http://www.StrangeGaming.tk]http://www.StrangeGaming.tk[/url] Developer: Lukkaz \n \nWe are looking for more scripters so if you are interested go on the forums and speak to Lukkaz and prove your scripting abilities for a position on the team!",false,GUIEditor_Tab[4]) guiLabelSetColor(GUIEditor_Label[5],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[5],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[5],"left",true) GUIEditor_Label[6] = guiCreateLabel(282,26,147,24,"Strange Gaming",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[6],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[6],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[6],"left",false) function toggleHelp () if ( guiGetVisible ( GUIEditor_Window[1] ) == true ) then -- check if the gui element is visible guiSetVisible ( GUIEditor_Window[1], false ) -- if it is, we hide it showCursor(false) else guiSetVisible ( GUIEditor_Window[1], true ) -- if not, we make it visible showCursor(true) end end that's the whole code. Could someone tell me why this is happening I am stumped PS. maybe could someone suggest a new way to call this function because the window pops up every time a player enters the server
-
bump still having the same issue it's still cut off in the tab now but not scrolling
-
scrollPane = guiCreateScrollPane(5,5,200,200,false,GUIEditor_Tab[3]) GUIEditor_Label[4] = guiCreateLabel(17,13,361,243,"blahhh blahh blahhh",false,scrollPane) nope using scrollPane triple checked and theres no scroll bar in entire script but it's still cut off and not scrolling
-
Now This Happens....
-
I don't understand...lol instead of tabPabel use scrollPanel?
-
GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Label = {} Window= guiCreateWindow(171,158,452,337,"Help Menu",false) tabPanel = guiCreateTabPanel(19,34,411,287,false,Window) scrollTab = guiCreateTab("FAQ",tabPanel) scrollBar = guiCreateScrollBar(384,13,22,233,false,false,scrollTab) info = guiCreateLabel(17,13,361,243,"A BUNCH OF TEXTTTT(enough to need the scrolling becuase it gets cut off",false,scrollTab) not scrolling the scroll bar will move down but won't move anything down with it any helps appreciated
-
I was wondering if it would be possible to tell a ped (bot) where to drive to like a taxi.
-
bump come on guys this is the last thing I am struggling on
-
I try but the bug I'm trying to squash is it'll say you have 1 minute left but the timers frozen and won't count down that last minute if you could read my code and help me pick out what's sketchy and could cause it not to work I'd hiiiighly appreciate it I been at it for days rearranging how to save the time and then start it when they connect
-
well that's what I originally had but when people get jailed they log out and log back in and when they do the timers lost so they will sit there until someone remembers to release them just a lot easier if I can save it so when they disconnect it pauses the timer and when they come back it'll pick up where it left off
-
Yeah that's what my code is attempting to do...lol but how do I go about doing it??
-
lol sorry I only have so much time
-
okay bare with me I am unable to test atm but local root = getRootElement() addEventHandler("onPlayerLogin", root, function() local characterID = exports.players:getCharacterID( source ) if characterID then local time = exports.sql:query_assoc( "SELECT jailTime FROM characters WHERE characterID = "..characterID ) if ( time ) and type( time ) == "number" then if ( time>=1 ) then local time = tonumber(time) setTimer(timers, time*60000, 1, source) ----I set timer for the unjail script but how does it go into mysql end else outputDebugString("time isn;t a number?") end outputDebugString("cant find characterid") end end ) addCommandHandler( "jailtime", function ( player, commandName ) if exports.players:isLoggedIn( player ) then local characterID = exports.players:getCharacterID( player ) if characterID then local result = exports.sql:query_assoc( "SELECT jailTime FROM characters WHERE characterID = "..characterID ) for key, value in ipairs( result ) do local time = value.jailTime if ( time >=1 ) then getTimerDetails(timers) ---------get the details of the unjail script outputChatBox ( "Your jailtime is "..time.." minute(s).", player, 0, 255, 0 ) ----but how do I log it into mysql? else end end else end end end ) function timers(other) -----unjail script local characterID = exports.players:getCharacterID( other ) if characterID then local result = exports.sql:query_assoc( "SELECT jailTime FROM characters WHERE characterID = "..characterID ) for key, value in ipairs( result ) do local time = value.jailTime if ( time == 0 ) then -----if the timer countde down to 0 then release the player setElementPosition(other, 2290, 2423.4, 10.8 ) setElementInterior (other, 0 ) outputChatBox( "Your time has been served, stay out of trouble.", other, 0, 255, 0 ) setElementDimension(other, 0 ) end end end end
-
sooo this would work? setTimer (timers, ..time..,1,other? )
-
Hi everyone I'm sorry I have been posting a lot of questions lately mostly things with stupid quick fixes that I over look but this will be my final question, I have created a jail script where time is saved in mySQL, however how can I get the time in mySQL to count down until the persons time is up? function update(player) local characterID = exports.players:getCharacterID( player ) if characterID then local result = exports.sql:query_assoc( "SELECT jailTime FROM characters WHERE characterID ="..characterID ) for key, value in ipairs( result ) do local time = value.jailTime if (time>=1) then exports.sql:query_insertid( "INSERT INTO characters (jailTime) VALUES (" ..time .. ")") end end end end function onResourceStart(thisResource) setTimer ( update, 600, 0 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), onResourceStart ) local root = getRootElement() addEventHandler("onPlayerLogin", root, function() local characterID = exports.players:getCharacterID( source ) if characterID then local time = exports.sql:query_assoc( "SELECT jailTime FROM characters WHERE characterID = "..characterID ) if ( time ) and type( time ) == "number" then if ( time>=1 ) then local time = tonumber(time) setTimer(timers, time*60000, 1, source) end else outputDebugString("time isn;t a number?") end outputDebugString("cant find characterid") end end ) addCommandHandler( "jailtime", function ( player, commandName ) if exports.players:isLoggedIn( player ) then local characterID = exports.players:getCharacterID( player ) if characterID then local result = exports.sql:query_assoc( "SELECT jailTime FROM characters WHERE characterID = "..characterID ) for key, value in ipairs( result ) do local time = value.jailTime if ( time >=1 ) then outputChatBox ( "Your jailtime is "..time.." minute(s).", player, 0, 255, 0 ) setTimer ( update, 600, 0, player ) else outputDebugString("its not working it cant be compared") end end else end end end ) function timers(other) local characterID = exports.players:getCharacterID( other ) if characterID then local result = exports.sql:query_assoc( "SELECT jailTime FROM characters WHERE characterID = "..characterID ) for key, value in ipairs( result ) do local time = value.jailTime if ( time == 0 ) then setElementPosition(other, 2290, 2423.4, 10.8 ) setElementInterior (other, 0 ) outputChatBox( "Your time has been served, stay out of trouble.", other, 0, 255, 0 ) setElementDimension(other, 0 ) end end end end What's the best way to do this I will do whatever for the person who can help me out me and my team are stumped
-
addCommandHandler( "jailtime", function ( player, commandName ) if exports.players:isLoggedIn( player ) then local characterID = exports.players:getCharacterID( player ) if characterID then local result = exports.sql:query_assoc( "SELECT jailTime FROM characters WHERE characterID = "..characterID ) for key, value in ipairs( result ) do local time= value.time if ( time >= 1 ) then outputChatBox ( "Your jailtime is "..time..".", source, 0, 255, 0 ) else outputDebugString("its not working it cant be compared(NIL)") end end end end end ) I been working on this for so long and getting quite frustrated it's probably a quick fix but I can not see it and come to you guys as a last resort.