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(playeridparams[])
{
    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(playeridCOLOR_GREY"**You need to login first before using any command.");
    if(!
vehicleid) return SendClientMessage(playeridCOLOR_GREY"**You must be inside a vehicle to use this command.");
    if(
GetPlayerVehicleID(playerid) != 0)
    {
        
DisablePlayerCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid2505.8506, -2629.014413.29445);
        
SendClientMessage(playeridCOLOR_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], playerbamount;
            
amount random (100);
            
format(stringsizeof(string), "*You've earned {FF6347}$%d{33CCFF} from dropping a car!"amount);
            
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
            
GiveDodMoney(playerbamount);
            
SetVehicleToRespawn(vehicleid);
            
g_var[playerid] = 1;
            
SetTimerEx("CountDown",120*1000false"d"playerid);
        } 
PHP код:
CMD:loadpackages(playeridparams[])
{
    new 
string[128], packages;
    
// L1: 0 | L2: 100 | L3: 300 | L4: 700 | L5: 1200
    
if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 100packages 5;
    else if(
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 300packages 10;
    else if(
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 700packages 15;
    else if(
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 1200packages 20;
    else if(
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] >= 1200packages 25;
       if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
       if(
PlayerInfo[playerid][pJob] != JOB_TRUCKER && PlayerInfo[playerid][pVIPJob] != JOB_TRUCKER) return SendClientMessage(playeridCOLOR_GREY"You are not a Trucker.");
       if(
PlayerInfo[playerid][pTPackages] == 1) return SendClientMessage(playeridCOLOR_GREY"You already have overloaded packages.");
    if(!
IsPlayerInAnyVehicle(playerid) || !IsTruckerVehicle(GetPlayerVehicleID(playerid))) return SendClientMessage(playeridCOLOR_GREY"You are not in a Trucker vehicle or you have no trailer attached.");
       if(!
IsPlayerInRangeOfPoint(playerid5, -480.1533,-539.1694,25.5296)) return SendClientMessage(playeridCOLOR_GREY"You are not near a packages pickup.");
       if(
PlayerInfo[playerid][pMoney] < packages*5) return SendClientMessage(playeridCOLOR_GREY"You don't have enough money on you.");
    
PlayerInfo[playerid][pTPackages] ++;
    
PlayerInfo[playerid][pDeliverTruck] = GetPlayerVehicleID(playerid);
    
TruckPackages[GetPlayerVehicleID(playerid)] = playerid;
    
format(stringsizeof(string), "* %s has loaded %d products packages from the pickup."RPN(playerid), packages);
    
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
    
format(stringsizeof(string), "* You have loaded {FF6347}%d products{33CCFF} packages for {FF6347}$%d{33CCFF}, deliver them to the dropoff. (Checkpoint)"packagespackages*5);
    
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
    
SetPlayerCheckpoint(playerid2222.5107,-2682.7368,13.54092);
    return 
1;
}
forward PackTimer(playerid);
public 
PackTimer(playerid)
{
    if(
IsPlayerLoggedIn(playerid))
    {
        
PackTime[playerid]--;
        if(
PackTime[playerid] > 0)
        {
            
SetTimerEx("PackTimer"1000false"i"playerid);
        }
    }
    return 
1;
}
CMD:deliverpackages(playeridparams[])
{
    new 
string[128], packagesoldjnewjprice;
    
// L1: 0 | L2: 100 | L3: 300 | L4: 700 | L5: 1200
    
if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 100packages 5;
    else if(
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 300packages 10;
    else if(
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 700packages 15;
    else if(
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 1200packages 20;
    else if(
PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] >= 1200packages 25;
       if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
       if(
PlayerInfo[playerid][pJob] != JOB_TRUCKER && PlayerInfo[playerid][pVIPJob] != JOB_TRUCKER) return SendClientMessage(playeridCOLOR_GREY"You are not a Trucker.");
       if(!
PlayerInfo[playerid][pTPackages]) return SendClientMessage(playeridCOLOR_GREY"You have no packages on you.");
       if(
PlayerInfo[playerid][pDeliverTruck] != GetPlayerVehicleID(playerid)) return SendClientMessage(playeridCOLOR_GREY"This is not the vehicle that your packages were loaded to.");
       if(!
IsPlayerInRangeOfPoint(playerid52222.5107,-2682.7368,13.5409)) return SendClientMessage(playeridCOLOR_GREY"You are not near a packages dropoff.");
    if(
Products >= 10000) return SendClientMessage(playeridCOLOR_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 10000Products 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(playeridprice);
    
PlayerInfo[playerid][pDeliverTruck] = -1;
    
TruckPackages[GetPlayerVehicleID(playerid)] = -1;
    
format(stringsizeof(string), "* %s has delivered %d products packages to the dropoff."RPN(playerid), PlayerInfo[playerid][pTPackages]*5);
    
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
    
format(stringsizeof(string), "* You have delivered {FF6347}%d product{33CCFF} packages for {FF6347}$%d{33CCFF}"PlayerInfo[playerid][pTPackages]*5price);
    
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
    if(
oldj newj)
    {
        
format(stringsizeof(string), "** Your Trucker level is now %d, you can now carry %d packages. **"newjnewj*5);
        
SendClientMessage(playeridCOLOR_YELLOWstring);
    }
    
format(stringsizeof(string), "Packages Dropoff\n{FFFF00}/deliverpackages to deliver crates\nAvailable Products: %d/10000"Products);
    
UpdateDynamic3DTextLabelText(ProductsTextCOLOR_REDstring);
    
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)