15.12.2014, 22:46
Queria Que Alguйm Me Ajuda-Se Nesse FS Pois Ele Cria Radar Sу q Quando o Player Passa Ao Invйs Dele Dar Nivel De Procurado Ele Multa Eu Quero Que Ele De Nivel De Procurado Ao Invйs De Multar.Por Favor Alguйm Pode me Ajuda
Se Alguйm me Ajudar Agradeзo...
Se Alguйm me Ajudar Agradeзo...
Код:
#include <a_samp> #include <zcmd> #include <YSI/y_ini> //=================================================================================================== // Settings //=================================================================================================== // SETTING: VALUE: Discription: #define CAMERA_LIMIT 100 //Max loaded cameras (keep this as low as possible for the best performance) #define CAMERA_UPDATE_INTERVAL 750 //update interval of all speedcams (in miliseconds) #define CAMERA_FLASH_TIME 1200 //ammount of miliseconds until the "flash" effect gets removed again #define CAMERA_DIALOG_RANGE 1337 //dialog ID range (Example: 0 will take dialogid's 0 - 9) #define CAMERA_USEMPH 0 //toggles camera using mph by default (0=kmh, 1=mph) #define CAMERA_LABEL_COLOR 0xFF000FFF //The default color of the camera's label #define CAMERA_PERSPECTIVE false //Sets playercamera temporary at the camera's position while flashing //streamer options (will be used if STREAMER_ENABLED is set on true) #define STREAMER_ENABLED false //uses a streamer (true/false) #define STREAMER_ADD CreateDynamicObject //put here at the value the command your streamer uses to make an object (CreateDynamicObject by default) #define STREAMER_REMOVE DestroyDynamicObject //put here at the value the command your streamer uses to remove an object (STREAMER_REMOVE by default) #if STREAMER_ENABLED == true //ignore this line #include streamer //put your include name here #endif //ignore this line //=================================================================================================== // Variables //=================================================================================================== #define DIALOG_MAIN CAMERA_DIALOG_RANGE #define DIALOG_RANGE CAMERA_DIALOG_RANGE +1 #define DIALOG_LIMIT CAMERA_DIALOG_RANGE +2 #define DIALOG_FINE CAMERA_DIALOG_RANGE +3 #define DIALOG_EDIT CAMERA_DIALOG_RANGE +4 #define DIALOG_EANGLE CAMERA_DIALOG_RANGE +5 #define DIALOG_ELIMIT CAMERA_DIALOG_RANGE +6 #define DIALOG_ERANGE CAMERA_DIALOG_RANGE +7 #define DIALOG_EFINE CAMERA_DIALOG_RANGE +8 #define DIALOG_ETYPE CAMERA_DIALOG_RANGE +9 #define DIALOG_LABEL CAMERA_DIALOG_RANGE +10 #define COLOR_RED 0xFF1E00FF #define COLOR_GREEN 0x05FF00FF enum _camera {Float:_x,Float:_y,Float:_z,Float:_rot,_range,_limit,_fine,_usemph,_objectid,bool:_active,bool:_activelabel,_labeltxt[128],Text3D:_label} new SpeedCameras[CAMERA_LIMIT][_camera],loaded_cameras = 0,Text:flash; //stocks for attaching labels to camera (must be defined before use, thats why this one is at the top) stock Text3D:AttachLabelToCamera(cameraid,text[]) { new position,buffer[128];format(buffer,sizeof buffer,"%s",text); for(new i = 0;strfind(buffer,"\\n",true) != -1;i++) { position = strfind(buffer,"\\n",true); strdel(buffer,position,position +2); strins(buffer,"\r\n",position,sizeof(buffer)); } return Create3DTextLabel(buffer,CAMERA_LABEL_COLOR,SpeedCameras[cameraid][_x],SpeedCameras[cameraid][_y],SpeedCameras[cameraid][_z] +7,100,0,0); } stock UpdateCameraLabel(Text3D:labelid,text[]) { new position,buffer[128];format(buffer,sizeof buffer,"%s",text); for(new i = 0;strfind(buffer,"\\n",true) != -1;i++) { position = strfind(buffer,"\\n",true); strdel(buffer,position,position +2); strins(buffer,"\r\n",position,sizeof(buffer)); } return Update3DTextLabelText(labelid,CAMERA_LABEL_COLOR,buffer); } //=================================================================================================== // Initialize //=================================================================================================== public OnFilterScriptInit() { SetTimer("UpdateCameras",CAMERA_UPDATE_INTERVAL,true); flash = TextDrawCreate(-20.000000,2.000000,"|"); TextDrawUseBox(flash,1); TextDrawBoxColor(flash,0xffffff66); TextDrawTextSize(flash,660.000000,22.000000); TextDrawAlignment(flash,0); TextDrawBackgroundColor(flash,0x000000ff); TextDrawFont(flash,3); TextDrawLetterSize(flash,1.000000,52.200000); TextDrawColor(flash,0xffffffff); TextDrawSetOutline(flash,1); TextDrawSetProportional(flash,1); TextDrawSetShadow(flash,1); print("===================================="); print("| gCamera V1.0 |"); print("| ©Gamer931215 |"); print(" Traduzido por [0P]DeLeTe_ "); print("===================================="); print("Initializing..."); LoadCameras(); return 1; } public OnFilterScriptExit() { print("===================================="); print("| gCamera V1.0 |"); print("| ©Gamer931215 |"); print(" Traduzido por [0P]DeLeTe_ "); print("===================================="); RemoveCameras(); print("All cameras have been removed."); return 1; } //=================================================================================================== // Commands //=================================================================================================== COMMAND:gcam(playerid,params[]) { if(!IsPlayerAdmin(playerid)) return 0; ShowPlayerDialog(playerid,DIALOG_MAIN,DIALOG_STYLE_LIST,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Menu","{37FF00}Criar speedcamera\n\nColocar mais proxima [ID]\nEditar mais proxima\n{FF1400}Excluir o mais proximo\n{FF1400}Excluir todas as cameras","Ok","Cancelar"); return 1; } //=================================================================================================== // Callbacks //=================================================================================================== public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(!response) { DeletePVar(playerid,"range"); DeletePVar(playerid,"limit"); DeletePVar(playerid,"fine"); DeletePVar(playerid,"selected"); return 1; } switch(dialogid) { //====================================================== // Main menu //====================================================== case DIALOG_MAIN: { switch(listitem) { case 0: ShowPlayerDialog(playerid,DIALOG_RANGE,DIALOG_STYLE_INPUT,"Inserir um intervalo","Por favor insira um intervalo (recomendado: 20-30)","Ok","Cancelar"); case 1: { new cam = GetClosestCamera(playerid); if(cam == -1) return SendClientMessage(playerid,COLOR_RED,"Nгo foi encontrada nenhuma camera por perto!"); SendClientMessageEx(playerid,COLOR_GREEN,"sis","A Mais proxima camera й ID: ",cam,"."); } case 2: { new cam = GetClosestCamera(playerid); if(cam == -1) return SendClientMessage(playerid,COLOR_RED,"Nгo foi encontrada nenhuma camera por perto!"); SetPVarInt(playerid,"selected",cam); ShowPlayerDialog(playerid,DIALOG_EDIT,DIALOG_STYLE_LIST,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor","Mudar angulo\nMudar alcance\nMudar Limite de Velocidade\nMudar Multa\nAlternar para mph\nAdd/Remover/Editar textlabel\n{FF1400}Excluir camera","Ok","Cancelar"); } case 3: { new cam = GetClosestCamera(playerid); if(cam == -1) return SendClientMessage(playerid,COLOR_RED,"Nгo foi encontrada nenhuma camera por perto!"); DestroySpeedCam(cam); SendClientMessage(playerid,COLOR_GREEN,"Camera removida com sucesso."); DeletePVar(playerid,"selected"); } case 4: { for(new i = 0;i<loaded_cameras +1;i++) { if(SpeedCameras[i][_active] == true) { DestroySpeedCam(i); } } SendClientMessage(playerid,COLOR_GREEN,"Todas as cameras foram removidas com sucesso"); } } } //====================================================== // Making a speedcam //====================================================== case DIALOG_RANGE: { if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_RANGE,DIALOG_STYLE_INPUT,"Inserir alcance","Por favor insira o alcance (recomendado: 20-30)","Ok","Cancelar"); SetPVarInt(playerid,"range",strval(inputtext)); ShowPlayerDialog(playerid,DIALOG_LIMIT,DIALOG_STYLE_INPUT,"Insira o limite de velocidade","Por favor insira o limite de velocidade","Ok","Cancelar"); } case DIALOG_LIMIT: { if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_LIMIT,DIALOG_STYLE_INPUT,"Insert a speedlimit","Please insert a speedlimit","OK","Cancel"); SetPVarInt(playerid,"limit",strval(inputtext)); ShowPlayerDialog(playerid,DIALOG_FINE,DIALOG_STYLE_INPUT,"Insira a multa","Por favor insira a multa","Ok","Cancelar"); } case DIALOG_FINE: { if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_FINE,DIALOG_STYLE_INPUT,"Insira a multa","Por favor insira a multa","Ok","Cancelar"); SetPVarInt(playerid,"fine",strval(inputtext)); new Float:x,Float:y,Float:z,Float:angle; GetPlayerPos(playerid,x,y,z);GetPlayerFacingAngle(playerid,angle); angle = angle + 180;if(angle > 360){angle = angle - 360;} new id = CreateSpeedCam(x,y,z -3,angle,GetPVarInt(playerid,"range"),GetPVarInt(playerid,"limit"),GetPVarInt(playerid,"fine"),CAMERA_USEMPH); SetPlayerPos(playerid,x,y+2,z); DeletePVar(playerid,"range"); DeletePVar(playerid,"limit"); DeletePVar(playerid,"fine"); SetPVarInt(playerid,"selected",id); ShowPlayerDialog(playerid,DIALOG_EDIT,DIALOG_STYLE_LIST,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor","Mudar angulo\nMudar alcance\nMudar Limite de Velocidade\nMudar Multa\nAlternar para mph\nAdd/Remover/Editar textlabel\n{FF1400}Excluir camera","Ok","Cancelar"); } //====================================================== // Edit menu //====================================================== case DIALOG_EDIT: { switch(listitem) { case 0: ShowPlayerDialog(playerid,DIALOG_EANGLE,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Angulo","Por favor coloque um angulo","Ok","Cancelar"); case 1: ShowPlayerDialog(playerid,DIALOG_ERANGE,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Alcance","Por favor coloque um alcance","Ok","Cancelar"); case 2: ShowPlayerDialog(playerid,DIALOG_ELIMIT,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - LimiteVelo","Por favor coloque um lmite de velocidade","Ok","Cancelar"); case 3: ShowPlayerDialog(playerid,DIALOG_EFINE,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Multa","Por favor coloque uma multa","Ok","Cancelar"); case 4: ShowPlayerDialog(playerid,DIALOG_ETYPE,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Mph/Kmh","Coloque 1 para usar mph e 0 para kmh","Ok","Cancelar"); case 5: ShowPlayerDialog(playerid,DIALOG_LABEL,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Textlabel","Por favor, preencha o texto que voce deseja anexar, ou deixe-o vazio para apagar um ja existente!","Ok","Cancelar"); case 6: { DestroySpeedCam(GetPVarInt(playerid,"selected")); SendClientMessage(playerid,COLOR_GREEN,"Camera removida com sucesso."); DeletePVar(playerid,"selected"); } } } //====================================================== // Editing a speedcam //====================================================== case DIALOG_EANGLE: { if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_EANGLE,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Angulo","Por favor coloque um angulo","Ok","Cancelar"); new id = GetPVarInt(playerid,"selected"); new rot = strval(inputtext); rot = rot + 180; if (rot > 360) { rot = rot - 360; } SpeedCameras[id][_rot] = rot; SetObjectRot(SpeedCameras[id][_objectid],0,0,rot); SaveCamera(id); SendClientMessageEx(playerid,COLOR_GREEN,"sisis","O angulo da camera ID ",id," foi alterado com sucesso para ",strval(inputtext),"."); } case DIALOG_ERANGE: { if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_ERANGE,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Alcance","Por favor coloque um alcance","Ok","Cancelar"); new id = GetPVarInt(playerid,"selected"); SpeedCameras[id][_range] = strval(inputtext); SaveCamera(id); SendClientMessageEx(playerid,COLOR_GREEN,"sisis","O alcance da camera ID ",id," foi alterado com sucesso para ",strval(inputtext),"."); } case DIALOG_ELIMIT: { if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_ELIMIT,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - LimiteVelo","Por favor coloque um lmite de velocidade","Ok","Cancelar"); new id = GetPVarInt(playerid,"selected"); SpeedCameras[id][_limit] = strval(inputtext); SaveCamera(id); SendClientMessageEx(playerid,COLOR_GREEN,"sisis","O limite da camera ID ",id," foi alterado com sucesso para ",strval(inputtext),"."); } case DIALOG_EFINE: { if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_EFINE,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Multa","Por favor coloque uma multa","Ok","Cancelar"); new id = GetPVarInt(playerid,"selected"); SpeedCameras[id][_fine] = strval(inputtext); SaveCamera(id); SendClientMessageEx(playerid,COLOR_GREEN,"sisis","A multa da camera ID ",GetPVarInt(playerid,"selected")," foi alterado com sucesso para ",strval(inputtext),"."); } case DIALOG_ETYPE: { if(!strlen(inputtext) || strval(inputtext) != 0 && strval(inputtext) != 1) return ShowPlayerDialog(playerid,DIALOG_ETYPE,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Mph/Kmh","Coloque 1 para usar mph e 0 para kmh","Ok","Cancelar"); new id = GetPVarInt(playerid,"selected"); SpeedCameras[id][_usemph] = strval(inputtext); if(strval(inputtext) == 1) { SendClientMessageEx(playerid,COLOR_GREEN,"sis","CameraID ",GetPVarInt(playerid,"selected")," Velocidade alterada para mph."); } else { SendClientMessageEx(playerid,COLOR_GREEN,"sis","CameraID ",GetPVarInt(playerid,"selected")," Velocidade alterada para kmh."); } } case DIALOG_LABEL: { new id = GetPVarInt(playerid,"selected"); if(!strlen(inputtext)) { if(SpeedCameras[id][_activelabel] == true) { Delete3DTextLabel(SpeedCameras[id][_label]); SpeedCameras[id][_activelabel] = false; SpeedCameras[id][_labeltxt] = 0; } SendClientMessageEx(playerid,COLOR_GREEN,"sis","O textlabel da cameraID ",GetPVarInt(playerid,"selected")," foi removido com sucesso."); } else { if(SpeedCameras[id][_activelabel] == true) { format(SpeedCameras[id][_labeltxt],128,"%s",inputtext); UpdateCameraLabel(SpeedCameras[id][_label],inputtext); } else { SpeedCameras[id][_activelabel] = true; format(SpeedCameras[id][_labeltxt],128,"%s",inputtext); SpeedCameras[id][_label] = AttachLabelToCamera(id,inputtext); } SendClientMessageEx(playerid,COLOR_GREEN,"sisss","O textlabel da cameraID ",GetPVarInt(playerid,"selected")," foi alterado com sucesso para ",inputtext,"."); } SaveCamera(id); } } return 0; } //=================================================================================================== // Functions //=================================================================================================== stock LoadCameras() { new file[64]; for(new i = 0;i<CAMERA_LIMIT;i++) { format(file,sizeof file,"/SpeedCameras/%i.txt",i); if(fexist(file)) { INI_ParseFile(file,"LoadCam",.bExtra = true,.extra = i); #if STREAMER_ENABLED == true SpeedCameras[i][_objectid] = STREAMER_ADD(18880,SpeedCameras[i][_x],SpeedCameras[i][_y],SpeedCameras[i][_z],0,0,SpeedCameras[i][_rot]); #else SpeedCameras[i][_objectid] = CreateObject(18880,SpeedCameras[i][_x],SpeedCameras[i][_y],SpeedCameras[i][_z],0,0,SpeedCameras[i][_rot]); #endif SpeedCameras[i][_active] = true; if(SpeedCameras[i][_activelabel] == true) { SpeedCameras[i][_label] = AttachLabelToCamera(i,SpeedCameras[i][_labeltxt]); } loaded_cameras++; } } printf("gCamera foi carregado com %i camera(s).",loaded_cameras); } forward LoadCam(cameraid,name[],value[]); public LoadCam(cameraid,name[],value[]) { INI_Float("_x",SpeedCameras[cameraid][_x]); INI_Float("_y",SpeedCameras[cameraid][_y]); INI_Float("_z",SpeedCameras[cameraid][_z]); INI_Float("_rot",SpeedCameras[cameraid][_rot]); INI_Int("_range",SpeedCameras[cameraid][_range]); INI_Int("_limit",SpeedCameras[cameraid][_limit]); INI_Int("_fine",SpeedCameras[cameraid][_fine]); INI_Int("_usemph",SpeedCameras[cameraid][_usemph]); INI_Bool("_activelabel",SpeedCameras[cameraid][_activelabel]); INI_String("_labeltxt",SpeedCameras[cameraid][_labeltxt],128); return 1; } stock RemoveCameras() { for(new i = 0;i<loaded_cameras +1;i++) { if(SpeedCameras[i][_active] == true) { #if STREAMER_ENABLED == true STREAMER_REMOVE(SpeedCameras[i][_objectid]); #else DestroyObject(SpeedCameras[i][_objectid]); #endif if(SpeedCameras[i][_activelabel] == true) { Delete3DTextLabel(SpeedCameras[i][_label]); } } } return 1; } stock generate_id() { new file[64]; for(new i = 0;i<CAMERA_LIMIT;i++) { format(file,sizeof file,"/SpeedCameras/%i.txt",i); if(!fexist(file)) return i; } return -1; } stock CreateSpeedCam(Float:x,Float:y,Float:z,Float:rot,range,limit,fine,use_mph = 0) { new newid = generate_id(); if(newid == -1) { print("gSpeedcam: ERROR! Limite de cameras atingido!"); return 1; } if (newid == loaded_cameras || newid > loaded_cameras) { loaded_cameras++; } SpeedCameras[newid][_x] = x; SpeedCameras[newid][_y] = y; SpeedCameras[newid][_z] = z; SpeedCameras[newid][_rot] = rot; SpeedCameras[newid][_range] = range; SpeedCameras[newid][_limit] = limit; SpeedCameras[newid][_fine] = fine; SpeedCameras[newid][_usemph] = use_mph; #if STREAMER_ENABLED == true SpeedCameras[newid][_objectid] = STREAMER_ADD(18880,x,y,z,0,0,rot); #else SpeedCameras[newid][_objectid] = CreateObject(18880,x,y,z,0,0,rot); #endif SpeedCameras[newid][_active] = true; SpeedCameras[newid][_activelabel] = false; SpeedCameras[newid][_labeltxt] = 0; new file[64];format(file,sizeof file,"/SpeedCameras/%i.txt",newid); new INI:handler = INI_Open(file); INI_WriteFloat(handler,"_x",SpeedCameras[newid][_x]); INI_WriteFloat(handler,"_y",SpeedCameras[newid][_y]); INI_WriteFloat(handler,"_z",SpeedCameras[newid][_z]); INI_WriteFloat(handler,"_rot",SpeedCameras[newid][_rot]); INI_WriteInt(handler,"_range",SpeedCameras[newid][_range]); INI_WriteInt(handler,"_limit",SpeedCameras[newid][_limit]); INI_WriteInt(handler,"_fine",SpeedCameras[newid][_fine]); INI_WriteInt(handler,"_usemph",SpeedCameras[newid][_usemph]); INI_WriteBool(handler,"_activelabel",SpeedCameras[newid][_activelabel]); INI_WriteString(handler,"_labeltxt",SpeedCameras[newid][_labeltxt]); INI_Close(handler); return newid; } stock SaveCamera(cameraid) { new file[64];format(file,sizeof file,"/SpeedCameras/%i.txt",cameraid); new INI:handler = INI_Open(file); INI_WriteFloat(handler,"_x",SpeedCameras[cameraid][_x]); INI_WriteFloat(handler,"_y",SpeedCameras[cameraid][_y]); INI_WriteFloat(handler,"_z",SpeedCameras[cameraid][_z]); INI_WriteFloat(handler,"_rot",SpeedCameras[cameraid][_rot]); INI_WriteInt(handler,"_range",SpeedCameras[cameraid][_range]); INI_WriteInt(handler,"_limit",SpeedCameras[cameraid][_limit]); INI_WriteInt(handler,"_fine",SpeedCameras[cameraid][_fine]); INI_WriteInt(handler,"_usemph",SpeedCameras[cameraid][_usemph]); INI_WriteBool(handler,"_activelabel",SpeedCameras[cameraid][_activelabel]); INI_WriteString(handler,"_labeltxt",SpeedCameras[cameraid][_labeltxt]); INI_Close(handler); } stock DestroySpeedCam(cameraid) { SpeedCameras[cameraid][_active] = false; #if STREAMER_ENABLED == true STREAMER_REMOVE(SpeedCameras[cameraid][_objectid]); #else DestroyObject(SpeedCameras[cameraid][_objectid]); #endif if(SpeedCameras[cameraid][_activelabel] == true) { Delete3DTextLabel(SpeedCameras[cameraid][_label]); } SpeedCameras[cameraid][_activelabel] = false; SpeedCameras[cameraid][_labeltxt] = 0; new file[64];format(file,sizeof file,"/SpeedCameras/%i.txt",cameraid); if(fexist(file)){fremove(file);} return 1; } stock SetSpeedCamRange(cameraid,limit) { SpeedCameras[cameraid][_limit] = limit; return 1; } stock SetSpeedCamFine(cameraid,fine) { SpeedCameras[cameraid][_fine] = fine; return 1; } stock Float:GetDistanceBetweenPoints(Float:x,Float:y,Float:tx,Float:ty) { new Float:temp1, Float:temp2; temp1 = x-tx;temp2 = y-ty; return floatsqroot(temp1*temp1+temp2*temp2); } stock GetClosestCamera(playerid) { new Float:distance = 10,Float:temp,Float:x,Float:y,Float:z,current = -1;GetPlayerPos(playerid,x,y,z); for(new i = 0;i<loaded_cameras +1;i++) { if(SpeedCameras[i][_active] == true) { temp = GetDistanceBetweenPoints(x,y,SpeedCameras[i][_x],SpeedCameras[i][_y]); if(temp < distance) { distance = temp; current = i; } } } return current; } stock Float:GetVehicleSpeed(vehicleid,UseMPH = 0) { new Float:speed_x,Float:speed_y,Float:speed_z,Float:temp_speed; GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z); if(UseMPH == 0) { temp_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667; } else { temp_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*85.4166672; } floatround(temp_speed,floatround_round);return temp_speed; } stock SendClientMessageEx(playerid,color,type[],{Float,_}:...) { new string[128]; for(new i = 0;i<numargs() -2;i++) { switch(type[i]) { case 's': { new result[128]; for(new a= 0;getarg(i +3,a) != 0;a++) { result[a] = getarg(i +3,a); } if(!strlen(string)) { format(string,sizeof string,"%s",result); } else format(string,sizeof string,"%s%s",string,result); } case 'i': { new result = getarg(i +3); if(!strlen(string)) { format(string,sizeof string,"%i",result); } else format(string,sizeof string,"%s%i",string,result); } case 'f': { new Float:result = Float:getarg(i +3); if(!strlen(string)) { format(string,sizeof string,"%f",result); } else format(string,sizeof string,"%s%f",string,result); } } } SendClientMessage(playerid,color,string); return 1; } //=================================================================================================== // Timers //=================================================================================================== forward UpdateCameras(); public UpdateCameras() { for(new a = 0;a<MAX_PLAYERS;a++) { if(!IsPlayerConnected(a)) continue; if(!IsPlayerInAnyVehicle(a)) continue; if(GetPVarInt(a,"PlayerHasBeenFlashed") == 1) { continue; } else if (GetPVarInt(a,"PlayerHasBeenFlashed") == 2) { DeletePVar(a,"PlayerHasBeenFlashed"); continue; } for(new b = 0;b<loaded_cameras +1;b++) { if(SpeedCameras[b][_active] == false) continue; if(IsPlayerInRangeOfPoint(a,SpeedCameras[b][_range],SpeedCameras[b][_x],SpeedCameras[b][_y],SpeedCameras[b][_z])) { new speed = floatround(GetVehicleSpeed(GetPlayerVehicleID(a),SpeedCameras[b][_usemph])); new limit = SpeedCameras[b][_limit]; if(speed > limit) { TextDrawShowForPlayer(a,flash); #if CAMERA_PERSPECTIVE == true SetPlayerCameraPos(a,SpeedCameras[b][_x],SpeedCameras[b][_y],SpeedCameras[b][_z] + 5); new Float:x,Float:y,Float:z;GetPlayerPos(a,x,y,z); SetPlayerCameraLookAt(a,x,y,z); #endif SetPVarInt(a,"PlayerHasBeenFlashed",1); SetTimerEx("RemoveFlash",CAMERA_FLASH_TIME,false,"i",a); if(GetPlayerState(a) == PLAYER_STATE_DRIVER) { if(SpeedCameras[b][_usemph] == 0) { SendClientMessageEx(a,0xFF1E00FF,"sisis","Vocк estб dirigindo rбpido demais! vocк foi pego dirigindo ",speed,"kmh' onde vocк estava autorizado a conduzir ",limit, "kmh."); SendClientMessageEx(a,0xFF1E00FF,"sis","Voce obteve uma multa de $",SpeedCameras[b][_fine],"."); } else { SendClientMessageEx(a,0xFF1E00FF,"sisis","Vocк estб dirigindo rбpido demais! vocк foi pego dirigindo ",speed,"mph' onde vocк estava autorizado a conduzir ",limit, "mph."); SendClientMessageEx(a,0xFF1E00FF,"sis","Voce obteve uma multa de $",SpeedCameras[b][_fine],"."); } GivePlayerMoney(a, - SpeedCameras[b][_fine]); } } } } } } forward RemoveFlash(playerid); public RemoveFlash(playerid) { TextDrawHideForPlayer(playerid,flash); SetPVarInt(playerid,"PlayerHasBeenFlashed",2); #if CAMERA_PERSPECTIVE == true SetCameraBehindPlayer(playerid); #endif }