Checkpoint entery
#1

Basically I a writeing a CNR script, and when I try to make a Player enter a checkpoint and "Teleport" him to a different Interior it does nothing.

Code:
Код:
#include <a_samp>
#include <sscanf2>
#include <YSI\y_ini>
#include <YSI\y_va>
#include <zcmd>
#include <foreach>
#include <Streamer>
#include <CheckpointManager>
Код:
#define PIZZA_CP 30 //Start robbing defines here, Guessing we got 50+ CPs
Код:
public OnGameModeInit()
{
CreateCheckpoint(GLOBAL_OWNER_ID, PIZZA_CP, 2105.488281, -1806.404418, 13.554687, 1.0);
        SetCheckpointInterior(PIZZA_CP, 0);
        //CreateDynamicCP(2105.488281, -1806.404418, 13.554687, 1.0, .interiorid = 0);
        StartCheckpointSeeking();
return 1;
}
Код:
forward OnCheckPointEnter(playerid, checkpointid); 
public OnCheckPointEnter(playerid, checkpointid)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
	{
    	switch(checkpointid)
		{
	  	  case PIZZA_CP:
	   	 {
	        SetPlayerInterior(playerid,5);
		    SetPlayerPos(playerid,372.1255,-131.4364,1001.4922);
		    SetPlayerFacingAngle(playerid,357.6505);
		    return 1;
		 }
		}
	}
	
	return 1;
}
I cut the only code needed here, please tell me what I have done wrong.

here is what I see:







it creates the checkpoint, but when I enter it does nothing.
Reply
#2

That's because SA-MP has it's own checkpoint function which is OnPlayerEnterCheckPoint,


https://sampwiki.blast.hk/wiki/OnPlayerEnterCheckpoint

Look at the streamer for the dynamic one.
Reply
#3

Streamer Already defined it as Streamer_OnPlayerEnterCheckpointCP or something..


Got anything else that I can use?
Reply
#4

What do you mean anything else to use?

If you're using the CreateCheckpoint (basic SA-MP one) use the OnPlayerEnterCheckPoint, if you're using DynamicCP code then use the streamer code. No need to make your own public as it won't work.
Reply
#5

Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
	
    if( pRobbingP[ playerid ] )
    {
            if ( checkpointid == cp_Pizza )
            {
                pRobbingP[ playerid ] = false;
                KillTimer( robTimerP[ playerid ] );
                pizzaRobbed = false;
                GameTextForPlayer( playerid, "~r~You have failed the robbery!", 1000, 3 );
                pInfo[playerid][wanted] += 2;
                SendClientMessage(playerid, COLOR_WHITE, "Wanted Increased");
            }
    }
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
	{
    	switch(checkpointid)
		{
	  	  case PIZZA_CP:
	   	 {
	        SetPlayerInterior(playerid,5);
		    SetPlayerPos(playerid,372.1255,-131.4364,1001.4922);
		    SetPlayerFacingAngle(playerid,357.6505);
		    return 1;
		 }
		}
	}
	
    return 1;
}

this is what I changed into, but still not working properly.
Reply
#6

Sorry for double post, Problem solved.


Used wrong stuff like an idiot. PM me if you got the same problem, i might be able to help out.



















~SOLVED~
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)