Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function MissionSetup()
- -- Get original position:
- a = AreaGetVisible()
- x,y,z = PlayerGetPosXYZ()
- -- Move player in front of dorm (if you do not move the player somewhere, the script will fail to start for some reason):
- AreaTransitionXYZ(0,270,-110,6)
- -- Spawn allies:
- local leader = gPlayer
- for i,model in {102,85,146} do
- local ally = PedCreateXYZ(model,270+i,-110,6)
- PedSetPedToTypeAttitude(ally,13,4)
- PedRecruitAlly(leader,ally)
- leader = ally
- end
- -- Spawn enemies:
- enemies = {}
- for i,model in {20,16,121} do
- local enemy = PedCreateXYZ(model,270-i,-110,6)
- PedSetPedToTypeAttitude(enemy,13,0)
- PedAttackPlayer(enemy,1)
- AddBlipForChar(enemy,0,26,1)
- table.insert(enemies,enemy)
- end
- -- Make Jocks and Bullies hate each other:
- PedSetTypeToTypeAttitude(2,11,0)
- PedSetTypeToTypeAttitude(11,2,0)
- -- Disable trouble meter:
- DisablePunishmentSystem(true)
- -- Disable authority:
- originalModelStatus = {}
- for model = 49,52 do
- originalModelStatus[model] = PedGetUniqueModelStatus(model)
- PedSetUniqueModelStatus(model,-1)
- end
- end
- function MissionCleanup()
- -- Return to where player originally was:
- AreaTransitionXYZ(a,x,y,z)
- -- Re-enable trouble meter:
- DisablePunishmentSystem(false)
- -- Restore authority:
- for model,status in originalModelStatus do
- PedSetUniqueModelStatus(model,status)
- end
- end
- function main()
- -- Wait until all enemies are dead:
- repeat
- Wait(0)
- until AllEnemiesDead(enemies)
- -- Succeed the mission:
- MissionSucceed()
- end
- function AllEnemiesDead(t)
- -- Check if any peds in the table are still valid and not dead:
- for i,ped in t do
- if PedIsValid(ped) and not PedIsDead(ped) then
- return false
- end
- end
- -- If the function did not return "false" by now, that must mean all the peds are dead, so return true:
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment