Announcements: Please turn off your adblock for Bullymods.net! Advertisements help us pay for the site, which allows you to use it--
*Also make sure to Introduce yourself, in the below section! Say Hi, and tell us who you are!* ~quinn

First script not working

User avatar
GovernedSquid6
New Kid
New Kid
Posts: 2
Joined: Tue Oct 17, 2017 9:12 pm

First script not working

Postby GovernedSquid6 » Fri Oct 20, 2017 9:34 pm

My first script, Fight Maker Mod, isn't doing anything, except for printing the text at the beginning. Could somebody take a look at the source code and tell me what i did wrong?

function main()
local ped1 = PedGetAllyFollower()
local ped2 = PedGetTargetPed()
TextPrintString("Fight Maker Mod", 2, 1)
Wait(4000)
TextPrintString("By Granty's Panties Delivery Service", 2, 1)
Wait(4000)
repeat
Wait(0)
do
if PedIsValid(ped2) then
if IsButtonBeingPressed(10, 0) and IsButtonBeingPressed(3, 0) and IsButtonBeingPressed(6, 0) then
PedRecruitAlly(gPlayer,ped2)
elseif PedIsValid(ped1) and IsButtonBeingPressed(10, 0) and IsButtonBeingPressed(3, 0) and IsButtonBeingPressed(9, 0) then
PedAttack(ped1, ped2, 3)
PedDismissAlly()
elseif PedIsValid(ped1) and IsButtonBeingPressed(10, 0) and IsButtonBeingPressed(12, 0) and IsButtonBeingPressed(3, 0) then
PedAttack(ped1, ped2, 3)
PedAttack(ped2, ped1, 3)
PedDismissAlly()
elseif IsButtonBeingPressed(10, 0) and IsButtonBeingPressed(12, 0) and IsButtonBeingPressed(6, 0) then
PedAttack(ped2, gplayer, 3)
end
end
end
until not Alive
end
function F_AttendedClass()
if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
return
end
SetSkippedClass(false)
PlayerSetPunishmentPoints(0)
end
function F_MissedClass()
if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
return
end
SetSkippedClass(true)
StatAddToInt(166)
end
function F_AttendedCurfew()
if not PedInConversation(gPlayer) and not MissionActive() then
TextPrintString("You got home in time for curfew", 4)
end
end
function F_MissedCurfew()
if not PedInConversation(gPlayer) and not MissionActive() then
TextPrint("TM_TIRED5", 4, 2)
end
end
function F_StartClass()
if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
return
end
F_RingSchoolBell()
local l_6_0 = PlayerGetPunishmentPoints() + GetSkippingPunishment()
end
function F_EndClass()
if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
return
end
F_RingSchoolBell()
end
function F_StartMorning()
F_UpdateTimeCycle()
end
function F_EndMorning()
F_UpdateTimeCycle()
end
function F_StartLunch()
if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
F_UpdateTimeCycle()
return
end
F_UpdateTimeCycle()
end
function F_EndLunch()
F_UpdateTimeCycle()
end
function F_StartAfternoon()
F_UpdateTimeCycle()
end
function F_EndAfternoon()
F_UpdateTimeCycle()
end
function F_StartEvening()
F_UpdateTimeCycle()
end
function F_EndEvening()
F_UpdateTimeCycle()
end
function F_StartCurfew_SlightlyTired()
F_UpdateTimeCycle()
end
function F_StartCurfew_Tired()
F_UpdateTimeCycle()
end
function F_StartCurfew_MoreTired()
F_UpdateTimeCycle()
end
function F_StartCurfew_TooTired()
F_UpdateTimeCycle()
end
function F_EndCurfew_TooTired()
F_UpdateTimeCycle()
end
function F_EndTired()
F_UpdateTimeCycle()
end
function F_Nothing()
end
function F_ClassWarning()
if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
return
end
local l_23_0 = math.random(1, 2)
end
function F_UpdateTimeCycle()
if not IsMissionCompleated("1_B") then
local l_24_0 = GetCurrentDay(false)
if l_24_0 < 0 or l_24_0 > 2 then
SetCurrentDay(0)
end
end
F_UpdateCurfew()
end
function F_UpdateCurfew()
local l_25_0 = shared.gCurfewRules
l_25_0 = l_25_0 or F_CurfewDefaultRules
l_25_0()
end
function F_CurfewDefaultRules()
local l_26_0 = ClockGet()
if l_26_0 >= 23 or l_26_0 < 7 then
shared.gCurfew = true
else
shared.gCurfew = false
end
end

User avatar
GovernedSquid6
New Kid
New Kid
Posts: 2
Joined: Tue Oct 17, 2017 9:12 pm

Re: First script not working

Postby GovernedSquid6 » Tue Oct 31, 2017 12:44 am

:(

User avatar
Altas
New Kid
New Kid
Posts: 12
Joined: Tue Oct 24, 2017 1:48 am
Location: Indonesia
Contact:

Re: First script not working

Postby Altas » Tue Oct 31, 2017 12:13 pm

First you need to learn about the function, just like PedGetAllyFollower() should be PedGetAllyFollower(ped) (ped = who is the pedestrian you mean) also the PedGetTargetPed(ped), i know it's working for Player because the function will automatically return gPlayer if you let it empty but i'm telling you about the correct use.

Second, make sure the targeting function inside the repeat section too because if you don't put it to the repeat so the game only detect your target at the time, so it will detect your target everytime.

Third, i'm not sure you can press that 3 buttons at the same time, i recomend you to make it IsButtonPressed(button,0) and IsButtonBeingPressed(button,0), just hold the first button and press the second button.


Actually i'm not tried this myself, or compile it, i don't know how does this work for you and i could be wrong about your script.
Here you go:

Code: Select all

function main()
	Wait(500) -- You need this
	-- Match your print time and waiting time, TextPrintString("text",4,1) = Wait(4000)
	TextPrintString("Fight Maker Mod", 4, 1)
	Wait(4000)
	TextPrintString("By Granty's Panties Delivery Service", 4, 1)
	Wait(4000)
	repeat
		local ped1 = PedGetAllyFollower(gPlayer)
		local ped2 = PedGetTargetPed(gPlayer)
		Wait(0)
		-- do -- What is this for?
		if PedIsValid(ped2) then
			-- Are u sure about pressing 3 buttons in the same time ?!
			if IsButtonBeingPressed(10, 0) and IsButtonBeingPressed(3, 0) and IsButtonBeingPressed(6, 0) then
				PedRecruitAlly(gPlayer,ped2)
			elseif PedIsValid(ped1) and IsButtonBeingPressed(10, 0) and IsButtonBeingPressed(3, 0) and IsButtonBeingPressed(9, 0) then
				PedAttack(ped1, ped2, 3)
				PedDismissAlly(gPlayer,ped2)
			elseif PedIsValid(ped1) and IsButtonBeingPressed(10, 0) and IsButtonBeingPressed(12, 0) and IsButtonBeingPressed(3, 0) then
				PedAttack(ped1, ped2, 3)
				PedAttack(ped2, ped1, 3)
				PedDismissAlly(gPlayer,ped2)
			elseif IsButtonBeingPressed(10, 0) and IsButtonBeingPressed(12, 0) and IsButtonBeingPressed(6, 0) then
				PedAttack(ped2, gplayer, 3)
			end
		end
	until not Alive
end
function F_AttendedClass()
	if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
		return
	end
	SetSkippedClass(false)
	PlayerSetPunishmentPoints(0)
end
function F_MissedClass()
	if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
		return
	end
	SetSkippedClass(true)
	StatAddToInt(166)
end
function F_AttendedCurfew()
	if not PedInConversation(gPlayer) and not MissionActive() then
		TextPrintString("You got home in time for curfew", 4)
	end
end
function F_MissedCurfew()
	if not PedInConversation(gPlayer) and not MissionActive() then
		TextPrint("TM_TIRED5", 4, 2)
	end
end
function F_StartClass()
	if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
		return
	end
	F_RingSchoolBell()
	local l_6_0 = PlayerGetPunishmentPoints() + GetSkippingPunishment()
end
function F_EndClass()
	if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
		return
	end
	F_RingSchoolBell()
end
function F_StartMorning()
	F_UpdateTimeCycle()
end
function F_EndMorning()
	F_UpdateTimeCycle()
end
function F_StartLunch()
	if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
		F_UpdateTimeCycle()
		return
	end
	F_UpdateTimeCycle()
end
function F_EndLunch()
	F_UpdateTimeCycle()
end
function F_StartAfternoon()
	F_UpdateTimeCycle()
end
function F_EndAfternoon()
	F_UpdateTimeCycle()
end
function F_StartEvening()
	F_UpdateTimeCycle()
end
function F_EndEvening()
	F_UpdateTimeCycle()
end
function F_StartCurfew_SlightlyTired()
	F_UpdateTimeCycle()
end
function F_StartCurfew_Tired()
	F_UpdateTimeCycle()
end
function F_StartCurfew_MoreTired()
	F_UpdateTimeCycle()
end
function F_StartCurfew_TooTired()
	F_UpdateTimeCycle()
end
function F_EndCurfew_TooTired()
	F_UpdateTimeCycle()
end
function F_EndTired()
	F_UpdateTimeCycle()
end
function F_Nothing()
end
function F_ClassWarning()
	if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
		return
	end
	local l_23_0 = math.random(1, 2)
end
function F_UpdateTimeCycle()
	if not IsMissionCompleated("1_B") then
		local l_24_0 = GetCurrentDay(false)
		if l_24_0 < 0 or l_24_0 > 2 then
			SetCurrentDay(0)
		end
	end
	F_UpdateCurfew()
end
function F_UpdateCurfew()
	local l_25_0 = shared.gCurfewRules
	l_25_0 = l_25_0 or F_CurfewDefaultRules
	l_25_0()
end
function F_CurfewDefaultRules()
	local l_26_0 = ClockGet()
	if l_26_0 >= 23 or l_26_0 < 7 then
		shared.gCurfew = true
	else
		shared.gCurfew = false
	end
end
We are not take over anything right now


Who is online

Users browsing this forum: No registered users and 1 guest