SA-MP Forums Archive
Stay in CP after pos - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Stay in CP after pos (/showthread.php?tid=559537)



Stay in CP after pos - CrazyChoco - 23.01.2015

Hello,
Can I SetPlayerPos at exit checkpoint ?
I think I can't set the player pos at exit checkpoint while other gamemode can ..
I want something like when player enter entrance checkpoint then the player will spawn in the round of checkpoint. If i'm Set the player pos to exit checkpoint it will be go back to entrance checkpoint and loop each other.



pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == h[1])//Enter
    {
        SetPlayerPos(playerid, 238.727615, 138.634033, 1003.023437);
        SetPlayerFacingAngle(playerid, 0);
        SetPlayerInterior(playerid, 3);
    }

    if(checkpointid == h[2]) //Exit
    {
        SetPlayerPos(playerid, 2287.032958, 2432.367187, 10.820312);
        SetPlayerFacingAngle(playerid, 0);
        SetPlayerInterior(playerid, 0);
    }
    return 1;
}


public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
    if(checkpointid == h[1])//Enter
    {
       
    }

    if(checkpointid == h[2]) //Exit
    {
       
    }
    return 1;
}

See here what i mean.




Re: Stay in CP after pos - Matess - 23.01.2015

new enterCP[MAX_PLAYERS];

PHP код:
public OnPlayerEnterDynamicCP(playeridcheckpointid)
{
    if(!
enterCP[playerid])
    {
    if(
checkpointid == h[1])//Enter
    
{
        
SetPlayerPos(playerid238.727615138.6340331003.023437);
        
SetPlayerFacingAngle(playerid0);
        
SetPlayerInterior(playerid3);
        
enterCP[playerid] = true;
    }
    if(
checkpointid == h[2]) //Exit
    
{
        
SetPlayerPos(playerid2287.0329582432.36718710.820312);
        
SetPlayerFacingAngle(playerid0);
        
SetPlayerInterior(playerid0);
        
enterCP[playerid] = true;
    }
    }
    return 
1;
}
public 
OnPlayerLeaveDynamicCP(playeridcheckpointid)
{
    if(
checkpointid == h[1])//Enter
    
{
        
enterCP[playerid] = false;
    }
    if(
checkpointid == h[2]) //Exit
    
{
        
enterCP[playerid] = false;
    }
    return 
1;




Re: Stay in CP after pos - CrazyChoco - 23.01.2015

It sets me
In a lloop


Re: Stay in CP after pos - CrazyChoco - 25.01.2015

Help? I know it's possible, because I just saw it on the picture above?..


Re: Stay in CP after pos - ATGOggy - 25.01.2015

PHP код:
public OnPlayerEnterDynamicCP(playeridcheckpointid)
{
    if(
cpenterable[playerid])
    {
    
SetTimeEx("CPResetTimer"3000"i"playerid);
    
cpenterable[playerid]=false;
    if(
checkpointid == h[1])//Enter
    
{
        
SetPlayerPos(playerid238.727615138.6340331003.023437);
        
SetPlayerFacingAngle(playerid0);
        
SetPlayerInterior(playerid3);
    }
    if(
checkpointid == h[2]) //Exit
    
{
        
SetPlayerPos(playerid2287.0329582432.36718710.820312);
        
SetPlayerFacingAngle(playerid0);
        
SetPlayerInterior(playerid0);
    }
    }
    return 
1;
}
forward CPReset(playerid);
public 
CPReset(playerid)
{
    
cpenterable[playerid]=true;