23.12.2013, 17:30
This could should work, not really hard :P, I didn't have your team variable so I wasn't able to create a good/accurate function for your SendPoliceMessage
pawn Код:
public SpeedCamsTimer()
{
new String[256], Float:tmpX, Float:tmpY, Float:tmpZ, Name[ MAX_PLAYER_NAME ];
for(new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerName(i, Name, MAX_PLAYER_NAME);
new State = GetPlayerState(i);
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && GetPlayerSpeed(i, true) > 0 && State == PLAYER_STATE_DRIVER)
{
for(new p = 0; p < MAX_SPEEDCAMS; p++)
{
tmpX = SpeedCams[p][scx];
tmpY = SpeedCams[p][scy];
tmpZ = SpeedCams[p][scz];
GetDirectedXY(2, p, tmpX, tmpY, 5.0, 1);
if(IsPlayerInRangeOfPoint(i, 20.0, tmpX, tmpY, tmpZ))
{
new CSpeed;
CSpeed = GetPlayerSpeed(i, true);
if(CSpeed > SpeedCams[p][scmaxspeed] && SpeedCamPlayer[i] == 0)
{
SpeedCamPlayer[i] = 1;
TextDrawShowForPlayer(i, radarTD[i]);
SetTimerEx("RemoveRadarTD",1000, false, "i", i);
format(String, sizeof(String), "Suspect %s[%i] were caught speeding by the Speed Camera", Name, i);
SendPoliceMessage(COLOR_RED, String)
format(String, sizeof(String), "You were cought on speed cam(%d/%d) ((Pay system in make))", CSpeed, SpeedCams[p][scmaxspeed]);
SendClientMessage(i, COLOR_RED, String);
SetTimerEx("SpeedCamCheck", 5000, false, "d", i);
}
}
}
}
}
}
stock SendPoliceMessage(color, const message[])
{
new i = 0;
while(i < MAX_PLAYERS)
{
if(!IsPlayerConnected(playerid)) continue;
if(IsPlayerACop)
{
return SendClientMessage(i, color, message);
}
i++;
}
}
stock IsPlayerACop(playerid)
{
switch( GetPlayerSkin( playerid ) )
{
case 279 .. 288: return true;
}
return false;
}