27.07.2010, 18:57
Hello there,
I'm kinda frustrated of this situation here,several hours ago,I decided to use
a command to stop all NPCs ,and to start them all with another command,so that
their movements can be completely synchornized.I don't know if it was possible,and i made
something like this:
The code is a little bit dirty,sorry about that.The main idea is to create an .inc which defines the variables.Then include this inc into the gamemode for creating the start/stop command and into the npcmode script for recieving such commands.
The main question is I don't know where to put the StartRecordingPlayback or StopRecordingPlayback.I am pretty sure it shouldn't belong to OnPlayerStreamIn.
The result is all NPCs keep moving and did not stop after entering /fstop.
Anyone can help ? plz ? thx !
T
I'm kinda frustrated of this situation here,several hours ago,I decided to use
a command to stop all NPCs ,and to start them all with another command,so that
their movements can be completely synchornized.I don't know if it was possible,and i made
something like this:
The code is a little bit dirty,sorry about that.The main idea is to create an .inc which defines the variables.Then include this inc into the gamemode for creating the start/stop command and into the npcmode script for recieving such commands.
Код:
syncer.inc #include <a_samp> #include <a_npc> #define color 0xFFFF22AA new fsync_stop = 0; new fsync_start = 0; new sync_stop = 0; new sync_start = 0;
Код:
Gamemode #include <a_samp> #include <syncer> forward checkifsync(); public OnGameModeInit() { SetTimer("checkifsync",1000,1); } public checkifsync(){ if (fsync_stop == 1) { sync_start = 0; sync_stop = 1; fsync_stop = 0; fsync_start = 0; SendClientMessageToAll(color,"All NPCS are frozen and to be synchronized.Enter /fstart to restart the NPC movements."); } if (fsync_start == 1) { sync_start = 1; sync_stop = 0; fsync_stop = 0; fsync_start = 0; SendClientMessageToAll(color,"All NPCS are now restored.Enter /fstop again to freeze all NPCs."); } } public OnPlayerCommandText() { if(strcmp(cmd, "/fstart", true) == 0) { fsync_start = 1; return 1; } if(strcmp(cmd, "/fstop", true) == 0) { fsync_stop = 1; return 1; } }
Код:
NPCmode Script public OnPlayerStreamIn(){ if(sync_start == 1){ StartRecordingPlayback(RECORDING_TYPE, RECORDING); } if(sync_stop == 1){ StopRecordingPlayback(); } }
The result is all NPCs keep moving and did not stop after entering /fstop.
Anyone can help ? plz ? thx !
T