[Solved]Whats wrong with my pilot chat?
#7

Found your bug, you had a return one inside of your for loop. /facepalm

Quote:
Originally Posted by [NWA
Hannes ]
pawn Код:
for (new i = 0; i < GetMaxPlayers(); i++)
  {
    //...
    return 1;
  }
  return 1;
}

I also changed a few things:
So I added a check for the player being in the right vehicle type.
There were also some very bad innificiencies which i took care of too. (No point recreating the same string, and calling the same functions repeatedly for all players)

pawn Код:
dcmd_p(playerid,params[])
{
  new vehicleid;
  if(strlen(params) == 0) return SendClientMessage(playerid, red, "Usage: /p (Text)");
  switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
  {
    case 417 ,425, 447, 592, 577, 511, 512,
    593, 520, 553, 476, 519, 460, 513, 548,
    487, 488, 497, 563, 469:{}
    default:SendClientMessage(playerid, red, "You must be in a pilot vehicle to use this command");
  }
  new string[128];
  new pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pName, sizeof(pName));
  format(string,sizeof(string),"Pilot Chat: %s: %s",pName, params);
  for (new i = 0; i < GetMaxPlayers(); i++)
  {
    if(!IsPlayerConnected(i) || !IsPlayerInAnyVehicle(i)) continue;
    vehicleid = GetPlayerVehicleID(i);
    switch(GetVehicleModel(vehicleid))
    {
      case 417 ,425, 447, 592, 577, 511, 512,
      593, 520, 553, 476, 519, 460, 513, 548,
      487, 488, 497, 563, 469:
        SendClientMessage(i, green, string);
    }
  }
  return 1;
}
Reply


Messages In This Thread
[Solved]Whats wrong with my pilot chat? - by bajskorv123 - 13.02.2010, 22:27
Re: Whats wrong with my pilot chat? - by Fedee! - 13.02.2010, 23:04
Re: Whats wrong with my pilot chat? - by bajskorv123 - 14.02.2010, 08:17
Re: Whats wrong with my pilot chat? - by VonLeeuwen - 14.02.2010, 08:22
Re: Whats wrong with my pilot chat? - by bajskorv123 - 14.02.2010, 10:24
Re: Whats wrong with my pilot chat? - by bajskorv123 - 15.02.2010, 05:47
Re: Whats wrong with my pilot chat? - by mansonh - 15.02.2010, 06:20
Re: Whats wrong with my pilot chat? - by bajskorv123 - 15.02.2010, 06:27
Re: [Solved]Whats wrong with my pilot chat? - by mansonh - 15.02.2010, 06:41
Re: [Solved]Whats wrong with my pilot chat? - by [gmR]BarMaN - 15.02.2010, 06:46

Forum Jump:


Users browsing this thread: 1 Guest(s)