Little Problem -
OnY - 23.12.2013
Код:
public SpeedCamsTimer(){
new String[256], Float:tmpX, Float:tmpY;
for(new i = 0; i < MAX_PLAYERS; i++){
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];
GetDirectedXY(2, p, tmpX, tmpY, 5.0, 1);
if(IsPlayerInRangeOfPoint(i, 20.0, tmpX, tmpY, SpeedCams[p][scz])){
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), "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);
}
}
}
}
}
}
Hello..How can i make on that code,when a player is cought by radar to sent a message to police with car details and speed details..Thanks
Re: Little Problem -
R4mpage - 23.12.2013
Uhm I think you could
PHP код:
SendClientMessage(Police,COLOR_YELLOW, "The Suspect %s has been caught driving over the limit!",Targetname);
Gotta define the Police and TargetName
Re: Little Problem -
OnY - 23.12.2013
And that define,can you give me an example ?Or,to send to all cops online
Re: Little Problem -
R4mpage - 23.12.2013
Uhm, like this, If you have Defined the police faction as something
#define (PoliceFactionDefineNameHere) [SendClientMessagePolice]
So smth like in my code.
#define (PoliceFactionDefineNameHere) Police
I'm new at scripting dont expect me to be good,
Re: Little Problem - Patrick - 23.12.2013
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;
}
Re: Little Problem -
SilentSoul - 23.12.2013
What is your enum of police team ?
pawn Код:
stock SendMessageToCops(text[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pFac] == 1)
{
SendClientMessage(i, -1, text);
}
}
}
once you finish that , re-edit your script with formating a new string
pawn Код:
format(string,sizeof(string),"Suspect %s has exceed limited speed allowed , he was walking on .. ");
SendMessageToCops(string);
EDIT: Ops they were faster
P.s: I've edited to your enum , you gaved but i don't want to bump the thread again , sorry for editing.
Re: Little Problem -
OnY - 23.12.2013
At enum pInfo i have
"pFac"
Is Good "[pFac] == 1)""? 1-Is number of faction.
or
PlayerInfo[playerid][pFac] = 1
How can i make now ?
Is good this ?:
Код:
stock SendMessageToCops(text[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if PlayerInfo[playerid][pFac] = 1
{
SendClientMessage(i, -1, text);
}
}
}
Re: Little Problem -
SilentSoul - 23.12.2013
No, check my post above , sorry for bumping :/! , @Codes you will get some errors
pawn Код:
stock SendMessageToCops(text[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pFac] == 1)
{
SendClientMessage(i, -1, text);
}
}
}
Re: Little Problem -
OnY - 23.12.2013
Now i have this errors,
Код:
C:\Users\User\Desktop\Ross County RP\gamemodes\rc.pwn(34837) : error 017: undefined symbol "string"
C:\Users\User\Desktop\Ross County RP\gamemodes\rc.pwn(34837) : error 017: undefined symbol "string"
C:\Users\User\Desktop\Ross County RP\gamemodes\rc.pwn(34837) : error 029: invalid expression, assumed zero
C:\Users\User\Desktop\Ross County RP\gamemodes\rc.pwn(34837) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
The line :
Код:
format(string,sizeof(string),"O masina fost prinsa depasind limita de viteza.Dupa verificarea numarului,apartine lui %s", RPN(playerid));
Al code :
Код:
SpeedCamPlayer[i] = 1;
TextDrawShowForPlayer(i, radarTD[i]);
SetTimerEx("RemoveRadarTD",1000, false, "i", i);
>>>>>>THIS LINE format(string,sizeof(string),"O masina fost prinsa depasind limita de viteza.Dupa verificarea numarului,apartine lui %s", RPN(playerid));
SendMessageToCops(string);
format(String, sizeof(String), "Masina ta este inregistata ca depasind limita de viteza(%d/%d) ((Date trimise catre politie))", CSpeed, SpeedCams[p][scmaxspeed]);
SendClientMessage(i, COLOR_RED, String);
SetTimerEx("SpeedCamCheck", 5000, false, "d", i);
}
}
}
}
}
}
Re: Little Problem -
SilentSoul - 23.12.2013
Declare the string first add this code above the error line ,