Hey people! I wanted to script a dealer job for my server, but i'm kinda stuck.
Код:
#define DEAL_CARS 2 //defined how much job cars
new DealCar[DEAL_CARS]; //so i can spawn the cars under a variable
new box; //if the player has a box to put in the truck
new filled; //If the truck is filled;
//under OnGameModeInit
DealCar[0] = AddStaticVehicleEx(609,-2188.3535,-2320.6082,30.3521,51.3085,0,0,-1);
DealCar[1] = AddStaticVehicleEx(609,-2192.7625,-2324.0413,30.3521,52.1908,0,0,-1); //Adding the vehicles
filled[DealCar[0]] = 0;//at the beginning, they are not filled
filled[DealCar[1]] = 0;
//under OnPlayerEnterVehicle
for(new i = 0; i < sizeof(DealCar); i ++)
{
if(vehicleid == DealCar[i] && filled == 0)
{
ClearAnimations(playerid);
GameTextForPlayer(playerid,"~r~ The vehicle is empity!",2000,4);
}
}
CMD:takebox(playerid,params[]) //To take a box from a place i've made
{
if(gTeam[playerid] == TEAM_COPS)return SendClientMessage(playerid,COLOR_RED,"[SERVER]: You are a
cop!");
if(!(IsPlayerInRangeOfPoint(playerid,2.0,-2197.7205,-2327.8655,30.6250)))return
SendClientMessage(playerid,COLOR_RED,"[DEAL]: You're not in the place for taking boxes!");
if(box[playerid] == 1)return SendClientMessage(playerid,COLOR_RED,"[DEAL]: You already have a box, put it
in the vehicle!");
SetPlayerAttachedObject(playerid,0,2912,6);
box[playerid] = 1;
return 1;
CMD:putboxintruck(playerid,params[]) //to put the box in the vehicle
{
if(!(IsPlayerInRangeOfPoint(playerid,2.0,-2188.9343,-2325.8489,30.6250)))return
SendClientMessage(playerid,COLOR_RED,"[DEAL]: You must be behind the truck!");
if(box[playerid] == 0)return SendClientMessage(playerid,COLOR_RED,"[DEAL]: You don't have a box!");
RemovePlayerAttachedObject(playerid,0);
box[playerid] = 0;
filled[DealCar[0]] = 1;
return 1;
}
//I also have coordinates for my checkpoints when job starts.
Guys I know this won't work and it needs a lot of stuff but i don't know how to do it. Please, if you have time, help me script this job.