Creating checkpoint but doesnt detect player near it?
#1

Hi guys,
So im creating a checkpoint for a player and it appears and everything but when i enter it nothing happens. I have even put a SendClientMessage() on the if(PlayerToPoint()) to see if it detects the player nearby but nothing happens. Heres the script:

PHP код:
if(PlayerInfo[playerid][pOrigin] == 1)
            {
                
CreateCheckpoint(playerid,CivilianCheckPoint[Xcp1],CivilianCheckPoint[Ycp1],CivilianCheckPoint[Zcp1],3.0); //
            
}
            if(
PlayerInfo[playerid][pOrigin] == 2)
            {
                
CreateCheckpoint(playerid,CivilianCheckPoint[Xcp2],CivilianCheckPoint[Ycp2],CivilianCheckPoint[Zcp2],3.0); //
            
}
            if(
PlayerInfo[playerid][pOrigin] == 3)
            {
                
CreateCheckpoint(playerid,CivilianCheckPoint[Xcp3],CivilianCheckPoint[Ycp3],CivilianCheckPoint[Zcp3],3.0); //
            
}
            if(
PlayerInfo[playerid][pOrigin] == 4)
            {
                
CreateCheckpoint(playerid,CivilianCheckPoint[Xcp4],CivilianCheckPoint[Ycp4],CivilianCheckPoint[Zcp4],3.0); //
            
}
            if(
PlayerInfo[playerid][pOrigin] == 5)
            {
                
CreateCheckpoint(playerid,CivilianCheckPoint[Xcp5],CivilianCheckPoint[Ycp5],CivilianCheckPoint[Zcp5],3.0); //
            
}
            if(
PlayerInfo[playerid][pOrigin] == 6)
            {
                
CreateCheckpoint(playerid,CivilianCheckPoint[Xcp6],CivilianCheckPoint[Ycp6],CivilianCheckPoint[Zcp6],3.0); //
            




PHP код:
public:OnPlayerEnterCheckpoint(playerid)
{
if(
PlayerToPoint(4.0,playeridCivilianCheckPoint[Xcp1],CivilianCheckPoint[Ycp1],CivilianCheckPoint[Zcp1]))
    {
        
SendClientMessage(playeridCOLOR_RED"PARABENS"); // my attempt to see if the script works. It does not.
        
DisablePlayerCheckpoint(playerid);
        for(new 
0sizeof(Houses); h++)
        {
            if(
PlayerToPoint(8.0playeridHouses[h][EnterX], Houses[h][EnterY], Houses[h][EnterZ]) && Houses[h][Owned] == &&  Houses[h][Rentable] == 1)
            {
                
PlayerInfo[playerid][pHouseKey] = h;
                
GivePlayerEuros(playerid,-Houses[h][RentCost]);
                
PlayerInfo[playerid][pAluguer] = Houses[h][RentCost];
                
Houses[h][Money] = Houses[h][Money]+Houses[h][RentCost];
                
PlayerInfo[playerid][ptutfeito] = 1;
                
PlayerInfo[playerid][ptutcompleto] = 1;
                
PlayerInfo[playerid][pRegistered] = 3;
                
SetPlayerInterior(playerid,Houses[h][ExitInterior]);
                
SetPlayerPos(playerid,Houses[h][ExitX],Houses[h][ExitY],Houses[h][ExitZ]);
                
SetPlayerVirtualWorld(playerid,h);
                
SendClientMessage(playeridCOLOR_WHITE,"{1E90FF}[INFO]: {FFFFFF} Hotel arrendado com sucesso, o preco da renda serб descontado de paycheck em paycheck.");
                
OnPlayerDataSave(playerid);
                return 
1;
            }
        }
    }
    if(
PlayerToPoint(4.0,playeridCivilianCheckPoint[Xcp2],CivilianCheckPoint[Ycp2],CivilianCheckPoint[Zcp2]))
    {
        
DisablePlayerCheckpoint(playerid);
        for(new 
0sizeof(Houses); h++)
        {
            if(
PlayerToPoint(8.0playeridHouses[h][EnterX], Houses[h][EnterY], Houses[h][EnterZ]) && Houses[h][Owned] == &&  Houses[h][Rentable] == 1)
            {
                
PlayerInfo[playerid][pHouseKey] = h;
                
GivePlayerEuros(playerid,-Houses[h][RentCost]);
                
PlayerInfo[playerid][pAluguer] = Houses[h][RentCost];
                
Houses[h][Money] = Houses[h][Money]+Houses[h][RentCost];
                
PlayerInfo[playerid][ptutfeito] = 1;
                
PlayerInfo[playerid][ptutcompleto] = 1;
                
PlayerInfo[playerid][pRegistered] = 3;
                
SetPlayerInterior(playerid,Houses[h][ExitInterior]);
                
SetPlayerPos(playerid,Houses[h][ExitX],Houses[h][ExitY],Houses[h][ExitZ]);
                
SetPlayerVirtualWorld(playerid,h);
                
SendClientMessage(playeridCOLOR_WHITE,"{1E90FF}[INFO]: {FFFFFF} Hotel arrendado com sucesso, o preco da renda serб descontado de paycheck em paycheck.");
                
OnPlayerDataSave(playerid);
                return 
1;
            }
        }
    }
    if(
PlayerToPoint(4.0,playeridCivilianCheckPoint[Xcp3],CivilianCheckPoint[Ycp3],CivilianCheckPoint[Zcp3]))
    {
        
DisablePlayerCheckpoint(playerid);
        for(new 
0sizeof(Houses); h++)
        {
            if(
PlayerToPoint(8.0playeridHouses[h][EnterX], Houses[h][EnterY], Houses[h][EnterZ]) && Houses[h][Owned] == &&  Houses[h][Rentable] == 1)
            {
                
PlayerInfo[playerid][pHouseKey] = h;
                
GivePlayerEuros(playerid,-Houses[h][RentCost]);
                
PlayerInfo[playerid][pAluguer] = Houses[h][RentCost];
                
Houses[h][Money] = Houses[h][Money]+Houses[h][RentCost];
                
PlayerInfo[playerid][ptutfeito] = 1;
                
PlayerInfo[playerid][ptutcompleto] = 1;
                
PlayerInfo[playerid][pRegistered] = 3;
                
SetPlayerInterior(playerid,Houses[h][ExitInterior]);
                
SetPlayerPos(playerid,Houses[h][ExitX],Houses[h][ExitY],Houses[h][ExitZ]);
                
SetPlayerVirtualWorld(playerid,h);
                
SendClientMessage(playeridCOLOR_WHITE,"{1E90FF}[INFO]: {FFFFFF} Hotel arrendado com sucesso, o preco da renda serб descontado de paycheck em paycheck.");
                
OnPlayerDataSave(playerid);
                return 
1;
            }
        }
    }
    if(
PlayerToPoint(4.0,playeridCivilianCheckPoint[Xcp4],CivilianCheckPoint[Ycp4],CivilianCheckPoint[Zcp4]))
    {
        
DisablePlayerCheckpoint(playerid);
        for(new 
0sizeof(Houses); h++)
        {
            if(
PlayerToPoint(8.0playeridHouses[h][EnterX], Houses[h][EnterY], Houses[h][EnterZ]) && Houses[h][Owned] == &&  Houses[h][Rentable] == 1)
            {
                
PlayerInfo[playerid][pHouseKey] = h;
                
GivePlayerEuros(playerid,-Houses[h][RentCost]);
                
PlayerInfo[playerid][pAluguer] = Houses[h][RentCost];
                
Houses[h][Money] = Houses[h][Money]+Houses[h][RentCost];
                
PlayerInfo[playerid][ptutfeito] = 1;
                
PlayerInfo[playerid][ptutcompleto] = 1;
                
PlayerInfo[playerid][pRegistered] = 3;
                
SetPlayerInterior(playerid,Houses[h][ExitInterior]);
                
SetPlayerPos(playerid,Houses[h][ExitX],Houses[h][ExitY],Houses[h][ExitZ]);
                
SetPlayerVirtualWorld(playerid,h);
                
SendClientMessage(playeridCOLOR_WHITE,"{1E90FF}[INFO]: {FFFFFF} Hotel arrendado com sucesso, o preco da renda serб descontado de paycheck em paycheck.");
                
OnPlayerDataSave(playerid);
                return 
1;
            }
        }
    }
    if(
PlayerToPoint(4.0,playeridCivilianCheckPoint[Xcp5],CivilianCheckPoint[Ycp5],CivilianCheckPoint[Zcp5]))
    {
        
DisablePlayerCheckpoint(playerid);
        for(new 
0sizeof(Houses); h++)
        {
            if(
PlayerToPoint(8.0playeridHouses[h][EnterX], Houses[h][EnterY], Houses[h][EnterZ]) && Houses[h][Owned] == &&  Houses[h][Rentable] == 1)
            {
                
PlayerInfo[playerid][pHouseKey] = h;
                
GivePlayerEuros(playerid,-Houses[h][RentCost]);
                
PlayerInfo[playerid][pAluguer] = Houses[h][RentCost];
                
Houses[h][Money] = Houses[h][Money]+Houses[h][RentCost];
                
PlayerInfo[playerid][ptutfeito] = 1;
                
PlayerInfo[playerid][ptutcompleto] = 1;
                
PlayerInfo[playerid][pRegistered] = 3;
                
SetPlayerInterior(playerid,Houses[h][ExitInterior]);
                
SetPlayerPos(playerid,Houses[h][ExitX],Houses[h][ExitY],Houses[h][ExitZ]);
                
SetPlayerVirtualWorld(playerid,h);
                
SendClientMessage(playeridCOLOR_WHITE,"{1E90FF}[INFO]: {FFFFFF} Hotel arrendado com sucesso, o preco da renda serб descontado de paycheck em paycheck.");
                
OnPlayerDataSave(playerid);
                return 
1;
            }
        }
    }
    if(
PlayerToPoint(4.0,playeridCivilianCheckPoint[Xcp6],CivilianCheckPoint[Ycp6],CivilianCheckPoint[Zcp6]))
    {
        
DisablePlayerCheckpoint(playerid);
        if(
PlayerInfo[playerid][pAulaMed] == 1)
        {
            
PlayerInfo[playerid][pCursMed] = 1;
            
PlayerInfo[playerid][ptutfeito] = 1;
            
PlayerInfo[playerid][ptutcompleto] = 1;
            
OnPlayerDataSave(playerid);
            
Timer6 SetTimerEx("iniciaraulamedtut"8false"d"playerid);
        }
        else if(
PlayerInfo[playerid][pAulaEng] == 1)
        {
            
PlayerInfo[playerid][pCursEng] = 1;
            
PlayerInfo[playerid][ptutfeito] = 1;
            
PlayerInfo[playerid][ptutcompleto] = 1;
            
OnPlayerDataSave(playerid);
            
Timer6 SetTimerEx("iniciaraulaengtut"8false"d"playerid);
        }
        else if(
PlayerInfo[playerid][pAulaPol] == 1)
        {
            
PlayerInfo[playerid][pCursPol] = 1;
            
PlayerInfo[playerid][ptutfeito] = 1;
            
PlayerInfo[playerid][ptutcompleto] = 1;
            
OnPlayerDataSave(playerid);
            
Timer6 SetTimerEx("iniciaraulapoltut"8false"d"playerid);
        }
        else if(
PlayerInfo[playerid][pAulaAgro] == 1)
        {
            
PlayerInfo[playerid][pCursAgro] = 1;
            
PlayerInfo[playerid][ptutfeito] = 1;
            
PlayerInfo[playerid][ptutcompleto] = 1;
            
OnPlayerDataSave(playerid);
            
Timer6 SetTimerEx("iniciaraulaagrotut"8false"d"playerid);
        }
    }
    if(
PlayerToPoint(4.0,playeridCivilianCheckPoint[Xcp7],CivilianCheckPoint[Ycp7],CivilianCheckPoint[Zcp7]))
    {
        
DisablePlayerCheckpoint(playerid);
        for(new 
0sizeof(Houses); h++)
        {
            if(
PlayerToPoint(8.0playeridHouses[h][EnterX], Houses[h][EnterY], Houses[h][EnterZ]) && Houses[h][Owned] == &&  Houses[h][Rentable] == 1)
            {
                
PlayerInfo[playerid][pHouseKey] = h;
                
GivePlayerEuros(playerid,-Houses[h][RentCost]);
                
PlayerInfo[playerid][pAluguer] = Houses[h][RentCost];
                
Houses[h][Money] = Houses[h][Money]+Houses[h][RentCost];
                
PlayerInfo[playerid][ptutfeito] = 1;
                
PlayerInfo[playerid][ptutcompleto] = 1;
                
PlayerInfo[playerid][pRegistered] = 3;
                
SetPlayerInterior(playerid,Houses[h][ExitInterior]);
                
SetPlayerPos(playerid,Houses[h][ExitX],Houses[h][ExitY],Houses[h][ExitZ]);
                
SetPlayerVirtualWorld(playerid,h);
                
SendClientMessage(playeridCOLOR_WHITE,"{1E90FF}[INFO]: {FFFFFF} Hotel arrendado com sucesso, o preco da renda serб descontado de paycheck em paycheck.");
                
OnPlayerDataSave(playerid);
                return 
1;
            }
        }
     }






Please help me. It doesnt even disable the checkpoint
Reply
#2

Try to use the native function:

PHP код:
if(IsPlayerInRangeOfPoint(playerid,4.0,CivilianCheckPoint[Xcp1],CivilianCheckPoint[Ycp1],CivilianCheckPoint[Zcp1])) 
https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
Reply
#3

if(arrival == 1) was missing a close bracket and i closed it now it crashes my pawno. This script is the first one in the OnPlayerEnterCheckpoint(). Any ideas why it crashes my pawno if i close the if(arrival == 1) thing? Cuz it might be messing with the other scripts





PHP код:
if(PlayerToPoint(5.0,playerid1022.8339,241.7309,33.0816))
    {
        if(
deliverprogress == 1)
        {
            if(
arrival == 1)
            {
                if(
GetPlayerEuros(playerid) >= precomats)
                {
                    new 
Float:x;
                    new 
Float:y;
                    new 
Float:z;
                    
GetObjectPos(caixaxyz);
                    
DestroyObject(caixa);
                    
novacaixa CreateObject(2919xy33.08160001000);
                    
SetTimerEx("novacaixas"20000false"i"playerid);
                    
MatsHolding[playerid] += matsquant;
                    
GivePlayerEuros(playerid, -precomats);
                    new 
pagarencomenda[128];
                    
format(pagarencomenda,sizeof(pagarencomenda), "{ADFF2F}[Vendedor]: {FFFFFF}Podes deixar o dinheiro na mala. Foi um prazer negociar!");
                    
SendClientMessage(playeridCOLOR_WHITEpagarencomenda);
                    new 
infopago[128];
                    
format(infopago,sizeof(infopago), "{ADFF2F}[INFO]: {FFFFFF}Pagaste %d$ por %d materiais. Nao te esqueзas que ainda os tens que entregar ao teu trabalhador!"precomatsmatsquant);
                    
SendClientMessage(playeridCOLOR_WHITEinfopago);
                    
DisablePlayerCheckpoint(playerid);
                    
arrival 0;
                    
deliverprogress 0;
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_WHITE"{ADFF2F}[Vendedor]: {FFFFFF}Mas estas maluco?! Este preco nao foi o que negociamos. Volta quando tiveres o dinheiro");
                return 
1;
                }
            }
        }
        else
        {
        return 
1;
        }
    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)