possible to make the pickup trucks tow cars? -
killar456 - 11.03.2009
i found a command to tow cars for a towtruck but i was wondering if this code can be tweaked so pickup trucks can tow for like hitman
Код:
if(strcmp(cmd,"/tow",true)==0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] == 7)
{
if(IsPlayerInAnyVehicle(playerid))
{
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 525)
{
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));
}
}
}
if(!Found)
{
SendClientMessage(playerid,0xFFFF00AA,"There is no car in range.");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "You need to be the driver!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "You need to be in a Tow truck to use this!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "You need to be in a vehicle to do this!");
return 1;
}
}
else
{
SendClientMessage(playerid,COLOR_GRAD2,"You need to be a Mechanic to use this!");
return 1;
}
}
return 1;
}
Re: possible to make the pickup trucks tow cars? -
MenaceX^ - 11.03.2009
I don't understand what you want, but I hate commands from the style like you made. I use in my way which is faster, many people use it altought.
pawn Код:
if(!strcmp(cmd,"/tow",true))
{
if(PlayerInfo[playerid][pJob]!=7)
return SendClientMessage(playerid,COLOR_GRAD2,"You need to be a Mechanic to use this!");
if(!IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid, COLOR_GRAD2, "You need to be in a vehicle to do this!");
if(GetVehicleModel(GetPlayerVehicleID(playerid))!=525)
return SendClientMessage(playerid, COLOR_GRAD2, "You need to be in a Tow truck to use this!");
if(GetPlayerState(playerid)!=2)
return SendClientMessage(playerid, COLOR_GRAD2, "You need to be the driver!");
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));
}
}
if(!Found)
{
SendClientMessage(playerid,0xFFFF00AA,"There is no car in range.");
}
return 1;
}
Re: possible to make the pickup trucks tow cars? -
killar456 - 11.03.2009
i want the trucks "bobcat, yosemite" to be able to tow other cars, something like a chain
but i dont know if it can be done, everything i tried didnt work
Re: possible to make the pickup trucks tow cars? -
MenaceX^ - 11.03.2009
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid))!=525||GetVehicleModel(GetPlayerVehicleID(playerid))!=554) // yusemite.
return SendClientMessage(playerid, COLOR_GRAD2, "You need to be in a Tow truck to use this!");
Re: possible to make the pickup trucks tow cars? -
killar456 - 11.03.2009
oh, ill try that
Re: possible to make the pickup trucks tow cars? -
MenaceX^ - 11.03.2009
You just need to add more cars ids that will be available to use this command..
To add more it will be better to use;
pawn Код:
new vid=GetPlayerVehicleID(playerid);
And then you do it as
pawn Код:
if(GetVehicleModel(vid)!=525||GetVehicleModel(vid)!=554)
Re: possible to make the pickup trucks tow cars? -
killar456 - 11.03.2009
as you can probally tell, im new at scripting and i got these errors when i put those in
Код:
C:\Program Files\Rockstar Games\GTA San Andreas\SA-MP SERVER\CityWideRP\gamemodes\cwrp.pwn(21913) : error 029: invalid expression, assumed zero
C:\Program Files\Rockstar Games\GTA San Andreas\SA-MP SERVER\CityWideRP\gamemodes\cwrp.pwn(21913 -- 21914) : error 029: invalid expression, assumed zero
C:\Program Files\Rockstar Games\GTA San Andreas\SA-MP SERVER\CityWideRP\gamemodes\cwrp.pwn(21950) : error 029: invalid expression, assumed zero
Re: possible to make the pickup trucks tow cars? -
MenaceX^ - 11.03.2009
Lines of errors?
Re: possible to make the pickup trucks tow cars? -
killar456 - 11.03.2009
EDIT!!::
nvm i fixed it, i forgot to remove the ) from first one and add to the last one.....