How to get script that starts EXACTLY when an NPC's path starts
#1

I have certain code that teleports a player to a vehicle thats driven by an NPC problem is I used OnPlayerSpawn.. checked if the name matched and it teleported me but it took like 3 seconds+ for it to actually do the recorded path... Is there a specific callback I can use it get it exactly right cause it needs to be in sync with some times I have setup or certain things will happen either early/late
Reply
#2

OnPlayerConnect?
Reply
#3

Obviously not. OnPlayerSpawn is called after OnPlayerConnect.. and thats not good enough.
Reply
#4

Quote:
Originally Posted by MisterTickle
Посмотреть сообщение
Obviously not. OnPlayerSpawn is called after OnPlayerConnect.. and thats not good enough.
But is that what you want?

Quote:

but it took like 3 seconds+ for it to actually do the recorded path

Reply
#5

Make a custom callback that will start it and do what you need?
Reply
#6

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
Make a custom callback that will start it and do what you need?
Lol.. I don't even know what to say. Maybe I'm not explaining it right. I need somehow to get a

OnNPCStartPath(npcid)

so that I can sync things up EXACTLY when the path starts not when an NPC connects or spawns (as it takes time) I could do a timer but.. thats not really reliable and exact.
Reply
#7

StartRecordingPlayback?
Reply
#8

I know what you mean mate. Now.. I do not know if there is a function to get the npc's state. Well, what you can do is restart the npc everytime.. Like : OnPlayerSpawn(..){SpawnPlayer(npcid);PutPlayerInVe hicle(playerid,2,2);}
Try that.. Now get the vehicle id the npc is driving. And place it on the first number 2. Plus the the id of the driver(npc).
I hope this worked for you mate..
Reply
#9

Quote:
Originally Posted by =WoR=Varth
Посмотреть сообщение
StartRecordingPlayback?
Yeah but doesn't have have to called in the scriptfile in npcmodes I cant call it directly from the gamemode? It doesn't come with a specific ID so I can't use it in the main gamemode (or I'm missing something here)


Quote:
Originally Posted by RelaxCafe
Посмотреть сообщение
I know what you mean mate. Now.. I do not know if there is a function to get the npc's state. Well, what you can do is restart the npc everytime.. Like : OnPlayerSpawn(..){SpawnPlayer(npcid);PutPlayerInVe hicle(playerid,2,2);}
Try that.. Now get the vehicle id the npc is driving. And place it on the first number 2. Plus the the id of the driver(npc).
I hope this worked for you mate..
I'm not sure what you mean man.. I have it put the NPC/Player in the vehicle when the NPC spawns.. but it takes some time to start the recording and im trying to find a way without using a timer as it won't be 100%
Reply
#10

Use a PVar and set it in your filterscript right after the NPC recording starts and have a timer in your gamemode where it checks if the PVar is a certain value and if it is, it calls a custom callback called OnNPCStartPath and have that loop through all the players with strcmp and see if the name matches with a NPC name you put in.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)