Why won't this work.
#1

Basicly i want it so that when a player enters a checkpoint, it checks to see if he is in a vehicle. If no delete checkpoint. If player is in vehicle check vehicle id. if vehicle if == taxi (420) display the test text message (see code). If vehicleid == truck (515), check trailer etc. The trailer works but when i enter checkpoint in taxi it is saying no trailer which is for trucks only. Hopefully you can see what i mean from code below.

Код:
public OnPlayerEnterCheckpoint(playerid)
{
	new vehicleid = GetPlayerVehicleID(playerid);
	if (vehicleid == 420){
	  GameTextForPlayer(playerid, "~r~test. ~w~~n~Noob", 2000, 3);
	    }
	    else {
	if (IsPlayerInVehicle(playerid,vehicleid))
	if (IsTrailerAttachedToVehicle(vehicleid))
 	{
		GameTextForPlayer(playerid, "~r~Congratulations! ~n~Successfully Completed! ~n~~g~$5,000", 5000, 3);
		GivePlayerMoney(playerid, 5000);
		DisablePlayerCheckpoint(playerid);
		SetVehicleToRespawn(vehicleid);
	}
	else
	{
		GameTextForPlayer(playerid, "~r~You need a trailer. ~w~~n~Noob", 2000, 3);
	}
	else
	{
		DisablePlayerCheckpoint(playerid);
	}}}
Thanks in advance,
Josh
Reply
#2

Do you have a working server, not script. Server, I can test it on.
Reply
#3

I gave you my game mode yesterday, but i don't have a server running online if thats what you mean.

Thanks,
Josh
Reply
#4

I think you're confused with GetPlayerVehicleID to GetVehicleModel, are you attempting to send this message while the player is in vehicle id 420, or model id 420?
Reply
#5

ok i didn't know they were different. I want it so that when the player is in the taxi (id==420) and they enter the checkpoint it sends the test message.

Thanks,
Josh
Reply
#6

Quote:
Originally Posted by Bofhead
I gave you my game mode yesterday, but i don't have a server running online if thats what you mean.

Thanks,
Josh
Alright, I really don't think there is a code to check if they have a trailer. Also, let me get this straight. This is what you want to acheive? If the person enter the checkpoint in a cab (420) GameTextForPlayer(blah blah blah) will appear. If it's a truck with a trailer, depspawn the truck & trailer.. ?
Reply
#7

ok i want it the same as yesterday with the truck except i am trying to code taxi missions, so i want the taxi to be different from the truck so when in truck do the truck thing from yesterday. When in taxi display a completly different message from truck.

I hope i am being clear enough.

Thanks,
Josh
Reply
#8

Alright, I'm testing to see if this thing I got works.
Reply
#9

Thankyou so much you've been really helpfull and you explain things well so even a beginner like me can understand.
Reply
#10

Done. I just made the basically exact same thing, using 'else if' instead of 'if' or just make sure they're closed.
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if (GetVehicleModel(vehicleid) == 515)
    if (IsTrailerAttachedToVehicle(vehicleid))
    {
        GameTextForPlayer(playerid, "~r~Congratulations! ~n~Successfully Completed! ~n~~g~$5,000", 2000, 3);
        GivePlayerMoney(playerid, 5000);
        DisablePlayerCheckpoint(playerid);
        SetVehicleToRespawn(vehicleid);
        SetVehicleToRespawn(Trailer[0]);
        SetVehicleToRespawn(Trailer[1]);
    }
    else
    {
        GameTextForPlayer(playerid, "~r~You need a trailer. ~w~~n~Noob", 2000, 3);
    }
    else
    {
        DisablePlayerCheckpoint(playerid);
    }

    if (GetVehicleModel(vehicleid) == 420)
    {
        GameTextForPlayer(playerid, "~r~Congratulations! ~n~Successfully Completed! ~n~~g~$5,000~", 2000, 3);
        GivePlayerMoney(playerid, 5000);
        DisablePlayerCheckpoint(playerid);
        SetVehicleToRespawn(vehicleid);
    }
     else
    {
        GameTextForPlayer(playerid, "You are not in the right~n~~y~vehicle", 2000, 3);
    }
    else
    {
        DisablePlayerCheckpoint(playerid);
    }
    return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if (GetVehicleModel(vehicleid) == 515)
    {
        new rand = random(sizeof(checkpoints));
        SetPlayerCheckpoint(playerid,checkpoints[rand][0],checkpoints[rand][1],checkpoints[rand][2],checkpoints[rand][3]);
    }
   
    else if (GetVehicleModel(vehicleid) == 420)
    {
        new rand = random(sizeof(checkpoints));
        SetPlayerCheckpoint(playerid,checkpoints[rand][0],checkpoints[rand][1],checkpoints[rand][2],checkpoints[rand][3]);
    }
    return 1;
}


public OnPlayerExitVehicle(playerid, vehicleid)
{
  if (GetVehicleModel(vehicleid) == 515)
  {
  DisablePlayerCheckpoint(playerid);
  }
  else if (GetVehicleModel(vehicleid) == 420)
  {
  DisablePlayerCheckpoint(playerid);
  }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: