[HELP] Tram bug
#1

And when i entering to tram all going good, but when i exiting from it, camera sets on tram, but my state is on foot... so what is it, bug? or something wrong in code, please help!

Код:
#include <a_samp>

#define RC_BANDIT	441
#define RC_BARON	464
#define RC_GOBLIN	501
#define RC_RAIDER	465
#define D_TRAM		449
#define RC_TANK		564
#define RC_CAM		594

public OnFilterScriptInit() {
	print("\n--------------------------------------");
	print("!damo!spiderman's Tram & RC FilterScript 0.1");
	print("--------------------------------------\n");
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
	if(newkeys == KEY_SECONDARY_ATTACK) {
		new Float:x, Float:y, Float:z, vehicle;
		new vehicleID = GetPlayerVehicleID(playerid);
		if(vehicleID == 0) {
			GetPlayerPos(playerid, x, y, z);
			GetVehicleWithinDistance(x, y, z, 20.0, vehicle);
			if(IsVehicleRcTram(vehicle)) PutPlayerInVehicle(playerid, vehicle, 0);
		} else if(GetVehicleModel(vehicleID) != D_TRAM && (IsVehicleRcTram(vehicleID) || GetVehicleModel(vehicleID) == RC_CAM)) {
			GetPlayerPos(playerid, x, y, z);
			SetPlayerPos(playerid, x+0.5, y, z+1.0);
		}
	}
}


GetVehicleWithinDistance(Float:x1, Float:y1, Float:z1, Float:dist, &veh) {
	new Float:x2, Float:y2, Float:z2, Float:d;
	for(new i = 1; i < MAX_VEHICLES; i++) {
		if(GetVehicleModel(i) > 0) {
			GetVehiclePos(i, x2, y2, z2);
			x2 -= x1; y2 -= y1; z2 -= z1;
			d = x2*x2 + y2*y2 + z2*z2;
			if(d < dist) {
				veh = i;
				dist = d;
			}
		}
	}
}

IsVehicleRcTram(vehicleid) {
	switch(GetVehicleModel(vehicleid)) {
		case D_TRAM, RC_GOBLIN, RC_BARON, RC_BANDIT, RC_RAIDER, RC_TANK: return 1;
	}
	return 0;
}
Reply


Messages In This Thread
[HELP] Tram bug - by V4at - 13.11.2011, 07:46
Re: [HELP] Tram bug - by Pinguinn - 13.11.2011, 08:35
Re : [HELP] Tram bug - by V4at - 13.11.2011, 09:32
Re: [HELP] Tram bug - by Pinguinn - 13.11.2011, 09:34
Re : [HELP] Tram bug - by V4at - 13.11.2011, 10:32
Re: [HELP] Tram bug - by Stigg - 13.11.2011, 10:34
Re : [HELP] Tram bug - by V4at - 13.11.2011, 11:19

Forum Jump:


Users browsing this thread: 6 Guest(s)