23.06.2012, 15:50
So im trying to fix my impoundcar code so it works.. What happens is when i do /impoundcar that car that im towing will disappear into a different virtual world or something but when i do it nothing happens please help me
This is the code to tow a car
And this is the code to impound a car
If you need any more code just ask
Thanks
This is the code to tow a car
pawn Код:
if(IsKeyJustDown(KEY_ACTION, newkeys, oldkeys))
{
new towtruckid = GetVehicleModel(GetPlayerVehicleID(playerid));
if (towtruckid == 525 || towtruckid == 552)
{
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)))
{
DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
}
else
{
AttachTrailerToVehicle(vid,GetPlayerVehicleID(playerid));
SendClientMessage(playerid, WHITE, "Deliver this car to the checkpoint");
SetPlayerCheckpoint(playerid, 1657.4601,-1713.4954,15.6094, 4.0);
Player[playerid][Checkpoint] = 99;
Player[playerid][Towing] = 1;
}
}
}
}
else
{
SendClientMessage(playerid, WHITE, "You need to be the driver!");
return 1;
}
}
}
pawn Код:
command(impoundcar, playerid, params[])
{
#pragma unused params
new vehicleid;
vehicleid == GetPlayerVehicleID(playerid);
if(Player[playerid][AbleToImpound] == 0)
{
SendClientMessage(playerid, WHITE, "You are not at the impound.");
}
else
{
if(Player[playerid][AbleToImpound] == 1 || IsPlayerInRangeOfPoint(playerid, 15.0, 1658.1001,-1711.9711,15.6094))
{
if(IsTrailerAttachedToVehicle(vehicleid))
{
SetVehicleVirtualWorld(vehicleid, 10);
}
}
}
}
Thanks