26.05.2010, 11:40
Hi - not sure whether this is the right place to spam this but here goes:
Basically I've added this to a previously working bus:
Since I've added the detection for real players the bus lags/warps everywhere and I can't see why, I know the script is crude but it is just a theory tester. Doesn't appear to use any excessive CPU.. any ideas? Has anyone ever made this work?
Cheers,
ozzie
Basically I've added this to a previously working bus:
Quote:
#define RECORDING "Route1376" //This is the filename of your recording without the extension. #define RECORDING_TYPE 1 //1 for in vehicle and 2 for on foot. #include <a_npc> forward BusECU(); main() { SetTimer("BusECU",1000,1); return 1; } 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 public BusECU() { new trigger = 0; new Float, Float:y, Float:z; GetMyPos(x,y,z); for (new a = 0; a <= 63; a++) { if (IsPlayerConnected(a)) { new name[64]; GetPlayerName(a,name,64); if (strcmp(name,"NPC",false,3)) { SendChat("Player is not an NPC"); if (GetPlayerVehicleID(a) != 1376) { if (IsPlayerInRangeOfPoint(a,50.00000,x,y,z)) { trigger = 1; SendChat("Player is in the way"); } } } } } if (trigger == 1) { PauseRecordingPlayback(); SendChat("Bus Paused"); } else { ResumeRecordingPlayback(); SendChat("Bus Running"); } return 1; } |
Cheers,
ozzie