-
Posts
100 -
Joined
-
Last visited
Everything posted by swag_k_dog
-
how do you freeze a ped so it never changes his position even if he's hit by the car or explosion?
-
bindKey binds is used for keyboard keys. dont think so
-
local sScreen, bCrim, bEnf local screenW, screenH = guiGetScreenSize() addEventHandler("onClientResourceStart", resourceRoot, function() showCursor(true) sScreen = guiCreateStaticImage((screenW - 1366) / 2, (screenH - 768) / 2, 1366, 768, "images/scrn.png", false) bCrim = guiCreateButton(376, 369, 162, 63, "", false, sScreen) guiSetAlpha(bCrim, 0.00) bEnf = guiCreateButton(743, 369, 162, 63, "", false, sScreen) guiSetAlpha(bEnf, 0.00) function closePanel() destroyElement(sScreen) removeEventHandler("onClientGUIClick", resourceRoot, guiClicked) showCursor(false) end function guiClicked(btn, state) if btn == "left" and state == "up" then if source == bCrim then triggerServerEvent("onClientTeamPicked", localPlayer, "Criminal", 67) closePanel() elseif source == bEnf then triggerServerEvent("onClientTeamPicked", localPlayer, "Enforcer", 124) closePanel() end end end addEventHandler("onClientGUIClick", resourceRoot, guiClicked) function graveyard() if btn == "left" and state =="up" then if source == bCrim then spawnPlayer (source, 881, -1101, 24.3, 0) fadeCamera (source, true) setCameraTarget (source, source) elseif source == bEnf then spawnPlayer (source, 883, -1101, 24.3, 0) fadeCamera (source, true) setCameraTarget (source, source) end end end addEventHandler("onClientGUIClick", resourceRoot, graveyard) end ) the graveyard function doesnt work, can you explain why? thanks! ((sorry for so many posts, I started to script few days ago))
-
Thanks for all the help. you're always here when I need you damn, scripting is getting more interesting now
-
I wanted to script a ped, and negate the damage he takes, but I got it wrong.. server: addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() local batped = createPed(30, 2767.5, -1617, 11) setElementRotation(batped, 0, 0, -45) setTimer(setPedAnimation,500,1,batped, "dildo", "dildo_idle") setTimer(giveWeapon,500,1,batped, 5, 1, true) triggerClientEvent("onClientPedDamage", resourceRoot) end ) and client: addEvent("onClientPedDamage", true) addEventHandler("onClientPedDamage", getRootElement(), function() cancelEvent() end ) whats the problem?
-
still doesnt work, I just tried Edit: nevermind its "givePedWeapon" not "giveWeapon". got it!!! thanks
-
here is a pic of the ped being spawned without a weapon:
-
thanks
-
local batped = createPed(30, 2767.5, -1617, 11) setPedRotation(batped, -45) givePedWeapon(batped, 5, 1, true) setPedAnimation(batped, "dildo", "dildo_idle") the ped spawns with his animation but it the "givePedWeapon" line does not work at all. help?
-
how do you censor the password on a login panel? please explain, dont write the code. i wanna learn by myself
-
thanks, the teleport was caused by another code in a resource, deleted the code.. thanks!
-
it spawns you in the LS graveyard?
-
you can add function which will playSound3D when set the event handler when the resource starts, and just use stopSound on a button click
-
function spawnOnLogin (prevA, curA ) outputChatBox ("Welcome to APB Reloaded", source, 255, 0, 0, false) spawnPlayer (source, 881, -1101, 24.3, 0) fadeCamera (source, true) setCameraTarget (source, source) end addEventHandler("onPlayerLogin", getRootElement(), spawnOnLogin) I set the coords to 881, -1101 and 24.3 but it spawns me at 2167, 1397, 10.8 why???
-
nvm, just got it. you forgot an "end" at the final of the server side.. thanks <3 @Walid
-
I just tried and still no
-
I did and I still dont get a skin after I click the button
-
client: local sScreen, bCrim, bEnf local screenW, screenH = guiGetScreenSize() addEventHandler("onClientResourceStart", resourceRoot, function() showCursor(true) sScreen = guiCreateStaticImage((screenW - 1366) / 2, (screenH - 768) / 2, 1366, 768, "images/scrn.png", false) bCrim = guiCreateButton(376, 369, 162, 63, "", false, sScreen) guiSetAlpha(bCrim, 0.00) bEnf = guiCreateButton(743, 369, 162, 63, "", false, sScreen) guiSetAlpha(bEnf, 0.00) function closePanel() destroyElement(sScreen) removeEventHandler("onClientGUIClick", resourceRoot, guiClicked) showCursor(false) end function guiClicked(btn, state) if btn == "left" and state == "up" then if source == bCrim then triggerServerEvent("onClientTeamPicked", localPlayer, "Criminal") closePanel() elseif source == bEnf then triggerServerEvent("onClientTeamPicked", localPlayer, "Enforcer") closePanel() end end end addEventHandler("onClientGUIClick", resourceRoot, guiClicked) function giveTeam(btn, localPlayer) if btn == "left" and state "up" then if source == bCrim then triggerServerEvent("setDudeSkin", localPlayer, "CrimSkin") elseif source == eBnf then triggerServerEvent("setDudeSkin", localPlayer, "EnfSkin") end end end end ) server: local crimz = createTeam ( "Criminal", 255, 0, 0 ) local enfz = createTeam ( "Enforcer", 0, 0, 255 ) addEvent("onClientTeamPicked", true) addEventHandler("onClientTeamPicked", root, function(name) local team = getTeamFromName(name) setPlayerTeam(client, team) end ) addEvent("setDudeSkin", true) addEventHandler("setDudeSkin", root, function(CrimSkin, EnfSkin) setPedElement(localPlayer, 67) end ) I want when the player to get a skin when he clicks one of the buttons. and I dont know how to do it.. for example when you click the "Criminal" button, you get skin id 67 and when you click the "Enforcer" button you get skin id 114. I tried and it didnt go well, help??? @pa3ck , you helped me before maybe again? thanks a lot
-
thanks, ill guide myself and learn.. wish I had a real mta scripting teacher
-
I started scripting few days ago and I dont really understand everything you're saying but here is the "client" script addEventHandler("onClientResourceStart", resourceRoot, function() local screenW, screenH = guiGetScreenSize() sScreen = guiCreateStaticImage((screenW - 1366) / 2, (screenH - 768) / 2, 1366, 768, "images/scrn.png", false) bCrim = guiCreateButton(376, 369, 162, 63, "", false, sScreen) guiSetAlpha(bCrim, 0.00) bEnf = guiCreateButton(743, 369, 162, 63, "", false, sScreen) guiSetAlpha(bEnf, 0.00) end ) function showC() showCursor( true ) end addEventHandler("onClientResourceStart", getRootElement(), showC) addEventHandler("onClientGUIClick", bCrim, teamset ) and "server" script function teemz () crimz = createTeam ( "Criminal", 255, 0, 0 ) enfz = createTeam ( "Enforcer", 0, 0, 255 ) end addEventHandler("onResourceStart", resourceRoot, teemz) can you like write a code on how to do it? would be cool, thanks
-
Hi, On this script there are 2 teams created and 2 buttons.. I want when you click the bCrim button to join the crimz team and close the gui. help? crimz = createTeam("Criminal", 255, 0, 0) enfz = createTeam("Enforcer", 0, 0, 255) addEventHandler("onClientResourceStart", resourceRoot, function() local screenW, screenH = guiGetScreenSize() sScreen = guiCreateStaticImage((screenW - 1366) / 2, (screenH - 768) / 2, 1366, 768, "images/scrn.png", false) bCrim = guiCreateButton(376, 369, 162, 63, "", false, sScreen) guiSetAlpha(bCrim, 0.00) bEnf = guiCreateButton(743, 369, 162, 63, "", false, sScreen) guiSetAlpha(bEnf, 0.00) end ) thanks
-
thank you sir also, can I ask you what 42 and 5 stand for?
-
hello, I tried to script a new sound for ak-47 but the original sound is still here, and it sounds buggy when combined.. function disableSounds() setAmbientSoundEnabled ("gunfire", false ) end addEventHandler("onClientResourceStart", root,disableSounds) local function playGunfireSound(weaponID) local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition(source) local px, py, pz = getElementPosition ( source ) if weaponID == 30 then --ak47 local sound = playSound3D("sounds/weap/AK.mp3", muzzleX, muzzleY, muzzleZ, false) setSoundMaxDistance(sound, 30) end end addEventHandler("onClientPlayerWeaponFire", root, playGunfireSound) what is the problem?
