Jump to content
  • 0

Putin ajutor pls!


Pinki95

Question

Cum as putea face sa merg fara trailer doar vehiculul gol:

[pawn]#include <a_samp>

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

#define COLOR_ORANGE 0xFFA500FF

#define COLOR_LIMEGREEN 0x32CD32FF

#define COLOR_ROYALBLUE 0x4169E1FF

#define COLOR_SALMON 0xFA8072FF

#define COLOR_GREY 0xAFAFAFAA

#define COLOR_GREEN 0x33AA33AA

#define COLOR_RED 0xAA3333AA

#define COLOR_YELLOW 0xFFFF00AA

#define COLOR_WHITE 0xFFFFFFAA

#define COLOR_BLUE 0x0000BBAA

#define COLOR_LIGHTBLUE 0x33CCFFAA

#define COLOR_RED 0xAA3333AA

enum MisLocationsEnum

{

ID,

LoadName[128],

Float:LoadX,

Float:LoadY,

Float:LoadZ,

Float:UnloadX,

Float:UnloadY,

Float:UnloadZ,

Pay

}

new MisLocations[][MisLocationsEnum] =

{

{0, "Beer from Red County Brewery to Bone County Diner",-24.4073,-281.8898,5.9985,-305.4319,1315.6797,54.6189, 5980},

{1, "Fuel from LV Oil Refinery to LV Dirtring",266.8981,1416.5417,10.2001,1097.5164,1741.7422,10.5474, 5700},

{2, "Vehicle Parts from SF Airport ATC to Wang Cars",-1268.8223,13.6925,14.8682,-1986.3477,253.9728,35.8985, 3000},

{3, "Fuel from SF Oil Refinery to RS Haul",-1016.3634,-688.2434,32.7284,-55.3397,-1138.2479,0.8052, 18770}

};

#define TEAM_TRUCKER 1

new iMissionText[512][MAX_PLAYERS], Float:unx[MAX_PLAYERS], Float:uny[MAX_PLAYERS], Float:unz[MAX_PLAYERS], iPay[MAX_PLAYERS], MissionStatus[MAX_PLAYERS];

main(){}

public OnGameModeInit()

{

AddPlayerClass(72, -2105.3228, -124.2982, 37.2531, 0.0, 0,0,0,0,0,0);//Trucker - SF

return 1;

}

public OnPlayerRequestClass(playerid, classid)

{

switch (classid)

{

case 0:

{

GameTextForPlayer(playerid, "Trucker", 3000, 4);

SetPlayerTeam(playerid, TEAM_TRUCKER);

}

}

return 1;

}

public OnPlayerSpawn(playerid)

{

if(GetPlayerTeam(playerid) == TEAM_TRUCKER)

{

SetPlayerColor(playerid, COLOR_GREEN);

}

return 1;

}

public OnPlayerCommandText(playerid, cmdtext[])

{

dcmd(work, 4, cmdtext);

dcmd(stopwork, 8, cmdtext);

return 0;

}

dcmd_work(playerid, params[])

{

#pragma unused params

if(GetPlayerTeam(playerid) == TEAM_TRUCKER) return T_NewJob(playerid);

return 1;

}

dcmd_stopwork(playerid, params[])

{

    #pragma unused params

if(GetPlayerTeam(playerid) == TEAM_TRUCKER) return StopWork(playerid);

return 1;

}

stock T_NewJob(playerid)

{

    new vID = GetPlayerVehicleID(playerid);

if(GetVehicleModel(vID)== 403 || GetVehicleModel(vID)== 515 || GetVehicleModel(vID) == 514)

{

    if(IsTrailerAttachedToVehicle(vID))

    {

    MissionStatus[playerid] = 1;

    new MisRand = random(sizeof(MisLocations));

new LoadText[128], Float:x, Float:y, Float:z;

x = MisLocations[MisRand][LoadX];

y = MisLocations[MisRand][LoadY];

z = MisLocations[MisRand][LoadZ];

unx[playerid] = MisLocations[MisRand][unloadX];

uny[playerid] = MisLocations[MisRand][unloadY];

unz[playerid] = MisLocations[MisRand][unloadZ];

iPay[playerid] = MisLocations[MisRand][Pay];

SetPlayerCheckpoint(playerid, x, y, z, 7);

format(LoadText, 128, "%s",MisLocations[MisRand][LoadName]);

SendClientMessage(playerid, COLOR_GREEN, "Mission:");

SendClientMessage(playerid, COLOR_GREEN, "_____________________");

SendClientMessage(playerid, COLOR_GREEN, "");

SendClientMessage(playerid, 0xFFFFFFFF, LoadText);

SendClientMessage(playerid, COLOR_GREEN, "_____________________");

}

else

{

SendClientMessage(playerid, COLOR_RED, "You need a trailer!");

}

}

else

{

    SendClientMessage(playerid, COLOR_RED, "You must be in a Truck to perform this!");

}

return 1;

}

stock StopWork(playerid)

{

DisablePlayerCheckpoint(playerid);

SendClientMessage(playerid, COLOR_RED, "You chose to cancel the mission and got fined $100");

GivePlayerMoney(playerid, -100);

MissionStatus[playerid] = 0;

return 1;

}

public OnPlayerEnterCheckpoint(playerid)

{

CheckpointEntered(playerid);

return 1;

}

stock CheckpointEntered(playerid)

{

new gString[128];

new vID = GetPlayerVehicleID(playerid);

if(!IsTrailerAttachedToVehicle(vID)) return SendClientMessage(playerid, COLOR_RED, "You need a trailer to unload!");

if(MissionStatus[playerid] == 1)

{

DisablePlayerCheckpoint(playerid);

SetPlayerCheckpoint(playerid, unx[playerid], uny[playerid], unz[playerid], 7);

SendClientMessage(playerid, COLOR_ORANGE, "Loaded. Please head to the second checkpoint!");

MissionStatus[playerid] = 2;

}

    else if(MissionStatus[playerid] == 2)

{

DisablePlayerCheckpoint(playerid);

GivePlayerMoney(playerid, iPay[playerid]);

SendClientMessage(playerid, COLOR_GREEN, "Well done! You completed the mission!");

format(gString, 512, "%s has completed mission: %s", pName(playerid), iMissionText[playerid]);

SendClientMessageToAll(COLOR_GREEN, gString);

SetPlayerScore(playerid, GetPlayerScore(playerid)+2);

MissionStatus[playerid] = 0;

}

return 1;

}

stock pName(PN)

{

new PX[MAX_PLAYER_NAME];

GetPlayerName(PN, PX, sizeof(PX));

return PX;

}[/pawn]

560x95_F01616_1625F2_030303_000000.png
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Sa rezolvat:

[pawn]#include <a_samp>

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

#define COLOR_ORANGE 0xFFA500FF

#define COLOR_LIMEGREEN 0x32CD32FF

#define COLOR_ROYALBLUE 0x4169E1FF

#define COLOR_SALMON 0xFA8072FF

#define COLOR_GREY 0xAFAFAFAA

#define COLOR_GREEN 0x33AA33AA

#define COLOR_RED 0xAA3333AA

#define COLOR_YELLOW 0xFFFF00AA

#define COLOR_WHITE 0xFFFFFFAA

#define COLOR_BLUE 0x0000BBAA

#define COLOR_LIGHTBLUE 0x33CCFFAA

#define COLOR_RED 0xAA3333AA

enum MisLocationsEnum

{

ID,

LoadName[128],

Float:LoadX,

Float:LoadY,

Float:LoadZ,

Float:UnloadX,

Float:UnloadY,

Float:UnloadZ,

Pay

}

new MisLocations[][MisLocationsEnum] =

{

{0, "Beer from Red County Brewery to Bone County Diner",-24.4073,-281.8898,5.9985,-305.4319,1315.6797,54.6189, 5980},

{1, "Fuel from LV Oil Refinery to LV Dirtring",266.8981,1416.5417,10.2001,1097.5164,1741.7422,10.5474, 5700},

{2, "Vehicle Parts from SF Airport ATC to Wang Cars",-1268.8223,13.6925,14.8682,-1986.3477,253.9728,35.8985, 3000},

{3, "Fuel from SF Oil Refinery to RS Haul",-1016.3634,-688.2434,32.7284,-55.3397,-1138.2479,0.8052, 18770}

};

#define TEAM_TRUCKER 1

new iMissionText[512][MAX_PLAYERS], Float:unx[MAX_PLAYERS], Float:uny[MAX_PLAYERS], Float:unz[MAX_PLAYERS], iPay[MAX_PLAYERS], MissionStatus[MAX_PLAYERS];

main(){}

public OnGameModeInit()

{

AddPlayerClass(72, -2105.3228, -124.2982, 37.2531, 0.0, 0,0,0,0,0,0);//Trucker - SF

return 1;

}

public OnPlayerRequestClass(playerid, classid)

{

switch (classid)

{

case 0:

{

GameTextForPlayer(playerid, "Trucker", 3000, 4);

SetPlayerTeam(playerid, TEAM_TRUCKER);

}

}

return 1;

}

public OnPlayerSpawn(playerid)

{

if(GetPlayerTeam(playerid) == TEAM_TRUCKER)

{

SetPlayerColor(playerid, COLOR_GREEN);

}

return 1;

}

public OnPlayerCommandText(playerid, cmdtext[])

{

dcmd(work, 4, cmdtext);

dcmd(stopwork, 8, cmdtext);

return 0;

}

dcmd_work(playerid, params[])

{

#pragma unused params

if(GetPlayerTeam(playerid) == TEAM_TRUCKER) return T_NewJob(playerid);

return 1;

}

dcmd_stopwork(playerid, params[])

{

    #pragma unused params

if(GetPlayerTeam(playerid) == TEAM_TRUCKER) return StopWork(playerid);

return 1;

}

stock T_NewJob(playerid)

{

    new vID = GetPlayerVehicleID(playerid);

if(GetVehicleModel(vID)== 403 || GetVehicleModel(vID)== 515 || GetVehicleModel(vID) == 514)

{

    MissionStatus[playerid] = 1;

    new MisRand = random(sizeof(MisLocations));

new LoadText[128], Float:x, Float:y, Float:z;

x = MisLocations[MisRand][LoadX];

y = MisLocations[MisRand][LoadY];

z = MisLocations[MisRand][LoadZ];

unx[playerid] = MisLocations[MisRand][unloadX];

uny[playerid] = MisLocations[MisRand][unloadY];

unz[playerid] = MisLocations[MisRand][unloadZ];

iPay[playerid] = MisLocations[MisRand][Pay];

SetPlayerCheckpoint(playerid, x, y, z, 7);

format(LoadText, 128, "%s",MisLocations[MisRand][LoadName]);

SendClientMessage(playerid, COLOR_GREEN, "Mission:");

SendClientMessage(playerid, COLOR_GREEN, "_____________________");

SendClientMessage(playerid, COLOR_GREEN, "");

SendClientMessage(playerid, 0xFFFFFFFF, LoadText);

SendClientMessage(playerid, COLOR_GREEN, "_____________________");

}

else

{

    SendClientMessage(playerid, COLOR_RED, "You must be in a Truck to perform this!");

}

return 1;

}

stock StopWork(playerid)

{

DisablePlayerCheckpoint(playerid);

SendClientMessage(playerid, COLOR_RED, "You chose to cancel the mission and got fined $100");

GivePlayerMoney(playerid, -100);

MissionStatus[playerid] = 0;

return 1;

}

public OnPlayerEnterCheckpoint(playerid)

{

CheckpointEntered(playerid);

return 1;

}

stock CheckpointEntered(playerid)

{

new gString[128];

if(MissionStatus[playerid] == 1)

{

DisablePlayerCheckpoint(playerid);

SetPlayerCheckpoint(playerid, unx[playerid], uny[playerid], unz[playerid], 7);

SendClientMessage(playerid, COLOR_ORANGE, "Loaded. Please head to the second checkpoint!");

MissionStatus[playerid] = 2;

}

    else if(MissionStatus[playerid] == 2)

{

DisablePlayerCheckpoint(playerid);

GivePlayerMoney(playerid, iPay[playerid]);

SendClientMessage(playerid, COLOR_GREEN, "Well done! You completed the mission!");

format(gString, 512, "%s has completed mission: %s", pName(playerid), iMissionText[playerid]);

SendClientMessageToAll(COLOR_GREEN, gString);

SetPlayerScore(playerid, GetPlayerScore(playerid)+2);

MissionStatus[playerid] = 0;

}

return 1;

}

stock pName(PN)

{

new PX[MAX_PLAYER_NAME];

GetPlayerName(PN, PX, sizeof(PX));

return PX;

}[/pawn]

560x95_F01616_1625F2_030303_000000.png
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.