15.02.2010, 06:20
Found your bug, you had a return one inside of your for loop. /facepalm
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)
Quote:
Originally Posted by [NWA
Hannes ]
pawn Код:
|
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;
}