help with tow command please - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help with tow command please (
/showthread.php?tid=528190)
help with tow command please -
Lukka_Vercetti - 26.07.2014
hello was wondering if anyone could add this
if(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pJob2] == 7)
to these two tow commands
http://pastebin.com/FrMbnCpR
will +REP
Re: help with tow command please -
Beckett - 26.07.2014
pawn Код:
CMD:tow(playerid, params[])
{
if(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pJob2] == 7 || IsACop(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
new carid = GetPlayerVehicleID(playerid);
if(IsATowTruck(carid))
{
new closestcar = GetClosestCar(playerid, carid);
foreach(Player, i) {
if(arr_Towing[i] == closestcar || (GetPlayerVehicleID(i) == closestcar && GetPlayerState(i) == 2)) return SendClientMessage(playerid, COLOR_GREY, "You can't tow a vehicle which is occupied, or in tow.");
}
if(GetDistanceToCar(playerid,closestcar) <= 8 && !IsTrailerAttachedToVehicle(carid)) {
foreach(Player, i) {
if(GetPlayerVehicle(i, closestcar) != -1) {
new
hKey;
if(((hKey = PlayerInfo[i][pHouse]) != INVALID_HOUSE_ID) && IsPlayerInRangeOfPoint(playerid, 50.0, HouseInfo[hKey][hExteriorX], HouseInfo[hKey][hExteriorY], HouseInfo[hKey][hExteriorZ])
||((hKey = PlayerInfo[i][pHouse2]) != INVALID_HOUSE_ID) && IsPlayerInRangeOfPoint(playerid, 50.0, HouseInfo[hKey][hExteriorX], HouseInfo[hKey][hExteriorY], HouseInfo[hKey][hExteriorZ])) {
return SendClientMessage(playerid, COLOR_GREY, "This vehicle doesn't need to be towed.");
}
if(ProxDetectorS(30.0,playerid,i))
SendClientMessage(i, COLOR_LIGHTBLUE, "Someone is attempting to tow your vehicle away!");
arr_Towing[playerid] = closestcar;
SendClientMessage(playerid, COLOR_GRAD2, "This player owned vehicle is available for impounding.");
return AttachTrailerToVehicle(closestcar,carid);
}
}
SendClientMessage(playerid, COLOR_GRAD2, "This vehicle has no registration, it is available for impounding.");
AttachTrailerToVehicle(closestcar,carid);
arr_Towing[playerid] = closestcar;
return 1;
}
}
else SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to tow with this vehicle.");
}
}
else SendClientMessage(playerid, COLOR_GRAD2, "You need to be inside a vehicle to use this command!");
}
else SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use this command.");
return 1;
}
CMD:untow(playerid, params[])
{
if(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pJob2] == 7)
{
if(IsACop(playerid))
{
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
{
SendClientMessage(playerid, COLOR_GRAD1,"You have unhooked the vehicle that you were towing.");
arr_Towing[playerid] = INVALID_VEHICLE_ID;
DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
}
else
{
SendClientMessage(playerid, COLOR_GRAD1,"You're currently not towing anything.");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use this command.");
}
}
return 1;
}
Is that what you mean?
Re: help with tow command please -
DaTa[X] - 27.07.2014
pawn Код:
CMD:lukka(playerid,params[])
{
if(PlayerInfo[playerid][pJob] == 7)
{
// ........
return 1;
}
if( PlayerInfo[playerid][pJob2] == 7)
{
//...
return 1;
}
}
Re: help with tow command please -
Lukka_Vercetti - 27.07.2014
Quote:
Originally Posted by DaniceMcHarley
pawn Код:
CMD:tow(playerid, params[]) { if(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pJob2] == 7 || IsACop(playerid)) { if(IsPlayerInAnyVehicle(playerid)) { new carid = GetPlayerVehicleID(playerid); if(IsATowTruck(carid)) { new closestcar = GetClosestCar(playerid, carid);
foreach(Player, i) { if(arr_Towing[i] == closestcar || (GetPlayerVehicleID(i) == closestcar && GetPlayerState(i) == 2)) return SendClientMessage(playerid, COLOR_GREY, "You can't tow a vehicle which is occupied, or in tow."); }
if(GetDistanceToCar(playerid,closestcar) <= 8 && !IsTrailerAttachedToVehicle(carid)) { foreach(Player, i) { if(GetPlayerVehicle(i, closestcar) != -1) {
new hKey;
if(((hKey = PlayerInfo[i][pHouse]) != INVALID_HOUSE_ID) && IsPlayerInRangeOfPoint(playerid, 50.0, HouseInfo[hKey][hExteriorX], HouseInfo[hKey][hExteriorY], HouseInfo[hKey][hExteriorZ]) ||((hKey = PlayerInfo[i][pHouse2]) != INVALID_HOUSE_ID) && IsPlayerInRangeOfPoint(playerid, 50.0, HouseInfo[hKey][hExteriorX], HouseInfo[hKey][hExteriorY], HouseInfo[hKey][hExteriorZ])) { return SendClientMessage(playerid, COLOR_GREY, "This vehicle doesn't need to be towed."); }
if(ProxDetectorS(30.0,playerid,i)) SendClientMessage(i, COLOR_LIGHTBLUE, "Someone is attempting to tow your vehicle away!");
arr_Towing[playerid] = closestcar; SendClientMessage(playerid, COLOR_GRAD2, "This player owned vehicle is available for impounding."); return AttachTrailerToVehicle(closestcar,carid); } } SendClientMessage(playerid, COLOR_GRAD2, "This vehicle has no registration, it is available for impounding."); AttachTrailerToVehicle(closestcar,carid); arr_Towing[playerid] = closestcar; return 1; } } else SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to tow with this vehicle."); } } else SendClientMessage(playerid, COLOR_GRAD2, "You need to be inside a vehicle to use this command!"); } else SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use this command."); return 1; }
CMD:untow(playerid, params[]) { if(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pJob2] == 7) { if(IsACop(playerid)) { if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))) { SendClientMessage(playerid, COLOR_GRAD1,"You have unhooked the vehicle that you were towing."); arr_Towing[playerid] = INVALID_VEHICLE_ID; DetachTrailerFromVehicle(GetPlayerVehicleID(playerid)); } else { SendClientMessage(playerid, COLOR_GRAD1,"You're currently not towing anything."); } } else { SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use this command."); } } return 1; }
Is that what you mean?
|
that was it mate thank you very much, sorry would of done it last night but was sat
![Smiley](images/smilies/smile.png)
was out on the piss lol
+rep'd for the help bud cheers lol i couldnt figure out a { pmsl and i take it || means like the if, so thats a brilliant thing to remember cheers.. see this why i love the forums im not great at scripting but when people help with codes i dont get i start to learn whats what