Command not working
#1

I have this code:

pawn Код:
if (!IsPlayerInFlyingVehicle(GetPlayerVehicleID(playerid))) SendClientMessage(playerid, RED, "You need to be a in vehicle to use this command");
Ingame if i type the command it dosent do a thing,

pawn Код:
public IsPlayerInFlyingVehicle(vehicleid)
{
    if(GetVehicleModel(592 || 577 || 511 || 512 || 593 || 520 || 553 || 476 || 519 ||
    460 || 513 || 548 || 425 || 417 || 487 || 488 || 497 || 563 || 447 || 469)) return 1;
    return 0;
}
Reply
#2

this is the nos script i use:

Код:
new InvalidNosVehicles[30] =
{
  581,523,462,521,463,522,461,448,468,586,
  509,481,510,472,473,493,595,484,430,453,
  452,446,454,590,569,537,538,539,570,449
};
and

Код:
forward IsPlayerInInvalidNosVehicle(playerid);
public IsPlayerInInvalidNosVehicle(playerid)
{
  new carid = GetPlayerVehicleID(playerid);
  new carmodel = GetVehicleModel(carid);
  for (new i=0; i<sizeof(InvalidNosVehicles); i++) {
    if (carmodel == InvalidNosVehicles[i]) return 1;
  }
  return 0;
}
im guessing you can just modify that

ie change invalidnosvehicle to inflyingvehicle

change the ids in the new bit at the top

call back like so:

Код:
if(!IsPlayerInInvalidNosVehicle(playerid)) {
Reply
#3

You're not using your GetVehicleModel parameters right. The parameters goes like this:
vehicleid - The vehicle you want to get the model from. The correct coding will be this:

Код:
stock IsplayerInFlyingVehicle(vehicleid)
{
   if(GetVehicleModel(vehicleid) == 592 || GetVehicleModel(vehicleid) == 577 || // And you keep going on
}
Reply
#4

Untested. Hope this works.

Код:
new tmpcar = GetPlayerVehicleID(playerid)
if (!IsPlayerInFlyingVehicle(GetVehicleModel(tmpcar))) SendClientMessage(playerid, RED, "You need to be a in vehicle to use this command");
Код:
public IsPlayerInFlyingVehicle(vehicleid)
{
	if(vehicleid == 59 || vehicleid == 577 || vehicleid == 511 || vehicleid == 512 || vehicleid == 593 || vehicleid == 520 || vehicleid == 553 || vehicleid == 476 || vehicleid == 519 || vehicleid == 469 || vehicleid == 460 || vehicleid == 513 || vehicleid == 548 || vehicleid == 425 || vehicleid == 417 || vehicleid == 487 || vehicleid == 488 || vehicleid == 497 || vehicleid == 563 || vehicleid == 447)
	{
		return true;
	}
	return false;
}
However if that code is supposed to be in "public OnPlayerEnterVehicle(playerid,vehicleid,ispassenge r)" Then use the following code:

Код:
public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger)
{
  if (!IsPlayerInFlyingVehicle(GetVehicleModel(vehicleid))) SendClientMessage(playerid, RED, "You need to be a in vehicle to use this command");
  return true;
}
Reply
#5

anything there help torran?
Reply
#6

Ok fixed that, But now if i get in a plane,
Then type /messageme

And im in los santos,
Nothing happens!

pawn Код:
CMD:messageme(playerid, params[])
{
  if (!IsPlayerInFlyingVehicle(GetPlayerVehicleID(playerid))) SendClientMessage(playerid, RED, "You need to be a in vehicle to use this command");
    else {
      SendClientMessage(playerid, RED, "This bit works");
        if(IsPlayerInArea(playerid, 151.8124, -2977.858, 3012.892, 268.5911)) {
            new string[128];

            SendClientMessageToAll(WHITE, "Your in los santos");
        }
        else if(IsPlayerInArea(playerid, 840.807, 525.5044, 2942.825, 2954.502)) {
            new string[128];

            SendClientMessageToAll(WHITE, "Your in las venturas");
        }
        else if(IsPlayerInArea(playerid, -2954.502, -794.0955, -969.2637, 1588.191)) {
            new string[128];

            SendClientMessageToAll(WHITE, "Your in san fierro";
        }
    }
    return 1;
}
Reply
#7

why do you have the new strings?

i dont see the use of them

other than that i cant see a problem with the code although i have never used is player in area
Reply
#8

Cause i was going to use a string and i decided not to and i havent removed it,
But does anyone know why?
Reply
#9

Anyone?
Reply
#10

What? Did my post not help you?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)