A small mess OnPlayerEnterCP
#1

So the problem is that when im driving a trucker car and i enter a checkpoint the trucking car gets removed and i get a message and cash like i would be dropcaring. How may i fix that ?

I think that all my enterings on chekpoints will make the car respawn if i will be in one and i will get dropcar cash.

PHP код:
CMD:dropcar(playerid, params[])
{
    new 
vehicleid = GetPlayerVehicleID(playerid);
    if(
g_var[playerid] == 1) return SendClientMessage(playerid,COLOR_GREY,"**You need to wait 20 minutes to use this command again.");
    if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "**You need to login first before using any command.");
    if(!
vehicleid) return SendClientMessage(playerid, COLOR_GREY, "**You must be inside a vehicle to use this command.");
    if(
GetPlayerVehicleID(playerid) != 0)
    {
        
DisablePlayerCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid, 2505.8506, -2629.0144, 13.2944, 5);
        
SendClientMessage(playerid, COLOR_LIGHTBLUE, "*Deliver car to the Los Santos Docks!(Checkpoint)");
    }
    return 
1;
} 
PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(
g_var[playerid] == 0)
    {
            
DisablePlayerCheckpoint(playerid);
            new 
vehicleid = GetPlayerVehicleID(playerid);
            new 
string[128], playerb, amount;
            
amount = random (100);
            
format(string, sizeof(string), "*You've earned {FF6347}$%d{33CCFF} from dropping a car!", amount);
            
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            
GiveDodMoney(playerb, amount);
            
SetVehicleToRespawn(vehicleid);
            
g_var[playerid] = 1;
            
SetTimerEx("CountDown",120*1000, false, "d", playerid);
        } 
PHP код:
CMD:loadpackages(playerid, params[])
{
    new 
string[128], packages;
    
// L1: 0 | L2: 100 | L3: 300 | L4: 700 | L5: 1200
    
if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 100) packages = 5;
    else if(
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 300) packages = 10;
    else if(
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 700) packages = 15;
    else if(
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 1200) packages = 20;
    else if(
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] >= 1200) packages = 25;
       if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
       if(
PlayerInfo[playerid][pJob] != JOB_TRUCKER && PlayerInfo[playerid][pVIPJob] != JOB_TRUCKER) return SendClientMessage(playerid, COLOR_GREY, "You are not a Trucker.");
       if(
PlayerInfo[playerid][pTPackages] == 1) return SendClientMessage(playerid, COLOR_GREY, "You already have overloaded packages.");
    if(!
IsPlayerInAnyVehicle(playerid) || !IsTruckerVehicle(GetPlayerVehicleID(playerid))) return SendClientMessage(playerid, COLOR_GREY, "You are not in a Trucker vehicle or you have no trailer attached.");
       if(!
IsPlayerInRangeOfPoint(playerid, 5, -480.1533,-539.1694,25.5296)) return SendClientMessage(playerid, COLOR_GREY, "You are not near a packages pickup.");
       if(
PlayerInfo[playerid][pMoney] < packages*5) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money on you.");
    
PlayerInfo[playerid][pTPackages] ++;
    
PlayerInfo[playerid][pDeliverTruck] = GetPlayerVehicleID(playerid);
    
TruckPackages[GetPlayerVehicleID(playerid)] = playerid;
    
format(string, sizeof(string), "* %s has loaded %d products packages from the pickup.", RPN(playerid), packages);
    
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
    
format(string, sizeof(string), "* You have loaded {FF6347}%d products{33CCFF} packages for {FF6347}$%d{33CCFF}, deliver them to the dropoff. (Checkpoint)", packages, packages*5);
    
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    
SetPlayerCheckpoint(playerid, 2222.5107,-2682.7368,13.5409, 2);
    return 
1;
}
forward PackTimer(playerid);
public 
PackTimer(playerid)
{
    if(
IsPlayerLoggedIn(playerid))
    {
        
PackTime[playerid]--;
        if(
PackTime[playerid] > 0)
        {
            
SetTimerEx("PackTimer", 1000, false, "i", playerid);
        }
    }
    return 
1;
}
CMD:deliverpackages(playerid, params[])
{
    new 
string[128], packages, oldj, newj, price;
    
// L1: 0 | L2: 100 | L3: 300 | L4: 700 | L5: 1200
    
if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 100) packages = 5;
    else if(
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 300) packages = 10;
    else if(
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 700) packages = 15;
    else if(
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 1200) packages = 20;
    else if(
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] >= 1200) packages = 25;
       if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
       if(
PlayerInfo[playerid][pJob] != JOB_TRUCKER && PlayerInfo[playerid][pVIPJob] != JOB_TRUCKER) return SendClientMessage(playerid, COLOR_GREY, "You are not a Trucker.");
       if(!
PlayerInfo[playerid][pTPackages]) return SendClientMessage(playerid, COLOR_GREY, "You have no packages on you.");
       if(
PlayerInfo[playerid][pDeliverTruck] != GetPlayerVehicleID(playerid)) return SendClientMessage(playerid, COLOR_GREY, "This is not the vehicle that your packages were loaded to.");
       if(!
IsPlayerInRangeOfPoint(playerid, 5, 2222.5107,-2682.7368,13.5409)) return SendClientMessage(playerid, COLOR_GREY, "You are not near a packages dropoff.");
    if(
Products >= 10000) return SendClientMessage(playerid, COLOR_GREY, "The dropoff can't hold anymore products at the moment.");
    
oldj = strval(RPJL(playerid,JOB_TRUCKER));
    
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] ++;
    if(
DayRespect == 1)
    {
      
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] ++;
    }
    
Products += packages;
    if(
Products > 10000) Products = 10000;
    
newj = strval(RPJL(playerid,JOB_TRUCKER));
    if(
PlayerInfo[playerid][pTPackages] == 1) {price = packages*12;}
    else if(
PlayerInfo[playerid][pTPackages] == 2) {price = packages*14;}
    
GiveDodMoney(playerid, price);
    
PlayerInfo[playerid][pDeliverTruck] = -1;
    
TruckPackages[GetPlayerVehicleID(playerid)] = -1;
    
format(string, sizeof(string), "* %s has delivered %d products packages to the dropoff.", RPN(playerid), PlayerInfo[playerid][pTPackages]*5);
    
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
    
format(string, sizeof(string), "* You have delivered {FF6347}%d product{33CCFF} packages for {FF6347}$%d{33CCFF}", PlayerInfo[playerid][pTPackages]*5, price);
    
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    if(
oldj < newj)
    {
        
format(string, sizeof(string), "** Your Trucker level is now %d, you can now carry %d packages. **", newj, newj*5);
        
SendClientMessage(playerid, COLOR_YELLOW, string);
    }
    
format(string, sizeof(string), "Packages Dropoff\n{FFFF00}/deliverpackages to deliver crates\nAvailable Products: %d/10000", Products);
    
UpdateDynamic3DTextLabelText(ProductsText, COLOR_RED, string);
    
PlayerInfo[playerid][pTPackages] = 0;
    return 
1;
} 
Reply
#2

Plss somone give me a fix to this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)