News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: isbuttonpressed Not work?  (Read 2358 times)

0 Members and 1 Guest are viewing this topic.

Offline luizd90

  • Jr. Member
  • **
  • Posts: 3
  • Gender: Male
    • View Profile
    • http://www.xfire.com/profile/luizd90
isbuttonpressed Not work?
« on: March 07, 2014, 01:03:27 PM »
I press right and nothing happens
Code: [Select]
elseif IsButtonPressed(10,0) and IsButtonPressed(1, 0) then
PedSetActionNode(gPlayer,"/Global/G_Johnny", "Act/Anim/G_Johnny.act")

Here is my code

Code: [Select]
PedSetTypeToTypeAttitude(1, 13, 2)
PedSetTypeToTypeAttitude(2, 13, 2)
PedSetTypeToTypeAttitude(3, 13, 1)
PedSetTypeToTypeAttitude(5, 13, 1)
PedSetTypeToTypeAttitude(6, 13, 2)
PedSetTypeToTypeAttitude(11, 13, 2)

LoadStyles = function()
  PlayerSetInvulnerable(true)
  DisablePunishmentSystem(true)
  LoadAnimationGroup("Russell") 
  LoadAnimationGroup("B_Striker")
  LoadAnimationGroup("P_Striker")
  LoadAnimationGroup("Boxing")
  LoadAnimationGroup("Straf_Prep")
  LoadAnimationGroup("F_Preps")
  LoadAnimationGroup("G_Johnny")
  LoadAnimationGroup("F_Greas")
  LoadAnimationGroup("G_Grappler")
  LoadAnimationGroup("G_Striker")
  LoadAnimationGroup("Straf_Wrest")
  LoadAnimationGroup("DO_Striker")
  LoadAnimationGroup("DO_StrikeCombo")
  LoadAnimationGroup("F_Douts")
  LoadAnimationGroup("IDLE_JOCK_A")
  LoadAnimationGroup("F_JOCKS")
  LoadAnimationGroup("NPC_Mascot")
  LoadAnimationGroup("J_Grappler")
  LoadAnimationGroup("C_Wrestling")
  LoadAnimationGroup("Earnest")
  LoadAnimationGroup("SNERD_I")
  LoadAnimationGroup("SNERD_S")
  LoadAnimationGroup("N_Striker_B")
  LoadAnimationGroup("F_Nerds")
  LoadAnimationGroup("Nemesis")
  LoadAnimationGroup("Halloween")
  LoadAnimationGroup("TE_FEMALE") 
  LoadAnimationGroup("F_Girls")
  LoadAnimationGroup("NPC_Adult")
  LoadAnimationGroup("F_Adult")
  LoadAnimationGroup("LE_ORDERLY")
  LoadAnimationGroup("F_CRAZY")
  LoadAnimationGroup("NPC_Principal")
  LoadAnimationGroup("Authority")
  LoadAnimationGroup("POI_SMOKING")
  LoadAnimationGroup("Sitting_Boys")
  LoadAnimationGroup("Hang_Talking")
  LoadAnimationGroup("3_05")
  LoadAnimationGroup("5_02")
  collectgarbage()
end

MissionSetup = function()
l_0_0 = 1
PlayerSetHealth(200)
AreaTransitionXYZ(60, -773.293030, 363.286987, 6.396100)
DisablePunishmentSystem(true)
PedSetActionTree(gPlayer,"/Global/...........", "Act/Anim/.............act")
end

Action = function()
if IsButtonBeingReleased(2,0) and l_0_0 == 1 then
TextPrintString("Chicken", 4, 2)
elseif IsButtonBeingReleased(2,0) and l_0_0 == 2 then
TextPrintString("Potato", 4, 2)
elseif IsButtonBeingReleased(2,0) and l_0_0 == 3 then
TextPrintString("Modder", 4, 2)
elseif IsButtonBeingReleased(2,0) and l_0_0 == 4 then
TextPrintString("Well done mate", 4, 2)
end
end

Settings = function()
  if IsButtonPressed(10,0) and IsButtonPressed(0, 0) then
PedSetActionNode(gPlayer,"/Global/..............", "Act/Anim/...........act")
elseif IsButtonPressed(10,0) and IsButtonPressed(3, 0) then
PedSetActionNode(gPlayer,"/Global/..............", "Act/Anim/.............act")
elseif IsButtonPressed(10,0) and IsButtonPressed(1, 0) then
PedSetActionNode(gPlayer,"/Global/G_Johnny", "Act/Anim/G_Johnny.act")
elseif IsButtonPressed(10,0) and IsButtonPressed(2, 0) then
PedSetActionNode(gPlayer,"/Global/........................", "Act/Anim/.............act")
elseif IsButtonPressed(10,0) and IsButtonPressed (9, 0) then
PedSetActionNode(gPlayer,"/Global/........", "Act/Anim/........act")
elseif IsButtonPressed(10,0) and IsButtonPressed (12, 0) then
SoundPlayScriptedSpeechEvent(...........)
elseif IsButtonPressed(10,0) and IsButtonPressed (15, 0) then
SoundPlayScriptedSpeechEvent(...........)
elseif IsButtonPressed(6,0) and IsButtonPressed (7, 0) then
PedSetActionNode(gPlayer,"/Global/....................", "Act/Anim/.........act")
end
end

UnLoadStyles = function()
  UnLoadAnimationGroup("Russell") 
  UnLoadAnimationGroup("B_Striker")
  UnLoadAnimationGroup("P_Striker")
  UnLoadAnimationGroup("Boxing")
  UnLoadAnimationGroup("Straf_Prep")
  UnLoadAnimationGroup("F_Preps")
  UnLoadAnimationGroup("G_Johnny")
  UnLoadAnimationGroup("F_Greas")
  UnLoadAnimationGroup("G_Grappler")
  UnLoadAnimationGroup("G_Striker")
  UnLoadAnimationGroup("Straf_Wrest")
  UnLoadAnimationGroup("DO_Striker")
  UnLoadAnimationGroup("DO_StrikeCombo")
  UnLoadAnimationGroup("F_Douts")
  UnLoadAnimationGroup("IDLE_JOCK_A")
  UnLoadAnimationGroup("F_JOCKS")
  UnLoadAnimationGroup("NPC_Mascot")
  UnLoadAnimationGroup("J_Grappler")
  UnLoadAnimationGroup("C_Wrestling")
  UnLoadAnimationGroup("Earnest")
  UnLoadAnimationGroup("SNERD_I")
  UnLoadAnimationGroup("SNERD_S")
  UnLoadAnimationGroup("N_Striker_B")
  UnLoadAnimationGroup("F_Nerds")
  UnLoadAnimationGroup("Nemesis")
  UnLoadAnimationGroup("Halloween")
  UnLoadAnimationGroup("TE_FEMALE") 
  UnLoadAnimationGroup("F_Girls")
  UnLoadAnimationGroup("NPC_Adult")
  UnLoadAnimationGroup("F_Adult")
  UnLoadAnimationGroup("LE_ORDERLY")
  UnLoadAnimationGroup("F_CRAZY")
  UnLoadAnimationGroup("NPC_Principal")
  UnLoadAnimationGroup("Authority")
  UnLoadAnimationGroup("POI_SMOKING")
  UnLoadAnimationGroup("Sitting_Boys")
  UnLoadAnimationGroup("Hang_Talking")
  UnLoadAnimationGroup("3_05")
  UnLoadAnimationGroup("5_02")
end

main = function()
repeat
Action()
Settings()
Wait(0)
until not Alive
 end
Can anyone fix

Offline MadmaN

  • Bully-Board Admin Team
  • Newbie
  • *
  • Posts: 0
  • Gender: Male
  • Biblio-Techa Mods (retired)
    • View Profile
Re: isbuttonpressed Not work?
« Reply #1 on: March 07, 2014, 01:50:14 PM »
Code: [Select]
PedSetTypeToTypeAttitude(1, 13, 2)
PedSetTypeToTypeAttitude(2, 13, 2)
PedSetTypeToTypeAttitude(3, 13, 1)
PedSetTypeToTypeAttitude(5, 13, 1)
PedSetTypeToTypeAttitude(6, 13, 2)
PedSetTypeToTypeAttitude(11, 13, 2)

This needs to be in a function rather then just by itself. The game will ignore it unless it is in a function and the function called appropriately....


I have no idea if you are trying to get these bits working as they appear here:
Code: [Select]
PedSetActionTree(gPlayer,"/Global/...........", "Act/Anim/.............act")

Are you copying and pasting the actiontrees in hex form? If you are then this will never work.....

Could you please PM me the entire script you are working on as it currently is? I will take a look at it and make corrections for you and comment them really fast which will give you a little bit of help there and something to learn from.

I know I am still retired from modding....but in this case I will make a exception and step in and help since I know a few different ways to code all of this so it is more efficient and works without bugs.


Offline c00ld0c26

  • The D0c
  • Moderator
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: isbuttonpressed Not work?
« Reply #2 on: March 07, 2014, 07:32:07 PM »
2 things.

1. The IsButtonBeingPressed isn't repeated, which will run it only once, and will not check if it is pressed ever again.

2. You didn't specify which action nodes you want to work so the game simply ignores your code.