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


Author Topic: This Command not work??  (Read 3623 times)

0 Members and 2 Guests are viewing this topic.

Offline Black Norton

  • Keep Calm
  • Jr. Member
  • **
  • Posts: 86
  • Gender: Male
  • Peace For Respect
    • View Profile
This Command not work??
« on: December 28, 2013, 01:49:08 AM »
Help
why this code not work

Code: [Select]
ImportScript("\\Library\\LibTable.lua") -- imports the LibTable library
ImportScript("\\Library\\LibPed.lua") -- imports the LibPed library
local l_0_0 = false
 
MissionSetup = function() -- basic mission setup function which is used in almost all bully scripts
  local l_1_0 = 270 -- X coords
  local l_1_1 = -110 -- Y coords
  local l_1_2 = 6.4000000953674 -- Z coords
  PlayerSetHealth(200) -- gives the player 200 health
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2) -- teleports the player to the sidewalk outside the boys dorm
  end
 
  F_Davis = function()
  Davis = PedCreateXYZ(99, 301.498993, -72.504997, 6.003000)
  DavisBlip = AddBlipForChar(Davis, 6, 2, 2)
  end
 
  F_Davis2 = function()
  if PlayerIsInTrigger(TRIGGER._TSCHOOL_FRONTGATE) then
  PedRecruitAlly(gplayer, Davis)
  end
  end
 
MissionCleanup = function()
collectgarbage()
end -- end statement

main = function()
F_Davis() -- Function Call
F_Davis2()
end

why davis didn't recruited??

Offline The CeSSaRR

  • Don't messing me!
  • Jr. Member
  • **
  • Posts: 59
  • Gender: Male
  • You're messing with the wrong mascot!
    • View Profile
Re: This Command not work??
« Reply #1 on: December 28, 2013, 03:17:46 AM »
Help
why this code not work

Code: [Select]
ImportScript("\\Library\\LibTable.lua") -- imports the LibTable library
ImportScript("\\Library\\LibPed.lua") -- imports the LibPed library
local l_0_0 = false
 
MissionSetup = function() -- basic mission setup function which is used in almost all bully scripts
  local l_1_0 = 270 -- X coords
  local l_1_1 = -110 -- Y coords
  local l_1_2 = 6.4000000953674 -- Z coords
  PlayerSetHealth(200) -- gives the player 200 health
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2) -- teleports the player to the sidewalk outside the boys dorm
  end
 
  F_Davis = function()
  Davis = PedCreateXYZ(99, 301.498993, -72.504997, 6.003000)
  DavisBlip = AddBlipForChar(Davis, 6, 2, 2)
  end
 
  F_Davis2 = function()
  if PlayerIsInTrigger(TRIGGER._TSCHOOL_FRONTGATE) then
  PedRecruitAlly(gplayer, Davis)
  end
  end
 
MissionCleanup = function()
collectgarbage()
end -- end statement

main = function()
F_Davis() -- Function Call
F_Davis2()
end

why davis didn't recruited??

You want davis is be your bodyguard?

Offline Black Norton

  • Keep Calm
  • Jr. Member
  • **
  • Posts: 86
  • Gender: Male
  • Peace For Respect
    • View Profile
Re: This Command not work??
« Reply #2 on: December 28, 2013, 04:41:03 AM »
Quote
You want davis is be your bodyguard?

No. . .
i mean if i reach the trigger davis will be recruited

Offline Black Norton

  • Keep Calm
  • Jr. Member
  • **
  • Posts: 86
  • Gender: Male
  • Peace For Respect
    • View Profile
Re: This Command not work??
« Reply #3 on: December 30, 2013, 05:21:02 AM »
Huh?? :blink:

nobody can fix my script?? :(

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: This Command not work??
« Reply #4 on: December 31, 2013, 03:12:53 AM »
Use PedIsinRectangle() instead
Aswell you didn't repeat the function that says when the ped gets to the trigger.

Offline Black Norton

  • Keep Calm
  • Jr. Member
  • **
  • Posts: 86
  • Gender: Male
  • Peace For Respect
    • View Profile
Re: This Command not work??
« Reply #5 on: December 31, 2013, 05:50:56 AM »
But i don't understand about
Code: [Select]
PedIsinRectangle(Ped,X1,Y1,X2,Y2)

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: This Command not work??
« Reply #6 on: December 31, 2013, 08:46:14 AM »
But i don't understand about
Code: [Select]
PedIsinRectangle(Ped,X1,Y1,X2,Y2)

In Bully there are X, Y and Z coords.
X is a coord for straight and backward while facing North, Y is a coord for right and left while facing North, Z is for hight.
So basicly using the X and Y coords you can create an imaginary square that if the player or the ped will stand in it, the next commands will trigger.

Lets say I chooce :

X1 = 5
Y1 = 10
X2 = 20
Y2 = 4

I want the player to be the ped which needs to be in the imaginary square, so we get this :

if PedInRectangle(gPlayer, 5,10,20,4) then
CODES

Explanesion :

If the player stands between these coords, the next commands of LUA will be actived.

Offline Black Norton

  • Keep Calm
  • Jr. Member
  • **
  • Posts: 86
  • Gender: Male
  • Peace For Respect
    • View Profile
Re: This Command not work??
« Reply #7 on: January 02, 2014, 06:57:13 AM »
Not work
look
Code: [Select]
ImportScript("\\Library\\LibTable.lua") -- imports the LibTable library
ImportScript("\\Library\\LibPed.lua") -- imports the LibPed library
local l_0_0 = false
 
MissionSetup = function() -- basic mission setup function which is used in almost all bully scripts
  local l_1_0 = 270 -- X coords
  local l_1_1 = -110 -- Y coords
  local l_1_2 = 6.4000000953674 -- Z coords
  PlayerSetHealth(200) -- gives the player 200 health
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2) -- teleports the player to the sidewalk outside the boys dorm
  end
 
  F_Davis = function()
  Davis = PedCreateXYZ(99, 301.498993, -72.504997, 6.003000)
  DavisBlip = AddBlipForChar(Davis, 6, 2, 2)
  end
 
  F_Davis2 = function()
  if PedInRectangle(gplayer, 326.8171387, -103.0250931, 323.7320557, -95.51804352) then
  PedRecruitAlly(gplayer, Davis)
  end
  end
 
MissionCleanup = function()
collectgarbage()
end -- end statement

main = function()
F_Davis() -- Function Call
F_Davis2()
end

why??  :confused:

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: This Command not work??
« Reply #8 on: January 02, 2014, 08:44:13 AM »
Code: [Select]
ImportScript("\\Library\\LibTable.lua") -- imports the LibTable library
ImportScript("\\Library\\LibPed.lua") -- imports the LibPed library
local l_0_0 = false
 
MissionSetup = function() -- basic mission setup function which is used in almost all bully scripts
  local l_1_0 = 270 -- X coords
  local l_1_1 = -110 -- Y coords
  local l_1_2 = 6.4000000953674 -- Z coords
  PlayerSetHealth(200) -- gives the player 200 health
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2) -- teleports the player to the sidewalk outside the boys dorm
  end
 
  F_Davis = function()
  Davis = PedCreateXYZ(99, 301.498993, -72.504997, 6.003000)
  DavisBlip = AddBlipForChar(Davis, 6, 2, 2)
  end
 
  F_Davis2 = function()
  if PedInRectangle(gplayer, 326.8171387, -103.0250931, 323.7320557, -95.51804352) then
  PedRecruitAlly(gplayer, Davis)
  end
  end
 
MissionCleanup = function()
collectgarbage()
end -- end statement

main = function()
F_Davis() -- Function Call
repeat
F_Davis2()
Wait(0)
until not Alive
end

There.
If it still dosn't work, then post here and I will show you a diffrent technique, as the technique I gave you now with the "if" for the PedInRectangle is buggy and may work in delay.

Offline Black Norton

  • Keep Calm
  • Jr. Member
  • **
  • Posts: 86
  • Gender: Male
  • Peace For Respect
    • View Profile
Re: This Command not work??
« Reply #9 on: January 03, 2014, 08:21:19 PM »
works. . .
thanks c00ld  :D

can i ask some code again?