15.12.2016, 13:19
Hey guys, i'm trying to make a trucker thing for a roleplay server but i'm unsure of how to make it only work for the player who takes the job. I've tried some other things and i'm really unsure of how to do it so i thought i'd post it up!
Anyways, here's some of the code. I hope it's enough for you to be able to help!
"new"
OnPlayerEnterCheckpoint:
Anyways, here's some of the code. I hope it's enough for you to be able to help!
"new"
Код:
new CDLLOADAT1 = 0; new CDLLOADFT1 = 0; new CDLLOADCT1 = 0;
Код:
if(CDLLOADAT1 == 1) { if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER && IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) != 1 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 403 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 514 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 515) { SendClientMessage(playerid, COLOR_RED, "WARNING: {FFFFFF}You cannot complete the drop without the load."); DisablePlayerCheckpoint(playerid); CDLLOADAT1 = 0; return 1; } DisablePlayerCheckpoint(playerid); CDLLOADAT1 = 2; SendClientMessage(playerid, COLOR_DBLUE, "Dock Staff: {FFFFFF}Please deliver these parts to the abandoned airport!"); SetPlayerCheckpoint(playerid, 382.6809,2539.5164,16.5391, 3.0); return 1; } if(CDLLOADAT1 == 2) { if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER && IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) != 1 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 403 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 514 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 515) { SendClientMessage(playerid, COLOR_RED, "WARNING: {FFFFFF}You cannot complete the drop without the load."); DisablePlayerCheckpoint(playerid); CDLLOADAT1 = 0; return 1; } if(IsCDLVehicles(GetPlayerVehicleID(playerid))) { DisablePlayerCheckpoint(playerid); CDLLOADAT1 = 0; SendClientMessage(playerid, COLOR_GRAD1, "AA Scrapyard: Thank you for delivering these parts, here's your money!"); SendClientMessage(playerid, COLOR_GRAD2, "AA Scrapyard handed you a payslip of $5,000."); SendClientMessage(playerid, COLOR_GRAD2, "A certain amount has been deducted for the use of a company truck."); GivePlayerCash(playerid, 5000); PlayerInfo[playerid][pTruckSkill]++; return 1; } DisablePlayerCheckpoint(playerid); CDLLOADAT1 = 0; SendClientMessage(playerid, COLOR_GRAD1, "AA Scrapyard: Thank you for delivering these parts, here's your money!"); SendClientMessage(playerid, COLOR_GRAD2, "AA Scrapyard handed you a payslip of $10,000."); GivePlayerCash(playerid, 10000); PlayerInfo[playerid][pTruckSkill]++; return 1; } if(CDLLOADFT1 == 1) { if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER && IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) != 1 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 403 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 514 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 515) { SendClientMessage(playerid, COLOR_RED, "WARNING: {FFFFFF}You cannot complete the drop without the load."); DisablePlayerCheckpoint(playerid); CDLLOADFT1 = 0; return 1; } DisablePlayerCheckpoint(playerid); CDLLOADFT1 = 2; SendClientMessage(playerid, COLOR_DBLUE, "Dock Staff: {FFFFFF}Please deliver these parts to KACC Fuels!"); SetPlayerCheckpoint(playerid, 2576.0520,2728.2244,10.8203, 3.0); return 1; } if(CDLLOADFT1 == 2) { if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER && IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) != 1 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 403 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 514 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 515) { SendClientMessage(playerid, COLOR_RED, "WARNING: {FFFFFF}You cannot complete the drop without the load."); DisablePlayerCheckpoint(playerid); CDLLOADFT1 = 0; return 1; } if(IsCDLVehicles(GetPlayerVehicleID(playerid))) { DisablePlayerCheckpoint(playerid); CDLLOADFT1 = 0; SendClientMessage(playerid, COLOR_GRAD1, "KACC Fuels: Thank you for delivering the fuel, here's your money!"); SendClientMessage(playerid, COLOR_GRAD2, "KACC Fuels: handed you a payslip of $10,000 danger money."); SendClientMessage(playerid, COLOR_GRAD2, "A certain amount has been deducted for the use of a company truck."); GivePlayerCash(playerid, 10000); PlayerInfo[playerid][pTruckSkill]++; return 1; } DisablePlayerCheckpoint(playerid); CDLLOADFT1 = 0; SendClientMessage(playerid, COLOR_GRAD1, "KACC Fuels: Thank you for delivering the fuel, here's your money!"); SendClientMessage(playerid, COLOR_GRAD2, "KACC Fuels: handed you a payslip of $10,000 + $5,000 danger money."); GivePlayerCash(playerid, 15000); PlayerInfo[playerid][pTruckSkill]++; return 1; } if(CDLLOADCT1 == 1) { if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER && IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) != 1 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 403 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 514 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 515) { SendClientMessage(playerid, COLOR_RED, "WARNING: {FFFFFF}You cannot complete the drop without the load."); DisablePlayerCheckpoint(playerid); CDLLOADCT1 = 0; return 1; } DisablePlayerCheckpoint(playerid); CDLLOADCT1 = 2; SendClientMessage(playerid, COLOR_DBLUE, "Dock Staff: {FFFFFF}Please deliver these parts to LV Quarry!"); SetPlayerCheckpoint(playerid, 789.0222,838.3677,5.9615, 3.0); return 1; } if(CDLLOADCT1 == 2) { if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER && IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) != 1 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 403 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 514 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 515) { SendClientMessage(playerid, COLOR_RED, "WARNING: {FFFFFF}You cannot complete the drop without the load."); DisablePlayerCheckpoint(playerid); CDLLOADCT1 = 0; return 1; } if(IsCDLVehicles(GetPlayerVehicleID(playerid))) { DisablePlayerCheckpoint(playerid); CDLLOADCT1 = 0; SendClientMessage(playerid, COLOR_GRAD1, "LV Quarry: Thank you for delivering the coal, here's your money!"); SendClientMessage(playerid, COLOR_GRAD2, "LV Quarry: handed you a payslip of $2,500."); SendClientMessage(playerid, COLOR_GRAD2, "A certain amount has been deducted for the use of a company truck."); GivePlayerCash(playerid, 2500); PlayerInfo[playerid][pTruckSkill]++; return 1; } DisablePlayerCheckpoint(playerid); CDLLOADCT1 = 0; SendClientMessage(playerid, COLOR_GRAD1, "LV Quarry: Thank you for delivering the coal, here's your money!"); SendClientMessage(playerid, COLOR_GRAD2, "LV Quarry: handed you a payslip of $5,000."); GivePlayerCash(playerid, 5000); PlayerInfo[playerid][pTruckSkill]++; return 1; }