CMD:m(playerid,params[]) { new text[128],carid = GetPlayerVehicleID(playerid); for(new tt = 0; tt < sizeof police_vehicles; tt++) if(gTeam[playerid] == Police && carid == police_vehicles[tt]) { if(sscanf(params,"s[128]",text)) { SendClientMessage(playerid,white,"Usage: /m [text]"); return 1; } for(new i = 0; i < MAX_PLAYERS; i++) { new Float:tx,Float:ty,Float:tz; GetPlayerPos(i,tx,ty,tz); new Float: pdistance = GetPlayerDistanceFromPoint(i,tx,ty,tz); if(IsPlayerConnected(i)) if(pdistance < 8.0) { SendClientMessage(i, white, text); return 1; } } } else { SendClientMessage(playerid,white,"You must be on Police Duty and sit in Police Vehicle"); return 1; } return 1; }
CMD:m(playerid,params[]) { new text[128],carid = GetPlayerVehicleID(playerid); for(new tt = 0; tt < sizeof police_vehicles; tt++) if(gTeam[playerid] == Police && carid == police_vehicles[tt]) { if(sscanf(params,"s[128]",text)) { SendClientMessage(playerid,white,"Usage: /m [text]"); return 1; } for(new i = 0; i < MAX_PLAYERS; i++) { new Float:tx,Float:ty,Float:tz; GetPlayerPos(i,tx,ty,tz); new Float: pdistance = GetPlayerDistanceFromPoint(i,tx,ty,tz); if(IsPlayerConnected(i)) if(pdistance < 8.0) { SendClientMessage(i, white, text); } } } else { return SendClientMessage(playerid,white,"You must be on Police Duty and sit in Police Vehicle"); } return 1; }
CMD:m(playerid,params[])
{
new text[128], carid = GetPlayerVehicleID(playerid);
for(new tt = 0; tt < sizeof police_vehicles; tt++)
if(gTeam[playerid] == TEAM_POLICE && carid == police_vehicles[tt])
{
if(sscanf(params,"s[128]",text)) return SendClientMessage(playerid,white,"Usage: /m [text]");
foreach (new i : Player)
{
new Float:tx,Float:ty,Float:tz;
GetPlayerPos(i,tx,ty,tz);
new Float: pdistance = GetPlayerDistanceFromPoint(i,tx,ty,tz);
if(pdistance < 8.0) SendClientMessage(i, white, text);
}
}
else
{
return SendClientMessage(playerid,white,"You must be on Police Duty and sit in Police Vehicle");
}
return 1;
}
Код:
CMD:m(playerid,params[]) { new text[128],carid = GetPlayerVehicleID(playerid); for(new tt = 0; tt < sizeof police_vehicles; tt++) if(gTeam[playerid] == Police && carid == police_vehicles[tt]) { if(sscanf(params,"s[128]",text)) { SendClientMessage(playerid,white,"Usage: /m [text]"); return 1; } for(new i = 0; i < MAX_PLAYERS; i++) { new Float:tx,Float:ty,Float:tz; GetPlayerPos(i,tx,ty,tz); new Float: pdistance = GetPlayerDistanceFromPoint(i,tx,ty,tz); if(IsPlayerConnected(i)) if(pdistance < 8.0) { SendClientMessage(i, white, text); } } } else { return SendClientMessage(playerid,white,"You must be on Police Duty and sit in Police Vehicle"); } return 1; } |
pawn Код:
And, your code is a mess. |
CMD:m(playerid,params[])
{
new text[128], carid = GetPlayerVehicleID(playerid);
if(gTeam[playerid] == TEAM_POLICE)
{
switch(carid)
{
case 497, 596:
{
if(sscanf(params,"s[128]",text)) return SendClientMessage(playerid,white,"Usage: /m [text]");
foreach (new i : Player)
{
new Float:tx,Float:ty,Float:tz;
GetPlayerPos(i,tx,ty,tz);
new Float: pdistance = GetPlayerDistanceFromPoint(i,tx,ty,tz);
if(pdistance < 8.0) SendClientMessage(i, white, text);
}
}
}
}
else
{
return SendClientMessage(playerid,white,"You must be on Police Duty and sit in Police Vehicle");
}
return 1;
}
Indent your code, then the statements and logic will be much clearer.
|
Exactly, indent your code to understand better the problem. I seriously don't understand how can you guys script with that bad indentation without getting a headache after 5 minutes.
A TIP: Instead of looping for all police vehicles, just check them by id, without doing a single loop. (EG: 497 - 596). Unless you have personal vehicles created, no need to make a loop where you can just check by vehicle ID. pawn Код:
|
Exactly, indent your code to understand better the problem. I seriously don't understand how can you guys script with that bad indentation without getting a headache after 5 minutes.
A TIP: Instead of looping for all police vehicles, just check them by id, without doing a single loop. (EG: 497 - 596). Unless you have personal vehicles created, no need to make a loop where you can just check by vehicle ID. pawn Код:
|