So i'm using a lil' modified GF Edit, and i tryed to add a 5-cars vehicle system. Everything is fine and cool, but i don't know why my command /pojazd otworz (WHICH MEANS /VEHICLE OPEN) doesn't work! Maybe i should change the lock system to godfather compatible?
Код:
if(!strcmp(tmp, "otworz",true,4))
{
if(ProxDetectorV(6, playerid, veh1[playerid]))
{
VehicleInfo[veh1[playerid]][vLock] = 0;
SetVehicleParamsForPlayer(veh1[playerid], 0, 0, 0);
SaveVehicles(playerid, veh1[playerid]);
new str[256];
format(str, sizeof(str), "~w~%s ~n~~g~otwarty", VehicleNames[GetVehicleModel(veh1[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 5);
return 1;
}
if(ProxDetectorV(6, playerid, veh2[playerid]))
{
VehicleInfo[veh2[playerid]][vLock] = 0;
SetVehicleParamsForPlayer(veh2[playerid], 0, 0, 0);
SaveVehicles(playerid, veh1[playerid]);
new str[256];
format(str, sizeof(str), "~w~%s ~n~~g~otwarty", VehicleNames[GetVehicleModel(veh2[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 5);
return 1;
}
if(ProxDetectorV(6, playerid, veh3[playerid]))
{
VehicleInfo[veh3[playerid]][vLock] = 0;
SetVehicleParamsForPlayer(veh3[playerid], 0, 0, 0);
SaveVehicles(playerid, veh3[playerid]);
new str[256];
format(str, sizeof(str), "~w~%s ~n~~g~otwarty", VehicleNames[GetVehicleModel(veh3[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 5);
return 1;
}
if(ProxDetectorV(6, playerid, veh4[playerid]))
{
VehicleInfo[veh4[playerid]][vLock] = 0;
SetVehicleParamsForPlayer(veh4[playerid], 0, 0, 0);
SaveVehicles(playerid, veh4[playerid]);
new str[256];
format(str, sizeof(str), "~w~%s ~n~~g~otwarty", VehicleNames[GetVehicleModel(veh4[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 5);
return 1;
}
if(ProxDetectorV(6, playerid, veh5[playerid]))
{
VehicleInfo[veh5[playerid]][vLock] = 0;
SetVehicleParamsForPlayer(veh5[playerid], 0, 0, 0);
SaveVehicles(playerid, veh5[playerid]);
new str[256];
format(str, sizeof(str), "~w~%s ~n~~g~otwarty", VehicleNames[GetVehicleModel(veh5[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 5);
return 1;
}
}
That's my OPEN command.
Код:
forward ProxDetectorV(Float:radi, playerid, vehicleid);
public ProxDetectorV(Float:radi, playerid, vehicleid)
{
if(IsPlayerConnected(playerid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
//radi = 2.0; //Trigger Radius
GetVehiclePos(vehicleid, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}