09.07.2012, 09:29
Hey guys im editing the zgaming roleplay script and iv messed with the trucking job a bit. Iv moved the location of trucks and pickup spots etc. What i want to do now though, is intead of picking up the truck and trailer at once then going to the pickup spot and typing /getpackages then going to the droppoff and finishing. I want to get the truck from one spot, drive to where iv set the .getpackages, but instead of typing a command. You will find the trailers there, when you connect one it sets the marker to the drop location and you finish the job.
I hope everyone can understand what im saying here. I need help with doing this because i dont know where
in the code to check wether the certain trailers are connected to the trucks and once they actually are it continues with the job.
The truck and trailer spawn codes is this:
Trucks:
Trailers:
and what happens when you type /getpackages does this:
I hope this covers everything and if anyone needs more info please ask, im so keen to get this working. Thanks very much!
I hope everyone can understand what im saying here. I need help with doing this because i dont know where
in the code to check wether the certain trailers are connected to the trucks and once they actually are it continues with the job.
The truck and trailer spawn codes is this:
Trucks:
Код:
JobInfo[JOB_TRUCKER][jCars][0] = CreateVehicle(403,-55.6420,-1134.8212,1.6647,67.6132,0,0,1200); // Truck 1 done JobInfo[JOB_TRUCKER][jCars][1] = CreateVehicle(403,-58.1440,-1140.3358,1.6796,65.6161,1,1,1200); // Truck 2 done JobInfo[JOB_TRUCKER][jCars][2] = CreateVehicle(403,-60.4571,-1146.3438,1.6660,64.5392,86,86,1200); // Truck 3
Код:
JobInfo[JOB_TRUCKER][jTrailers][0] = CreateVehicle(591,-47.418,-1138.519,1.650,65.6161,0,0,60); // Trailer1 done JobInfo[JOB_TRUCKER][jTrailers][1] = CreateVehicle(591,-49.938,-1144.083,1.648,65.6161,1,1,60); // Trailer2 done JobInfo[JOB_TRUCKER][jTrailers][2] = CreateVehicle(591,-52.295,-1150.180,1.650,65.6161,86,86,60); // Trailer3
Код:
CMD:getpackages(playerid, params[]) { new string[128], packages; // L1: 0 | L2: 100 | L3: 300 | L4: 700 | L5: 1200 if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 100) packages = 5; else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 300) packages = 10; else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 700) packages = 15; else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 1200) packages = 20; else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] >= 1200) packages = 25; if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(PlayerInfo[playerid][pJob] != JOB_TRUCKER && PlayerInfo[playerid][pVIPJob] != JOB_TRUCKER) return SendClientMessage(playerid, COLOR_GREY, "You are not a Trucker."); if(PlayerInfo[playerid][pTPackages] == 2) return SendClientMessage(playerid, COLOR_GREY, "You already have overloaded packages."); if(!IsPlayerInAnyVehicle(playerid) || !IsTruckerVehicle(GetPlayerVehicleID(playerid)) || !IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))) return SendClientMessage(playerid, COLOR_GREY, "You are not in a Trucker vehicle or you have no trailer attached."); if(!IsPlayerInRangeOfPoint(playerid, 5, 867.3699,-1209.2664,16.9766)) return SendClientMessage(playerid, COLOR_GREY, "You are not near a packages pickup."); if(PlayerInfo[playerid][pMoney] < packages*5) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money on you."); PlayerInfo[playerid][pTPackages] ++; GiveZaiatMoney(playerid, -(packages*5)); PlayerInfo[playerid][pDeliverTruck] = GetPlayerVehicleID(playerid); TruckPackages[GetPlayerVehicleID(playerid)] = playerid; format(string, sizeof(string), "* %s has loaded %d product packages from the pickup.", RPN(playerid), packages); SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); format(string, sizeof(string), "* You have loaded {FF6347}%d product{33CCFF} packages for {FF6347}$%d{33CCFF}, deliver them to the dropoff.", packages, packages*5); GameTextForPlayer(playerid, "~r~Packages Loaded", 3500, 3); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); if(PlayerInfo[playerid][pTPackages] != 2) { SendClientMessage(playerid, COLOR_WHITE, "You can overload packages by typing /getpackages again, cops will be notified though."); } SetPlayerCheckpoint(playerid, 2222.5107,-2682.7368,13.5409, 5); if(PlayerInfo[playerid][pTPackages] == 2) { GameTextForPlayer(playerid, "~r~Packages overloaded", 3500, 3); SendClientMessage(playerid, COLOR_LIGHTRED, "* You have overloaded packages, the Police Department has been notified as a result."); SendCopMessage(COLOR_BLUE, "Products Depot: A truck has overloaded packages and is on it way to the dropoff now."); } return 1; }