#1

Hello i try to make something like when you in a truck and trailer is attached to create a checkpoint but it isn't working
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new vID = GetPlayerVehicleID(playerid);
	if(newstate == PLAYER_STATE_DRIVER)
	{
		if(vID == 403 || 514 || 515)
		{
			if(IsTrailerAttachedToVehicle(vID))
			{
				new trailerid = GetVehicleTrailer(vID);
				new trailermodel = GetVehicleModel(trailerid);
				if(trailermodel == 435 || 450 || 584)
				{
					//new WorkCP = CreateDynamicCP(1588.8866,715.2956,10.8203,3.0,-1,-1,playerid,100.0);
					SetPlayerCheckpoint(playerid, 1588.8866,715.2956,10.8203, 3.0);
				}
			}
		}
	}
	else if(newstate == PLAYER_STATE_ONFOOT)
	{
		DisablePlayerCheckpoint(playerid);
	}
	return 1;
}
Any solution?
Reply
#2

Use: if(vID == 403 || vID == 514 || vID == 515) and if(trailermodel == 435 || trailermodel == 450 || trailermodel == 584)
Reply
#3

Remove
Код:
SetPlayerCheckpoint(playerid, 1588.8866,715.2956,10.8203, 3.0);
And change
Код:
DisablePlayerCheckpoint(playerid);
To
Код:
DestroyDynamicCP(checkpointid);
It will look like this
PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    new 
vID GetPlayerVehicleID(playerid);
    if(
newstate == PLAYER_STATE_DRIVER)
    {
        if(
vID == 403 || 514 || 515)
        {
            if(
IsTrailerAttachedToVehicle(vID))
            {
                new 
trailerid GetVehicleTrailer(vID);
                new 
trailermodel GetVehicleModel(trailerid);
                if(
trailermodel == 435 || 450 || 584)
                {
                    new 
WorkCP CreateDynamicCP(1588.8866,715.2956,10.8203,3.0,-1,-1,playerid,100.0);
                }
            }
        }
    }
    else if(
newstate == PLAYER_STATE_ONFOOT)
    {
        
DestroyDynamicCP(WorkCP);
    }
    return 
1;

Reply
#4

Neither work, i tried both but the checkpoint is not creating....Thanks for helping anyway....
Reply
#5

You are checking for the model here
if(vID == 403 || 514 || 515)

Not for individual vehicle ID's
Add in
new vModel = GetVehicleModel(vID);
and check
if(vModel == 403 || 514 || 515)
Reply
#6

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new vID = GetPlayerVehicleID(playerid);
	new vModel = GetVehicleModel(vID);
	if(newstate == PLAYER_STATE_DRIVER)
	{
		SCM(playerid, -1,"Ping");
		if(vModel == 403 || 514 || 515)
		{
			SCM(playerid, -1,"Match");
			if(IsTrailerAttachedToVehicle(vID))
			{
				SCM(playerid, -1,"Trailer");
				new trailerid = GetVehicleTrailer(vID);
				new trailermodel = GetVehicleModel(trailerid);
				if(trailermodel == 435 || 450 || 584)
				{
					//new WorkCP = CreateDynamicCP(1588.8866,715.2956,10.8203,3.0,-1,-1,playerid,100.0);
					SetPlayerCheckpoint(playerid, 1588.8866,715.2956,10.8203, 3.0);
					SCM(playerid, -1,"Pong");
				}
			}
		}
	}
	else if(newstate == PLAYER_STATE_ONFOOT)
	{
		DisablePlayerCheckpoint(playerid);
	}
	return 1;
}
I've made this , just something like deubuging, but from the IsTrailerAttachedToVehicle is not calling, i put in wrong callback?
Reply
#7

Its only going to be called if you get into a truck that already has a trailer attached.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)