Disable the CP(Red markers around you)
#1

I would be thankful if someone could tell me how to disable all the checkpoints(Red markers) around me except one (Job checkpoint).Im new in scripting so i've got no idea how to do that.Thanks in advance.
Reply
#2

By the SA:MP limits, server never show more than 1 checkpoint per time. So, checkpoints have a STREAM value, when you get closer, it's appear for player.

Check your checkpoint stream value to appear only when player get closer in a range, as 3.0 or 10.0..

PHP код:
SetPlayerCheckpoint(playeridPOSITION 1POSITION 2POSITION 3SIZE); // ex.: (playerid, 3000.0, -200.0, -300.0, 5.0); 
You can use a STREAMER.
Reply
#3

Quote:
Originally Posted by rolex
Посмотреть сообщение
By the SA:MP limits, server never show more than 1 checkpoint per time. So, checkpoints have a STREAM value, when you get closer, it's appear for player.

Check your checkpoint stream value to appear only when player get closer in a range, as 3.0 or 10.0..

PHP код:
SetPlayerCheckpoint(playeridPOSITION 1POSITION 2POSITION 3RANGE); // ex.: (playerid, 3000.0, -200.0, -300.0, 5.0); 
You can use a STREAMER too.
Yeah i know that they appear one at the time once you get closer, but what im trying to say is it possible that once i enter the vehicle and start the job, every CP to disappear but only only one that we need to reach.Telling you this because once i enter the truck and start the job, other CP that appear near to me make the job CP disappear and end of the job is that CP who interrupted the work.
Reply
#4

You can't use streamed checkpoints and normal checkpoints simultaneously because the streamer will constantly check what checkpoint is closest to you.

I would advice creating a (dynamic) global map icon at the destination. Use icon 0 with a color of your choosing (yellow, red, blue) to emulate the mission markers used by the game. The checkpoint at the destination will show up as normal once the player gets close enough.
Reply
#5

You mean it, Vince?

https://sampwiki.blast.hk/wiki/SetPlayerMapIcon
Reply
#6

Well what about different type of checkpoint if its possible at all.
Racing checkpoint for example, is it same as regular one?
Reply
#7

Compare your self.

Normal:
https://sampwiki.blast.hk/wiki/SetPlayerCheckpoint

Race:
https://sampwiki.blast.hk/wiki/SetPlayerRaceCheckpoint
Reply
#8

Quote:
Originally Posted by rolex
Посмотреть сообщение
Quote:

if(PetrolJob[playerid] == 1){
PetrolJob[playerid] = 2;
SetPlayerCheckpoint(playerid,1342.4460,464.8088,19 .8828,277.6536);
return 1;
}
if(PetrolJob[playerid] == 2){
PetrolJob[playerid] = 3;
SetPlayerCheckpoint(playerid,1003.4263,-941.8485,41.8079,10);
return 1;
}
if(PetrolJob[playerid] == 3){
PetrolJob[playerid] = 1;
SetPlayerCheckpoint(playerid,-97.8173,-1166.7585,2.2650,10);
return 1;
}
return 1;
}

Is it possible to add race CP's ?
Reply
#9

Check your first coords, you have 4 coords and it will be 3.

Try that code:

PHP код:
    if(PetrolJob[playerid] == 1){
    
PetrolJob[playerid] = 2;
    return 
SetPlayerRaceCheckpoint(playerid,0,1342.4460464.808819.8828,1003.4263,-941.8485,41.8079,10);
    
    if(
PetrolJob[playerid] == 2){
    
PetrolJob[playerid] = 3;
    return 
SetPlayerRaceCheckpoint(playerid,0,1003.4263,-941.8485,41.8079,-97.8173,-1166.7585,2.2650,10);
    
    if(
PetrolJob[playerid] == 3){
    
PetrolJob[playerid] = 1;
    return 
SetPlayerRaceCheckpoint(playerid,1,-97.8173,-1166.7585,2.2650,0.0,0.0,0.0,10);}
    
    return 
1;

Reply
#10

Quote:
Originally Posted by rolex
Посмотреть сообщение
Check your first coords, you have 4 coords and it will be 3.

Try that code:

PHP код:
    if(PetrolJob[playerid] == 1){
    
PetrolJob[playerid] = 2;
    return 
SetPlayerRaceCheckpoint(playerid,0,1342.4460464.808819.8828,1003.4263,-941.8485,41.8079,10);
    
    if(
PetrolJob[playerid] == 2){
    
PetrolJob[playerid] = 3;
    return 
SetPlayerRaceCheckpoint(playerid,0,1003.4263,-941.8485,41.8079,-97.8173,-1166.7585,2.2650,10);
    
    if(
PetrolJob[playerid] == 3){
    
PetrolJob[playerid] = 1;
    return 
SetPlayerRaceCheckpoint(playerid,1,-97.8173,-1166.7585,2.2650,0.0,0.0,0.0,10);}
    
    return 
1;

Got some warnings and errors.Here's the full code.
Quote:

#include <a_samp>

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

new PetrolJob[256];

public OnFilterScriptInit()
{
AddStaticVehicle(403,2057.3081,-1939.9397,13.9432,270.4501,0,0); // Petrol Trucker (Spawn Front)
AddStaticVehicle(584,2045.2939,-1939.9041,13.0633,268.2366,0,0); // Petrol Trucker (Spawn Back)
AddStaticVehicle(403,2032.4635,-1939.7537,13.9389,271.0817,0,0); // Petrol Trucker (Spawn Front)
AddStaticVehicle(584,2020.9797,-1940.1196,13.9476,270.5276,0,0); // Petrol Trucker (Spawn Back)
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/petrol", cmdtext, true, 10) == 0)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 403)
{
if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID( playerid))){ SendClientMessage(playerid,COLOR_RED,"* You don't have a trailer attached to the vehicle!"); return 1; }
if(PetrolJob[playerid] != 1 && PetrolJob[playerid] != 2 && PetrolJob[playerid] != 3){ PetrolJob[playerid] = 1; }

new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "* %s is now a Petrol Trucker.", name );
SendClientMessageToAll(COLOR_YELLOW, string);

if(PetrolJob[playerid] == 1){
PetrolJob[playerid] = 2;
SetPlayerCheckpoint(playerid,1944.7424,-1771.1267,13.1157,10);
return 1;
}
if(PetrolJob[playerid] == 2){
PetrolJob[playerid] = 3;
SetPlayerCheckpoint(playerid,1003.4263,-941.8485,41.8079,10);
return 1;
}
if(PetrolJob[playerid] == 3){
PetrolJob[playerid] = 1;
SetPlayerCheckpoint(playerid,-97.8173,-1166.7585,2.2650,10);
return 1;
}
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)) == 403)
{
SendClientMessage(playerid, COLOR_RED, "* You can start the Petrol Trucking by typing /petrol");
}
return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 403)
{
if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID( playerid))){ SendClientMessage(playerid,COLOR_RED,"* You don't have a trailer attached to the vehicle!"); DisablePlayerCheckpoint(playerid); return 1; }
GivePlayerMoney(playerid,500);
SendClientMessage(playerid,COLOR_YELLOW,"* You have earned $500!");
DisablePlayerCheckpoint(playerid);
}
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(PetrolJob[playerid] > 0)
{
SendClientMessage(playerid, COLOR_RED, "* You have left your job, you won't be payed.");
DisablePlayerCheckpoint(playerid);
}
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)