NPC weird reaction - 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 weird reaction (
/showthread.php?tid=314189)
NPC weird reaction -
KreeDz - 28.01.2012
Hello, so i`ll get straight to the problem.
I've got a BUS system controlled by npcs. The only problem is that, one of the buses works just perfectly, on the other hand, every time a player teleports or makes its presence around the second bus, the NPC practically get's out of the bus and the bus completely stops with the npc standing beside it. I know it's a rare problem and there may be not so much people that encountered it but, if someone does, please be kind and give me at least a hint about what it could be. I have to say that both buses work on the same matters. And by that i mean that they are scripted in the same way.
Re: NPC weird reaction -
[KHK]Khalid - 29.01.2012
can you show us the codes?
Re: NPC weird reaction -
KreeDz - 29.01.2012
If you think that pasting a code shuttered around the gm is that easy then... meh, mkay.
But, I will say again, there's not much difference between the codes. So, how does one bus work but the other one just stops in the presence of a player? [ The recording keeps going, if i TP to the bus id again, it teleports me to an invisible moving thingy which is the actual recording. ]
Код:
OnPlayerSpawn:
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
if(!strcmp(npcname, "EasternBus", true))
{
SetPlayerColor(playerid, 0xFFFFFF00);
PutPlayerInVehicle(playerid, Bus38, 0);
SetPlayerSkin(playerid, 255);
ResetPlayerWeapons(playerid);
Attach3DTextLabelToVehicle(Text38, Bus38, 0.0, 0.0, 0.0);
}
if(!strcmp(npcname, "WesternBus", true))
{
SetPlayerColor(playerid, 0xFFFFFF00);
PutPlayerInVehicle(playerid, Bus85, 0);
SetPlayerSkin(playerid, 255);
ResetPlayerWeapons(playerid);
Attach3DTextLabelToVehicle(Text85, Bus85, 0.0, 0.0, 0.0);
}
return 1;
}
The basic stuff at ongamemodeinit:
ConnectNPC("EasternBus","Bus");
ConnectNPC("WesternBus","Bus2");
The recordings .pwn files:
#define RECORDING "Bus"
#define RECORDING_TYPE 1
#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#if RECORDING_TYPE == 1
public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCExitVehicle() StopRecordingPlayback();
#else
public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
and
#define RECORDING "Bus2"
#define RECORDING_TYPE 1
#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#if RECORDING_TYPE == 1
public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCExitVehicle() StopRecordingPlayback();
#else
public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
The rest of the code doesn't matter so i won't bother pasting it.
Re: NPC weird reaction -
KreeDz - 31.01.2012
Uhm, no one?