NPC - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: NPC (
/showthread.php?tid=458002)
NPC -
Alexis1999 - 14.08.2013
I've recently made a NPC and got it working perfectly. Except the part where it stops. After a few testing I've found that the problem occurs when the StopRecordingPlayback() is called. When that happens the server closes itself without leaving any error messages on the server log. Anyone know a solution for this?
P.S The NPC receives commands to stop or start the playback
Here's the NPC's file
pawn Код:
public OnClientMessage(color, text[]) {
if(text[0] != '/' || color != 123456) return;
if(strcmp(text, "/startdriving", true) == 0) {
StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER, "Car");
return;
}
if(strcmp(text, "/stopdriving", true) == 0) {
StopRecordingPlayback();
return;
}
}
And here's the stock method I use in my gamemode to stop the recording
pawn Код:
stock ResetTaxiDriver() {
NPCDriving = false;
SendClientMessage(Cardriver, 123456, "/stopdriving");
DestroyVehicle(Car);
Kick(Cardriver);
}
Re: NPC -
Alexis1999 - 14.08.2013
Nevermind Solved the problem.
For future reference if anyone else has the same problem here's the solution
Add this to OnPlayerDisconnect
pawn Код:
if(IsPlayerNPC(playerid)) return ConnectNPC("YOURNPCNAME", "CARNAME");