Problem about checkpoint
#1

Hello, iam having a problem with a checkpoint.. Here's my explanation .. I type /harvest then the first checkpoint appear after i go to that checkpoint it disappears then the second checkpoint do not appear.. What should i do? Here's the code..

Code:
#include <a_samp>

#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA

new HarvestJob[256];

public OnFilterScriptInit()
{
    AddStaticVehicle(532,-488.9691,-1454.4095,13.6985,176.1319,0,0); // Harvest
}
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/harvest", cmdtext, true, 10) == 0)
	{
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
      	{
      	    HarvestJob[playerid] = 1;
            SendClientMessage(playerid,COLOR_RED,"You're now a harvester!");
            SetPlayerCheckpoint(playerid,-484.5330,-1480.2612,13.9457,10);
			SendClientMessage(playerid,COLOR_YELLOW,"* Follow the red markers and you'll recieve money!");
			return 1;
	    }
		SendClientMessage(playerid, COLOR_RED,"You have to be in a courier truck to start the job");
	}
	return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
     {
         SendClientMessage(playerid, COLOR_RED, "* You can start the harvester job by using /harvest");
     }
     return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
     {
        if(HarvestJob[playerid] == 1){
        	HarvestJob[playerid] = 2;
        	DisablePlayerCheckpoint(playerid);
        	SetPlayerCheckpoint(playerid,-488.9691,-1454.4095,13.6985,10);
        	SendClientMessage(playerid,COLOR_YELLOW,"* Please go to the next mark, and you'll be payed!");
        	return 1;
         }
		if(HarvestJob[playerid] == 2){
         	HarvestJob[playerid] = 3;
         	DisablePlayerCheckpoint(playerid);
	     	SetPlayerCheckpoint(playerid,-491.1559,-1590.0781,6.0986,10);
	     	return 1;
         }
  		if(HarvestJob[playerid] == 3){
         	HarvestJob[playerid] = 4;
         	DisablePlayerCheckpoint(playerid);
	     	SetPlayerCheckpoint(playerid,-517.1489,-1494.8715,10.6554,10);
	     	return 1;
         }
       	if(HarvestJob[playerid] == 4){
         	HarvestJob[playerid] = 5;
         	DisablePlayerCheckpoint(playerid);
	     	SetPlayerCheckpoint(playerid,-537.1957,-1495.2427,9.5398,10);
	     	return 1;
         }
       	if(HarvestJob[playerid] == 5){
         	HarvestJob[playerid] = 6;
         	DisablePlayerCheckpoint(playerid);
	     	SetPlayerCheckpoint(playerid,-538.4468,-1594.6807,7.9598,10);
	     	return 1;
         }
       	if(HarvestJob[playerid] == 6){
         	HarvestJob[playerid] = 7;
         	DisablePlayerCheckpoint(playerid);
	     	SetPlayerCheckpoint(playerid,-562.2611,-1505.3055,8.7389,10);
	     	return 1;
         }
       	if(HarvestJob[playerid] == 7){
         	HarvestJob[playerid] = 0;
	     	DisablePlayerCheckpoint(playerid);
	     	SendClientMessage(playerid,COLOR_YELLOW,"* You have recieved $750 for your work!");
	     	GivePlayerMoney(playerid,750);
         }
     }
     return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
	if(HarvestJob[playerid] > 0)
	{
	    SendClientMessage(playerid, COLOR_RED, "* You have left your job, you won't be payed.");
	    DisablePlayerCheckpoint(playerid);
	    HarvestJob[playerid] = 0;
	}
}
Reply
#2

I don't see any errors. I think it should work fine.
Don't you showing more than one checkpoint in one moment?
Reply
#3

No that one only. Iam using Horizon RP Gamemode.. Is there any way to show the checkpoint without using that code?
Reply
#4

So problem should be in that gamemode I think.
You can try race checkpoints instead of normal checkpoints.
Reply
#5

What is the code of race checkpoint ?
Reply
#6

It's pretty similar, read about it here: https://sampwiki.blast.hk/wiki/SetPlayerRaceCheckpoint
Reply
#7

Hello, the problem with the checkpoints is done thanks professional programmer.. But now i have a problem.. My server is server side and everytime the harvest job give me money it gone. I mean for example i have $0 then i finished the harvest job it must pay me $750 but after paying me my money is going back to $0 can you help me ?

Here's the code

Code:
	if(HarvestJob[playerid] == 4){
         	HarvestJob[playerid] = 0;
	     	DisablePlayerRaceCheckpoint(playerid);
	     	SendClientMessage(playerid,COLOR_YELLOW,"* You have recieved $750 for your work!");
	     	GivePlayerMoney(playerid,750);
My server code for money is ,, GivePlayerCash but if i put it here there will be a warning

Code:
C:\Users\Windows7\Desktop\Microsoft Corporation ©\PRP\filterscripts\harvestjob.pwn(65) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#8

Any answers ?
Reply
#9

1.Can you post the function GivePlayerCash?
2.Is this a Filterscript?
Reply
#10

Quote:
Originally Posted by Aly
View Post
1.Can you post the function GivePlayerCash?
https://sampwiki.blast.hk/wiki/Function:GivePlayerMoney

Quote:
Originally Posted by Aly
View Post
2.Is this a filterscript?
He uses OnFilterScriptInit, and it's located in the filterscripts folder:
Quote:

PRP\filterscripts\harvestjob.pwn

Can you show the code around it, because that small code you posted looks fine.
Reply
#11

here

Code:
#include <a_samp>

#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA

new HarvestJob[256];

public OnFilterScriptInit()
{
    AddStaticVehicle(532,-488.9691,-1454.4095,13.6985,176.1319,0,0); // Harvest
}
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/harvest", cmdtext, true, 10) == 0)
	{
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
      	{
      	    HarvestJob[playerid] = 1;
            SendClientMessage(playerid,COLOR_RED,"You're now a harvester!");
            SetPlayerCheckpoint(playerid,-484.5330,-1480.2612,13.9457,10);
			SendClientMessage(playerid,COLOR_YELLOW,"* Follow the red markers and you'll recieve money!");
			return 1;
	    }
		SendClientMessage(playerid, COLOR_RED,"You have to be in a courier truck to start the job");
	}
	return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
     {
         SendClientMessage(playerid, COLOR_RED, "* You can start the harvester job by using /harvest");
     }
     return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
     {
        if(HarvestJob[playerid] == 1){
        	HarvestJob[playerid] = 2;
        	DisablePlayerCheckpoint(playerid);
        	SetPlayerCheckpoint(playerid,-488.9691,-1454.4095,13.6985,10);
        	SendClientMessage(playerid,COLOR_YELLOW,"* Please go to the next mark, and you'll be payed!");
        	return 1;
         }
		if(HarvestJob[playerid] == 2){
         	HarvestJob[playerid] = 3;
         	DisablePlayerCheckpoint(playerid);
	     	SetPlayerCheckpoint(playerid,-491.1559,-1590.0781,6.0986,10);
	     	return 1;
         }
  		if(HarvestJob[playerid] == 3){
         	HarvestJob[playerid] = 4;
         	DisablePlayerCheckpoint(playerid);
	     	SetPlayerCheckpoint(playerid,-517.1489,-1494.8715,10.6554,10);
	     	return 1;
         }
       	if(HarvestJob[playerid] == 4){
         	HarvestJob[playerid] = 5;
         	DisablePlayerCheckpoint(playerid);
	     	SetPlayerCheckpoint(playerid,-537.1957,-1495.2427,9.5398,10);
	     	return 1;
         }
       	if(HarvestJob[playerid] == 5){
         	HarvestJob[playerid] = 6;
         	DisablePlayerCheckpoint(playerid);
	     	SetPlayerCheckpoint(playerid,-538.4468,-1594.6807,7.9598,10);
	     	return 1;
         }
       	if(HarvestJob[playerid] == 6){
         	HarvestJob[playerid] = 7;
         	DisablePlayerCheckpoint(playerid);
	     	SetPlayerCheckpoint(playerid,-562.2611,-1505.3055,8.7389,10);
	     	return 1;
         }
       	if(HarvestJob[playerid] == 7){
         	HarvestJob[playerid] = 0;
	     	DisablePlayerCheckpoint(playerid);
	     	SendClientMessage(playerid,COLOR_YELLOW,"* You have recieved $750 for your work!");
	     	GivePlayerMoney(playerid,750);
         }
     }
     return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
	if(HarvestJob[playerid] > 0)
	{
	    SendClientMessage(playerid, COLOR_RED, "* You have left your job, you won't be payed.");
	    DisablePlayerCheckpoint(playerid);
	    HarvestJob[playerid] = 0;
	}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)