30.08.2012, 14:35
I have this command on my GM
if i am in the middle of nowhere and no car is near me it says that i have attached the vehicle and i need to go to the checkpoint ...
if i am in the middle of nowhere and no car is near me it says that i have attached the vehicle and i need to go to the checkpoint ...
PHP код:
if(strcmp(cmd,"/towcar",true)==0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] == 7)
{
if(IsPlayerInAnyVehicle(playerid))
{
new car = GetVehicleModel(GetPlayerVehicleID(playerid));
if (car >= towcar1 || car <= towcar8)
{
if(GetPlayerState(playerid)==2)
{
new Float:pX,Float:pY,Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
new Float:vX,Float:vY,Float:vZ;
new Found=0;
new vid=0;
while((vid<MAX_VEHICLES)&&(!Found))
{
vid++;
GetVehiclePos(vid,vX,vY,vZ);
if ((floatabs(pX-vX)<7.0)&&(floatabs(pY-vY)<7.0)&&(floatabs(pZ-vZ)<7.0)&&(vid!=GetPlayerVehicleID(playerid)))
{
Found=1;
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))) { }
else
{
if(PlayerInfo[playerid][pTowedCars] <= 10)
{
VSegundosA[playerid] = 0;
VMinutosA[playerid] = 0;
GameTextForPlayer(playerid, "~y~00~w~:~b~00", 1500, 6);
TContraAutoCarTow[playerid] = SetTimerEx("ContadoAutoCarTow",1000,1,"d",playerid);
PlayerInfo[playerid][pTowc] = 1;
AttachTrailerToVehicle(vid,GetPlayerVehicleID(playerid));
SCM(playerid, COLOR_YELLOW, "{00ccff}[CS16]: {ffffff}You have 5 mi to go to the checkpoint!");
CP[playerid] = 96;
SetPlayerCheckpoint(playerid, 1259.7102,-1803.7456,13.2930, 6.5);
SetTimerEx("towtime", 300000, 0, "%d", playerid);
}
else if(PlayerInfo[playerid][pTowedCars] >= 11)
{
SCM(playerid, COLOR_LIGHTBLUE, "You have towed already 10 cars, wait till next payday!");
GameTextForPlayer(playerid, "~r~Wait the PayDay !", 2500, 1);
DisablePlayerCheckpoint(playerid);
}
}
}
}
if(!Found)
{
SCM(playerid,0xFFFF00AA,"No car near you.");
}
}
}
else
{
SCM(playerid, COLOR_GRAD2, "You must be in a tow truck !");
return 1;
}
}
}
}
return 1;
}