Trucking Script help.
#1

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"
Код:
new CDLLOADAT1 = 0;
new CDLLOADFT1 = 0;
new CDLLOADCT1 = 0;
OnPlayerEnterCheckpoint:
Код:
	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;
	}
Reply
#2

You have done this work
Quote:

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;

It will be executed when player reaches the CP no checking of trailer. I have quoted just one part
And one more thing why you used !=, do you know it means "is not equal to". Thanks In Advance
Reply
#3

Quote:
Originally Posted by coool
Посмотреть сообщение
You have done this work

It will be executed when player reaches the CP no checking of trailer. I have quoted just one part
And one more thing why you used !=, do you know it means "is not equal to". Thanks In Advance
It doesnt work how i want it to, it doesnt execute just for the player. The whole server, and i understand the != because it's suppose to be that. It all works apart from only 1 player can take a drop at a time. Otherwise the numbers all play up and ect. I need a way for it to work with ALL players instead of just 1.

Basically what i want is for the CDLLOADFT or whatever to change ONLY for the player, instead of it changing it for everyone on the server. But everytime i try it i get 5 errors and some other stuff.

Thank you,
Reign.

Edit: I also tried to make it detect the trailer but it didnt work at all.
Reply
#4

Just use this under in "news"
Quote:

new CDLLOADAT1[MAX_PLAYERS] = 0;

And in "if" use like this:
Quote:

if(CDLLOADAT1[playerid] == 1)

Do you need explanation of this or not? Thanks In Advance +rep if you like my work
Reply
#5

Quote:
Originally Posted by coool
Посмотреть сообщение
Just use this under in "news"

And in "if" use like this:

Do you need explanation of this or not? Thanks In Advance +rep if you like my work
Код:
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(58251) : error 033: array must be indexed (variable "CDLLOADAT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(58255) : error 033: array must be indexed (variable "CDLLOADAT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(58266) : error 033: array must be indexed (variable "CDLLOADAT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(58272) : error 033: array must be indexed (variable "CDLLOADAT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(58281) : error 033: array must be indexed (variable "CDLLOADAT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(58294) : error 033: array must be indexed (variable "CDLLOADFT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(58298) : error 033: array must be indexed (variable "CDLLOADFT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(58309) : error 033: array must be indexed (variable "CDLLOADFT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(58315) : error 033: array must be indexed (variable "CDLLOADFT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(58324) : error 033: array must be indexed (variable "CDLLOADFT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(58337) : error 033: array must be indexed (variable "CDLLOADCT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(58341) : error 033: array must be indexed (variable "CDLLOADCT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(58352) : error 033: array must be indexed (variable "CDLLOADCT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(58358) : error 033: array must be indexed (variable "CDLLOADCT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(58367) : error 033: array must be indexed (variable "CDLLOADCT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(61206) : error 033: array must be indexed (variable "CDLLOADAT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(61215) : error 033: array must be indexed (variable "CDLLOADAT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(61229) : error 033: array must be indexed (variable "CDLLOADCT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(61238) : error 033: array must be indexed (variable "CDLLOADCT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(61252) : error 033: array must be indexed (variable "CDLLOADFT1")
C:\Users\Twat\Desktop\Real World Roleplay\gamemodes\RWRP.pwn(61261) : error 033: array must be indexed (variable "CDLLOADFT1")
Reply
#6

then index these variables with [playerid], or this will create a big problem??
I prefer using replace option if you think it will cause no harm
Reply
#7

Quote:
Originally Posted by coool
Посмотреть сообщение
then index these variables with [playerid], or this will create a big problem??
I prefer using replace option if you think it will cause no harm
Thanks man! I'll have to give this a proper try but i just compiled it with 0 errors!
Reply
#8

And one thing more don't use this on only CDLLOADAT1 but also on the others CDLLOADFT1 and CDLLOADCT1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)