Jump to content
  • 0

Putin ajutor la Radar ?


bLoN

Question

Salut am folosesc un sistem de radar pe un GM HPQ Edit ! Si de fiecare data cand trec pe langa PD-ul cu Radar , nu primeste nimeni nimic , nici eu nici el.

Las mai jos tot ! 

Atentie ! Ofer PSF de 10e Celui care ma ajuta sa o fac perfect functionabila.

//radar

new RadarCooldown[MAX_PLAYERS];
new Radar[MAX_PLAYERS];

 

//radar 

YCMD:radar(playerid,params[],help) {
    if(RadarCooldown[playerid] > 0) return SCMf(playerid,COLOR_GREY,"Wait %d seconds to place a radar.",RadarCooldown[playerid]);
    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 13) {
        if(OnDuty[playerid] == 1) {
            new vehicle = GetVehicleID(GetPlayerVehicleID(playerid));
            if(ServerVehicles[vehicle][vFaction] == 1 || ServerVehicles[vehicle][vFaction] == 13) {
                new maxspeed;
                if(sscanf(params, "i", maxspeed)) return SCM(playerid,-1,"{FF6699}Usage: {ffffff}/radar <max speed>");
                if(maxspeed < 100 || maxspeed > 270) return SCM(playerid, COLOR_GREY, "Minimum speed is 100 km/h and maximum speed is 270 km/h.");
                Radar[playerid] = maxspeed;
                SCMf(playerid,COLOR_YELLOW,"You have placed a radar for %d km/h.",maxspeed);
                TogglePlayerControllable(playerid, 0);
                gString[0] = EOS;
                format(gString, sizeof(gString), "%s placed a radar (%d km/h) in %s.",GetName(playerid),maxspeed,GetPlayerZone(playerid));
                SendFactionMessage(1,COLOR_CLIENT,gString);
                SendFactionMessage(2,COLOR_CLIENT,gString);
                SendFactionMessage(3,COLOR_CLIENT,gString);
                SendFactionMessage(13,COLOR_CLIENT,gString);
                RadarCooldown[playerid] = 45;
            }
            else return SCM(playerid,-1,"You are not in a faction vehicle!");
        }
        else return SCM(playerid,-1,"You are not on duty!");
    }
    else return SCM(playerid,-1,"Only LSPD and LVPD members can use this command!");
    return 1;
}
YCMD:stopradar(playerid, params[], help) {
    if(Radar[playerid] == 0) return SCM(playerid,-1,"You don't have a radar placed!");
    Radar[playerid] = 0;
    SCM(playerid,COLOR_YELLOW,"You have stopped the radar!");
    TogglePlayerControllable(playerid, 1);
    RadarCooldown[playerid] = 30;
    return 1;
}

 

//Functia OtherTime

function OtherTimer() {

 

 foreach(new i : Player) {

 if(RadarCooldown[i] > 0) RadarCooldown[i] --;
    }

 

//functia Checkvehinfo 

 

new spe = Carspeed(i);
    foreach(new x : Player) {
            if(Radar[x] > 0) {
                new Float:rPos[3];
                GetPlayerPos(x, rPos[0],rPos[1],rPos[2]);
                GetXYInFrontOfPlayer(x, rPos[0],rPos[1], 100.0);
                if(IsPlayerInRangeOfPoint(i, 60, rPos[0],rPos[1],rPos[2])) {
                    if(spe > Radar[x] && PlayerInfo[i][pWantedLevel] == 0 && !IsACop(i)) {
                        UsedFind[x] = 1;
                        CP[x] = 53;
                        new Float:X,Float:Y,Float:Z;
                        GetPlayerPos(i, X,Y,Z);
                        SetPlayerCheckpointEx(x, X,Y,Z, 3.5);
                        targetfind[x] = i;
                        SCMf(x,COLOR_YELLOW,"{ff0000}%s{ffffff} was caught speeding with %d km/h where the limit is {ff0000}%d km/h.",GetName(i),spe,Radar[x]);
                        SCMf(i,COLOR_YELLOW,"You have been caught speeding with a speed of {ff0000}%d km/h{ffffff} where the limit is {ff0000}%d km/h.",spe,Radar[x]);
                        SetPlayerWantedLevel(i, 1);
                        PlayerInfo[i][pWantedLevel] += 1;
                        //SetPlayerCriminal(i,x, "speeding",2);
                        //culoarewanted
                        SetPlayerColor(i, 0xFF0033FF);
                        //culoarewanted
                        SetPlayerCriminal(i, 255 ,"speeding");
                        WantedTime[i] = 0;
                        Update(i,pWantedLevelx);
                        TogglePlayerControllable(x, 1);
                        Radar[x] = 0;
                    }
                }
            }
        }

 

//Stock-uri

stock ResetVariables(playerid) {

    Radar[playerid] = 0;

 

// 

stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);
    if (GetPlayerVehicleID(playerid))
    {
        GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}

Astept Privat Mesaj ! Rog seriozitate , multumesc anticipat.

Edited by bLoN
Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

Uita-te tocmai jos , ultimul rand ! Doar acolo mai am Functia OtherTime !

 

 

task Timers[1000]() {
    new 
        string[180], szTD[600], 
        Float: ppHealth, Float: ppArmour,
        Float: x, Float: y, Float: z, swinner[180];

    foreach(new i : Rainbows[3]) ChangeRainbowColors(i);

    foreach(Player, i) {
        if(login[i] < gettime() && login[i] != -1) SCM(i, COLOR_WARNING, "Ai primit kick deoarece nu ti-ai logat/inregistrat la timp!!"), KickEx(i);
        
        if(IsPlayerLogged[i] != 1)
            continue;

        if(UnFreezeTimer[i] < gettime() && UnFreezeTimer[i] != -1) UnFreezeStation(i);
        if(JobWorking[i] != 0 && PlayerInfo[i][pJob] == 2 && !IsTrailerAttachedToVehicle(GetPlayerVehicleID(i)) && CP[i] == 52 && !IsTrailerAttachedToVehicle(GetPlayerVehicleID(i)) && CP[i] == 52) AttachTrailer(i);
        if(TimerMoney[i] < gettime() && TimerMoney[i] != -1) PlayerTextDrawHide(i, PlayerInfo[i][pShowBanca] ? MoneyTD1 : MoneyTD0), TimerMoney[i] = -1;
        if(TimerInfo[i] < gettime() && TimerInfo[i] != -1) PlayerTextDrawHide(i, InfoPTD), TimerInfo[i] = -1;
        if(PnsTimer[i] <= gettime() && PnsTimer[i] != -1) RepairVehiclePns(i);
        if(TimerPayDay[i] < gettime()) {
            for(new l = 0; l < 3; l++) PlayerTextDrawHide(i, PayDayPTD[l]);
            TimerPayDay[i] = -1;
        }
        if(FishTimer[i] > 0) {
            FishTimer[i] --;
            switch(FishTimer[i]) {
                case 5: GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~n~~y~YOU'RE FISHING~n~~w~~h~Waiting...", 5000, 3);
                case 0: {
                    PickUpFish[i] = CreateDynamicPickup(19630, 23, LastPos[i][0], LastPos[i][1], LastPos[i][2]+1.1, -1, -1, i, 10.0);
                    HavePestele[i] = 10;
                }
            }
        }
        if(HavePestele[i] > 0) {
            HavePestele[i] --;
            if(HavePestele[i] == 0) {
                SCM(i, COLOR_LGREEN, "Ai pierdut pestele. Cand apare pestele foloseste tasta [SPACE] pentru a il prinde.");
                TogglePlayerControllable(i, true);
                RemovePlayerAttachedObject(i, 0);
                DestroyDynamicPickup(PickUpFish[i]);
                StartFish[i] = 0;
                Freezed[i] = 0;
            }
        }
        if(GiftStep[i] < 19) UpdateGift(i);
        if(JobWorking[i] == 1) WorkingTime[i] ++;
        if(JobLeftTime[i] > 0) {
            JobLeftTime[i] --;
            if(JobLeftTime[i] == 0) {
                SendClientMessage(i, COLOR_GREY, "Job esuat! Ai parasit vehiculul.");
                if(playerObject[i] != 0) DestroyPlayerObject(i, playerObject[i]), playerObject[i] = 0;
                if(playerObject2[i] != 0) DestroyObject(playerObject2[i]), playerObject2[i] = 0;
                JobWorking[i] = 0;
                PlayerTextDrawHide(i, JobTD);
                if(JobVehicle[i] != 0) { DestroyVehicle(JobVehicle[i]); JobVehicle[i] = 0; }
                if(Trailer[i] != 0) { DestroyVehicle(Trailer[i]); Trailer[i] = 0;  }
                PlayerTextDrawHide(i, InfosTD);
                DisablePlayerCheckpointEx(i);
                DisablePlayerRaceCheckpointEx(i);
                RemovePlayerAttachedObject(i, 6);
                RemovePlayerAttachedObject(i, 2);
                CP[i] = 0;
                JobVehicle[i] = 0;
                JobDeelay[i][PlayerInfo[i][pJob]] = 20;    
            }
        }
        if(ExamTime[i] > 0) {
            ExamTime[i] --;
            format(string, sizeof(string), "~y~00:%02d", ExamTime[i]);
            PlayerTextDrawSetString(i, ExamTD[4], string);
            if(ExamTime[i] == 0) FailExam(i), SCM(i, COLOR_LIGHTRED, "Licenses: {FFFFFF}Timp-ul pentru a raspunde la intrebari a expirat.");
        }
        
        if(InTraining[i] == 1 && PlayerInfo[i][pWantedLevel] != 0) {
            InTraining[i] = 0;
            FactionsSpawns(i);
            new t = GetPVarInt(i, "Training");
            SetPlayerPosEx(false, i, Training[t][0], Training[t][1], Training[t][2]);
            DeletePVar(i, "Training");
            ResetPlayerWeapons(i);
            SCM(i, COLOR_YELLOW, "Ai fost scos din sala de antrenament deoarece ai wanted!");               
        }    
              
        if(!PlayerToPoint(50, i, LastPos[i][0], LastPos[i][1], LastPos[i][2]) && !IsPlayerInArea(i, -3000, -2274.5, -1776, -859.5) && PlayerInfo[i][pAdmin] == 0 && Exception[i] == 0 && AFKSeconds[i] < 15 && InDealer[i] == 0 && ArenaSpec[i] == -1 && Spectate[i] == 255 && GetPlayerSurfingVehicleID(i) == INVALID_VEHICLE_ID) {
            if(ServerSystem[0] == 0) {    
                if(IsPlayerInAnyVehicle(i)) SetVehicleToRespawn(GetPlayerVehicleID(i));            
                SendAdminMessage(COLOR_WARNING, string, 1);
                NightBot(i, "Cheats (teleport-hack)");
                WarningsCheat[i] = -3;    
            }    
        }
        if(WarningsCheat[i] > 0) WarningsCheat[i] --;
        if(Exception[i] > 0) Exception[i] --;
        if(GetPlayerWeapon(i) >= 8 && GetPlayerWeapon(i) != 23 && GetPlayerWeapon(i) != 46 && GetPlayerWeapon(i) != 43 && PlayerInfo[i][pGunLic] == 0) {
            if(ServerSystem[1] == 0 ) NightBot(i, "Cheats (weapon-hack)");
        }
                
        
        if(GetPlayerState(i) == PLAYER_STATE_DRIVER && GetPlayerInterior(i) == 0) {
            if(!nearPNS2(i) && NearPNS[i] == 1) DisableRemoteVehicleCollisions(i, 0), NearPNS[i] = 0;
            if(nearPNS2(i)) {
                DisableRemoteVehicleCollisions(i, 1);
                NearPNS[i] = 1;
            }
        }    
        
        if(GetPlayerState(i) == PLAYER_STATE_DRIVER) Checkvehinfo(i);
        if(TradeTime[i] > 0) {
            TradeTime[i] --;
            new id = TradeID[i];
            format(string, sizeof(string), "00:0%d", TradeTime[i]);
            PlayerTextDrawSetString(i, TradePTD[6], string);
            PlayerTextDrawSetString(id, TradePTD[6], string);            
            if(TradeTime[i] == 0) {
                FinishTrade(i);
                PlayerTextDrawHide(i, TradePTD[6]);
                PlayerTextDrawHide(id, TradePTD[6]);                    
            }
        }                
                        
        // AdmBot - Kick
        if(GetPlayerState(i) == PLAYER_STATE_DRIVER && !IsAPlane(GetPlayerVehicleID(i))) {
            new speed = Carspeed(GetPlayerVehicleID(i));        
            if(speed > 400 && PlayerInfo[i][pAdmin] < 1 && !IsPlayerInArea(i, -3000, -2274.5, -1776, -859.5))
            {    
                if(GetVehicleModel(i) == 522 && speed < 250) 
                    continue;

                if(GetAdmins() > 0) {
                    format(string, sizeof(string), "%s(%d) is suspected of using Speed-Hack (vehicle %s, speed %d)", GetName(i), i, aVehicleNames[GetVehicleModel(GetPlayerVehicleID(i))-400], speed);
                    if(GetPVarInt(i, "Cover") == 0) SendAdminMessage(COLOR_WARNING, string,1);
                }
                else if(ServerSystem[5] == 0) NightBot(i, "Cheats (speed-hack)");
            }
        }

        if(PlayerInfo[i][pAdmin] < 1) {
            if(GetPlayerSpeed(i) > 150 && HaveFlyHack(i)) {
                if(GetPlayerSurfingVehicleID(i) == INVALID_VEHICLE_ID) {                
                    SCM(i, COLOR_WHITE, "Stop cheating (fly-hack).");
                    KickEx(i);
                }
            }
        }        
        if(CheatWarnings[i] > 0) CheatWarnings[i] --;
            
        if(GetPlayerPing(i) >= 500) {
            format(string, sizeof(string), "AdmCmd: %s was kicked by AdmBot, reason: Ping 500+.", GetNameEx(i));
            SCMTA(COLOR_LIGHTRED, string);                
            SCM(i, COLOR_WHITE, "You has been kicked reason: Mega ping.");
            KickEx(i);
        }        

        if(PlayerToPoint(1.1, i, LastPos[i][0], LastPos[i][1], LastPos[i][2])) {

            AFKSeconds[i] ++;
            if(AFKSeconds[i] >= 3600 && PlayerInfo[i][pSleeping] == 0 && PlayerInfo[i][pAdmin] < 6) {
                format(string, sizeof(string), "AdmCmd: %s was kicked by AdmBot, reason: AFK fara /sleep mai mult de 60 minute.", GetNameEx(i));
                SCMTA(COLOR_LIGHTRED, string);
                KickEx(i);
            }                
            if(AFKSeconds[i] >= 120) {
                if(JobWorking[i] == 1) {
                    SCM(i, COLOR_GREY, "Job esuat! Ai stat AFK timp de 2 minute.");
                    if(playerObject[i] != 0) DestroyPlayerObject(i, playerObject[i]), playerObject[i] = 0;
                    if(playerObject2[i] != 0) DestroyObject(playerObject2[i]), playerObject2[i] = 0;
                    JobWorking[i] = 0;
                    PlayerTextDrawHide(i, JobTD);
                    if(JobVehicle[i] != 0) { DestroyVehicle(JobVehicle[i]); JobVehicle[i] = 0; }
                    if(Trailer[i] != 0) { DestroyVehicle(Trailer[i]); Trailer[i] = 0; }
                    PlayerTextDrawHide(i, InfosTD);
                    DisablePlayerCheckpointEx(i);
                    DisablePlayerRaceCheckpointEx(i);
                    CP[i] = 0;
                    JobVehicle[i] = 0;
                    JobDeelay[i][PlayerInfo[i][pJob]] = 20;
                    RemovePlayerAttachedObject(i, 6);
                    RemovePlayerAttachedObject(i, 2);
                    SetPlayerSpecialAction(i, 0);        
                    SetPlayerSpecialAction(i, 0);
                }
            }
        }    
        else AFKSeconds[i] = 0;
        if(PlayerInfo[i][pSleeping] == 0 && Spectate[i] == 255 && AFKSeconds[i] < 15) PlayerInfo[i][pSeconds] ++, Connected[i] ++;

        
        GetPlayerPos(i, LastPos[i][0], LastPos[i][1], LastPos[i][2]);
        
        if(GetPlayerWeapon(i) != 0 && AFKSeconds[i] == 0) {
            if(ServerSystem[1] == 0 && GetPlayerWeapon(i) != 0) CheckWeapons(i, GetPlayerWeapon(i));
            if(ServerSystem[2] == 0 && GetPlayerWeapon(i) != 0) CheckAmmo(i, GetPlayerWeapon(i));
        }    
    
        if(PlayerInfo[i][pAdmin] == 0 && GetPlayerSpecialAction(i) == 2 && ServerSystem[9] == 0) NightBot(i, "Cheats (jetpack)");
        
        if(WTimes[i] != 0) WTimes[i] -= 2;
        
        if(GetPlayerDrunkLevel(i) < 100) SetPlayerDrunkLevel(i, 2000);
        else {
            if(pDrunkLevelLast[i] != GetPlayerDrunkLevel(i)) {
                new wfps = pDrunkLevelLast[i] - GetPlayerDrunkLevel(i);
                if((wfps > 0) && (wfps < 200)) FPS2[i] = wfps;
                pDrunkLevelLast[i] = GetPlayerDrunkLevel(i);
            }
        }    
     
        if(PlayerInfo[i][pShowFP] == 1 && PlayerInfo[i][pShowHud] == 0) {
            gString[0] = EOS;
            if(PlayerInfo[i][pAdmin] == 0) format(gString, 20, "FPS: ~y~%d", FPS2[i]-1);
            else format(gString, 60, "TICK: ~r~%d ~w~~w~~h~MYSQL: ~b~%d ~w~~h~FPS: ~y~%d", GetServerTickRate(), mysql_unprocessed_queries(), FPS2[i]-1);
            PlayerTextDrawSetString(i, ShowFPS, gString);
            PlayerTextDrawShow(i, ShowFPS);
        }
        if(GetPlayerAnimationIndex(i) == 1660) OnPlayerUseVending(i);    
        if(GetPlayerSurfingVehicleID(i) != INVALID_VEHICLE_ID && !IsABoat(GetPlayerSurfingVehicleID(i))) {
            if(GetPlayerWeapon(i) != 0) {
                SetPlayerArmedWeapon(i, 0);
                SCM(i, COLOR_WARNING, "Nu poti folosi armele atata timp cat esti pe vehicul!");
            }    
        }
        
        if(PaintType[i] != 0 && PlayersOnPaint(PaintType[i]-1) >= 2) {
            new pp = PaintType[i]-1;
            if(pp < 2) {
                format(string, sizeof(string), "Paintball time: %s~n~Current map: %s~n~Stats: %d kills, %d deaths.~n~Total score: %d~n~Best player: %s (kills: %d)~n~%d players in paintball.",
                CalculeazaTimp2(PaintTime[pp]), MapName(pp), PKills[i], PDeaths[i], PKills[i]-PDeaths[i], GetName(PaintballWinner[pp]), PKills[PaintballWinner[pp]], PlayersOnPaint(pp));
            }
            else {
                new masadenume[32];
                GetWeaponNameEx(GetPlayerWeapon(i), masadenume, sizeof(masadenume));

                format(string, sizeof(string), "Paintball time: %s~n~Current map: %s~n~Stats: %d kills, %d deaths.~n~Total score: %d~n~Level %d, Weapon: %s~n~Best player: %s (kills: %d)~n~%d players in paintball.",
                CalculeazaTimp2(PaintTime[pp]), MapName(pp), PKills[i], PDeaths[i], PKills[i]-PDeaths[i], GetPaintLevel(i), masadenume, GetName(PaintballWinner[pp]), PKills[PaintballWinner[pp]], PlayersOnPaint(pp));
            }
            
            if(PaintTime[pp] == 0 && PaintballWinner[pp] != -1) {
                for(new m = 0; m < 5; m++) SendDeathMessageToPlayer(i, 1001, 1001, 200);
                format(string, sizeof(string), "Statistica ta in aceasta runda: %d ucideri si %d decese.", PKills[i], PDeaths[i]);
                SCM(i, COLOR_YELLOW, string);                    
                format(swinner, 256, "* %s a castigat runda cu %d ucideri.", GetName(PaintballWinner[pp]), PKills[PaintballWinner[pp]]);                                
                PKills[i] = 0, PDeaths[i] = 0;
                ResetWeapons(i);                
                PaintballWinnerScore[pp] = 0;                    
                SendPaintMessage(PaintType[i], COLOR_YELLOW, swinner);
                PaintballWinner[pp] = -1;                    
            }
            if(PaintTime[pp] != 0 && PaintText[pp] == 0) {
                PlayerTextDrawSetString(i, PaintTD, string);
                PlayerTextDrawShow(i, PaintTD);                    
            }    
            else {                    
                PlayerTextDrawHide(i, PaintTD);    
            }    
        }
        else PlayerTextDrawHide(i, PaintTD);               

        if(PlayerInfo[i][pWantedLevel] >= 1) {
            format(string, sizeof(string), "Nivel wanted actual: ~y~%d~n~~w~~h~Scade un nivel in: ~y~%d min.", PlayerInfo[i][pWantedLevel], 7-WantedTime[i]);
            PlayerTextDrawSetString(i, WantedTD[i], string);
            PlayerTextDrawShow(i, WantedTD[i]);
        }
        else PlayerTextDrawHide(i, WantedTD[i]);
    
        if(PlayerInfo[i][pJob] == 1 && JobWorking[i] == 1) {
            if(PlayerToPoint(200, i, -379.0663,-1436.2332,25.7266) && Carspeed(GetPlayerVehicleID(i)) > 25) {
                JobSeconds[i] --;
                UpdateJobStats(i);
                if(DaiWanted[i] > 0) DaiWanted[i] = 0;
                if(JobSeconds[i] == 0) {
                    new rand = 10 + random(30);
                    KG[i] = rand;
                    format(string, sizeof(string), "Ai primit %d kilograme de faina. Du-te la un Burger Shot pentru a vinde faina.", KG[i]);
                    SCM(i, COLOR_MONEY, string);
                    SCM(i, COLOR_WHITE, "Pentru a afla unde este un Burger Shot, foloseste comanda /locations.");
                    JobWorking[i] = 0;
                    PlayerTextDrawHide(i, JobTD);
                    if(JobVehicle[i] != 0) { DestroyVehicle(JobVehicle[i]); JobVehicle[i] = 0; }
                    PlayerTextDrawHide(i, InfosTD);
                    DisablePlayerCheckpointEx(i);
                    JobVehicle[i] = 0;                        
                }
            }
            else if(!PlayerToPoint(200, i, -379.0663,-1436.2332,25.7266)) {
                format(string, sizeof(string), "(!) Nu esti in zona de work~n~Intuarcete inapoi pentru a nu esua jobul.");
                PlayerTextDrawSetString(i, JobTD, string);
                PlayerTextDrawShow(i, JobTD);
                if(DaiWanted[i] == 0) DaiWanted[i] = 10;
            }
        }
        if(DaiWanted[i] > 0) {
            DaiWanted[i] --;
            if(DaiWanted[i] == 0) {
                if(JobWorking[i] == 0)
                    continue; 
                SCM(i, COLOR_GREY, "Job esuat! Ai parasit zona farm.");
                JobWorking[i] = 0;
                PlayerTextDrawHide(i, JobTD);
                if(JobVehicle[i] != 0) { DestroyVehicle(JobVehicle[i]); JobVehicle[i] = 0; }
                CP[i] = 0;
                JobVehicle[i] = 0;
                RemovePlayerAttachedObject(i, 2);
                if(playerObject[i] != 0) DestroyPlayerObject(i, playerObject[i]), playerObject[i] = 0;
                if(playerObject2[i] != 0) DestroyObject(playerObject2[i]), playerObject2[i] = 0;
                PlayerTextDrawHide(i, JobTD);
                PlayerTextDrawHide(i, InfosTD);
                RemovePlayerAttachedObject(i, 6);
                JobDeelay[i][PlayerInfo[i][pJob]] = 20;
                gLastCar[i] = 0;    
            }
        }

        GetPlayerHealthEx(i, ppHealth);
        GetPlayerArmourEx(i, ppArmour);
            
        if(PlayerInfo[i][pShowHP] != 0 && ppHealth >= 1)
        {
            format(string, sizeof(string), "%.0f", ppHealth);
            PlayerTextDrawSetString(i, CleoTD[0], string);
            PlayerTextDrawShow(i, CleoTD[0]);
            PlayerTextDrawColor(i, CleoTD[0], GetHudColor(PlayerInfo[i][pShowHP]));
        }
        else PlayerTextDrawHide(i, CleoTD[0]);

        if(PlayerInfo[i][pShowAP] != 0 && ppArmour >= 1)
        {
            format(string, sizeof(string), "%.0f", ppArmour);
            PlayerTextDrawSetString(i, CleoTD[1], string);
            PlayerTextDrawShow(i, CleoTD[1]);
            PlayerTextDrawColor(i, CleoTD[1], GetHudColor(PlayerInfo[i][pShowAP]));
        }
        else PlayerTextDrawHide(i, CleoTD[1]);
        
        PlayerInfo[i][pPayCheck] += ((PlayerInfo[i][pLevel]+1) * 2);
        
        if(PlayerInfo[i][pJailed] > 0) {
            if(PlayerInfo[i][pJailTime] > 0) {
                if(IsPlayerLogged[i] == 1) {
                    PlayerInfo[i][pJailTime]--;
                    TextDrawShowForPlayer(i, Jailtime[i]);
                    if(PlayerInfo[i][pJailTime]/60 > 1) format(string, sizeof(string), "Jail time: ~r~%d minute", PlayerInfo[i][pJailTime]/60);
                    else if(PlayerInfo[i][pJailTime]/60 == 1) format(string, sizeof(string), "Jail time: ~r~%d minut", PlayerInfo[i][pJailTime]/60);
                    else if(PlayerInfo[i][pJailTime]/60 == 0) format(string, sizeof(string), "Jail time: ~r~%d secunde", PlayerInfo[i][pJailTime]);
                    TextDrawSetString(Jailtime[i], string);
                }
            }
            if(PlayerInfo[i][pJailTime] <= 0) {
                PlayerInfo[i][pJailTime] = 0;
                if(PlayerInfo[i][pJailed] == 1) {
                    PutPlayerInJail(i);
                }
                PlayerInfo[i][pJailed] = 0;
                Update(i, pJailTimex);
                Update(i, pJailedx);
                SetPlayerPos(i, 1553.2947,-1675.3005,16.1953);
                SetPlayerVirtualWorld(i, 0);
                SetPlayerInterior(i, 0);
                SetPlayerSpecialAction(i,SPECIAL_ACTION_NONE);
                RemovePlayerAttachedObject(i,1);
                TextDrawHideForPlayer(i, Jailtime[i]);
                if(PlayerInfo[i][pChar] > 0) SetPlayerSkinEx(i, PlayerInfo[i][pChar]); 
                else SetPlayerSkinEx(i, PlayerInfo[i][pModel]);
                ClearCrime(i);
                PlayerInfo[i][pAJail] = 0;
                UpdateVar(i, "AJail", 0);
                SetPlayerToTeamColor(i);
                TogglePlayerControllable(i, 1);
            }
        }
        if(PlayerInfo[i][pMuted] > 0) {
            if(PlayerInfo[i][pMuteTime] > 0) PlayerInfo[i][pMuteTime]--;
            if(PlayerInfo[i][pMuteTime] <= 0){
                PlayerInfo[i][pMuteTime] = 0;
                SCM(i, COLOR_GREY, "You have now been automatically unmuted.");
                PlayerInfo[i][pMuted] = 0;
            }
        }
        if(targetfind[i] >= 0 && UsedFind[i] == 1) {
            new target, j;
            target = targetfind[i];
            if(Spectate[target] != 255) {
                PlayerTextDrawHide(i, FindTD);
                PlayerTextDrawHide(i, FindSkinTD);
                DisablePlayerCheckpointEx(i);
                SCM(i, COLOR_YELLOW, "Acel admin este ocupat! Checkpoint dezactivat.");
                targetfind[i] = -1;
                CP[i] = 0;
                UsedFind[i] = 0;    
            }
            else {
                if(InBussines[target] > 0) {
                    j = InBussines[target];
                    SetPlayerCheckpointEx(i,BizzInfo[j][bEntranceX], BizzInfo[j][bEntranceY], BizzInfo[j][bEntranceZ],4);
                    format(szTD, sizeof(szTD), "~r~%s [%d]~n~~w~~h~distance: ~y~~h~%0.1fm ~n~~b~~h~[%s]", GetName(targetfind[i]), targetfind[i], GetPlayerDistanceFromPoint(i, BizzInfo[j][bEntranceX], BizzInfo[j][bEntranceY], BizzInfo[j][bEntranceZ]), GetCity(target));
                    PlayerTextDrawSetString(i, FindTD, szTD);
                    PlayerTextDrawShow(i, FindTD);
                }
                else if(InHouse[target] > 0) {
                    j = InHouse[target];
                    SetPlayerCheckpointEx(i,HouseInfo[j][hEntrancex],HouseInfo[j][hEntrancey],HouseInfo[j][hEntrancez],4);
                    format(szTD, sizeof(szTD), "~r~%s [%d]~n~~w~~h~distance: ~y~~h~%0.1fm ~n~~b~~h~[%s]", GetName(targetfind[i]), targetfind[i], GetPlayerDistanceFromPoint(i, HouseInfo[j][hEntrancex],HouseInfo[j][hEntrancey],HouseInfo[j][hEntrancez]), GetCity(target));
                    PlayerTextDrawSetString(i, FindTD, szTD);
                    PlayerTextDrawShow(i, FindTD);
                }
                else if(InHQ[target] != -1) {
                    j = InHQ[target]-1;
                    SetPlayerCheckpointEx(i,DynamicFactions[j][fcX],DynamicFactions[j][fcY],DynamicFactions[j][fcZ],4);
                    format(szTD, sizeof(szTD), "~r~%s [%d]~n~~w~~h~distance: ~y~~h~%0.1fm ~n~~b~~h~[%s]", GetName(targetfind[i]), targetfind[i], GetPlayerDistanceFromPoint(i, DynamicFactions[j][fcX],DynamicFactions[j][fcY],DynamicFactions[j][fcZ]), GetCity(target));
                    PlayerTextDrawSetString(i, FindTD, szTD);
                    PlayerTextDrawShow(i, FindTD);
                }
                else {
                    GetPlayerPos(target,x,y,z);
                    SetPlayerCheckpointEx(i,x,y,z,4);
                    format(szTD, sizeof(szTD), "~r~%s [%d]~n~~w~~h~distance: ~y~~h~%0.1fm ~n~~b~~h~[%s]", GetName(targetfind[i]), targetfind[i], GetPlayerDistanceFromPoint(i, x,y,z), GetCity(target));
                    PlayerTextDrawSetString(i, FindTD, szTD);
                    PlayerTextDrawShow(i, FindTD);
                }
            }
        }
        
        if(PlayerTazeTime[i] >= 1) {
            PlayerTazeTime[i] += 1;
            if(PlayerTazeTime[i] == 15) PlayerTazeTime[i] = 0;
            else {
                new Float:angle;
                GetPlayerFacingAngle(i, angle);
                SetPlayerFacingAngle(i, angle + 90);
            }
        }
        if(PlayerDrunk[i] >= 5) {
            PlayerDrunkTime[i] += 1;
            if(PlayerDrunkTime[i] == 😎 {
                PlayerDrunkTime[i] = 0;
                LoopingAnim(i,"PED","WALK_DRUNK",4.0,1,1,1,1,0);
                SetPlayerDrunkLevel (i, 5000);
            }
        }
        
        if(PlayerStoned[i] >= 2) SetPlayerDrunkLevel (i, 5000);
        
        if(IsSmoking[i] > 0) {
            if(IsSmoking[i] == 0) {
                format(string, sizeof(string), "* %s a terminat de fumat tigara.", GetName(i));
                ProxDetector(30.0, i, string, COLOR_PURPLE);
                new Float: PlayerHealth;
                GetPlayerHealthEx(i, PlayerHealth);
                if(PlayerHealth >= 93) SetPlayerHealthEx(i, 99);
                else SetPlayerHealthEx(i, PlayerHealth+6);
            }
            IsSmoking[i] -= 1;
        }
        if(PlayerCuffed[i] == 1) {
            if(PlayerCuffedTime[i] <= 0) {
                TogglePlayerControllable(i, 1);
                PlayerCuffed[i] = 0;
                PlayerCuffedTime[i] = 0;
                PlayerTazeTime[i] = 1;
            }
            else PlayerCuffedTime[i] -= 1;
        }

        if(PlayerCuffed[i] == 2) {
            if(PlayerCuffedTime[i] <= 0) {
                GameTextForPlayer(i, "~r~~h~Esti liber acum!", 2500, 3);
                TogglePlayerControllable(i, 1);
                PlayerCuffed[i] = 0;
                PlayerCuffedTime[i] = 0;
            }
            else PlayerCuffedTime[i] -= 1;
        }
        
        if(IsAMember(i)) {
            if(InWar[PlayerInfo[i][pMember]] == 1) {    
                new faction = PlayerInfo[i][pMember];
                for(new wi = 1; wi < sizeof(TurfInfo);wi++) {
                    if((WarInfo[wi][wFaction] == faction) || (WarInfo[wi][wAttacker] == faction)) {
                        new attackers = WarInfo[wi][wAttacker];
                        new defenders = WarInfo[wi][wFaction];
                        new uciderii = 0;
                        uciderii += ucideri[i][wi];
                        new decesee = 0;
                        decesee += decese[i][wi];
                        new Float: atscore = 0.0;
                        new Float: defscore = 0.0;
                        atscore = WarScoreF[attackers][wi];
                        defscore = WarScoreF[defenders][wi];                        
                
                        if(playerDeath[i] == -1 && GetPlayerInterior(i) == 0 && IsAMember(i) && GetPlayerVirtualWorld(i) == 0 && PlayerInfo[i][pWantedLevel] == 0 && PlayerInfo[i][pJailTime] == 0) {                            
                            SetPlayerVirtualWorld(i, wi);
                            format(string, sizeof(string), "Ai fost teleportat in virtual world-ul %d deoarece mafia ta este intr-un war.", wi);
                            SCM(i, COLOR_YELLOW, string);
                        }

                        if(WarInfo[wi][wFaction] == faction)
                        {
                            format(string, sizeof(string), "Turf: %s (%d)~n~%s %.1f - %.1f %s~n~Ucideri: %d Decese: %d Scor: %d~n~Secunde pe turf: %d~n~Timp war: ~y~~h~%s~w~~h~",
                            TurfInfo[wi][zName],wi,FactionName(attackers),atscore,defscore,FactionName(defenders),
                            uciderii, decesee, uciderii-decesee, WarSeconds[i], CalculeazaTimp2(WarInfo[wi][wTime]));
                        }
                        if(WarInfo[wi][wAttacker] == faction)
                        {
                            format(string, sizeof(string), "Turf: %s (%d)~n~%s %.1f - %.1f %s~n~Ucideri: %d Decese: %d Scor: %d~n~Secunde pe turf: %d~n~Timp war: ~y~~h~%s~w~~h~",
                            TurfInfo[wi][zName],wi,FactionName(attackers),atscore,defscore,FactionName(defenders),
                            uciderii, decesee, uciderii-decesee, WarSeconds[i], CalculeazaTimp2(WarInfo[wi][wTime]));
                        }                            
                    }
                }
                PlayerTextDrawSetString(i, WarTime, string);
                PlayerTextDrawShow(i, WarTime);                            
            }                
        
            if(IsPlayerInTurf(i, InWarTurf[PlayerInfo[i][pMember]])) {
                new turf = InWarTurf[PlayerInfo[i][pMember]];
                if(WarInfo[turf][wFaction] == PlayerInfo[i][pMember] || WarInfo[turf][wAttacker] == PlayerInfo[i][pMember]) {
                    if(IsPlayerPaused(i) == false) WarSeconds[i] ++;
                    if(TurfTime[i] == 0 && IsPlayerInAnyVehicle(i)) SCM(i, COLOR_YELLOW, "Ai intrat pe teritoriu. Peste 10 secunde o sa fii dat jos din vehicul.");
                    if(TurfTime[i] < 10) TurfTime[i] ++;
                    if(TurfTime[i] == 10) {
                        if(IsPlayerInAnyVehicle(i)) {
                            new Float: Pos[3];
                            GetPlayerPos(i, Pos[0], Pos[1], Pos[2]);
                            SetPlayerPosEx(false, i, Pos[0], Pos[1], Pos[2]+1);
                        }
                    }
                }
            }            
        }                
    }    
    for(new i = 0; i < 3; i++) {
        if(PaintTime[i] == 0) {
            PaintTime[i] = -1; PaintText[i] = 60;
        }    
    }        
    OtherTimer();
    return true;
}

Link to comment
Share on other sites

  • 0

Iti recomand sa gandesti sistemul altfel, o sa-ti las un exemplu mai jos de la care poti porni la ceva mai complex:
1. creeaza o enumeratie pentru a stoca fiecare radar in parte

enum radars {
	radarID,
	Float:radarRadius,
	Float:radarPositionX,
	Float:radarPositionY,
	Float:radarPositionZ,
	radarPlacer, // player id
	radarLimit, // limita in km/h
}

2. defineste variabilele pe care le vei folosi
 

new server_radars[10][radars], // pe server sa poata exista maxim 10 radare
	Iterator:sv_radars<10>; // definim iteratorul pentru radare

new placed_radar[MAX_PLAYERS], // aici definim variabila care stocheaza ID-ul radar-ului plasat de catre jucator
	radar_delay[MAX_PLAYERS]; // delay /radar

3. creeaza o functie prin care inserezi un radar
 

stock PlaceRadar(playerid, Float:radius, limit) {
	new i = Iter_Free(sv_radars);

	server_radars[i][radarID] = i+1;
	server_radars[i][radarRadius] = radius;

	new Float:X, Float:Y, Float:Z;
	GetPlayerPos(playerid, X, Y, Z);

	server_radars[i][radarPositionX] = X;
	server_radars[i][radarPositionY] = Y;
	server_radars[i][radarPositionZ] = Z;

	server_radars[i][radarPlacer] = i;
	server_radars[i][radarLimit] = limit;

	Iter_Add(sv_radars, server_radars[i][radarID]);

	return SCM(playerid, -1, "Radar %d placed (%d km/h) - radius: %0.1fm.", server_radars[i][radarID], limit, radius);
}

4. creeaza o alta functie prin care stergi radarul jucatorului:

stock DestroyRadar(playerid) {
	if(placed_radar[playerid] > 0) {
		new r = placed_radar[playerid];

		server_radars[r][radarRadius] = 0.0;
		server_radars[r][radarPositionX] = server_radars[r][radarPositionY] = server_radars[r][radarPositonZ] = 0.0;
		server_radars[r][radarPlacer] = INVALID_PLAYER_ID;
		server_radars[r][radarLimit] = 0;
		Iter_Remove(sv_radars, r);

		placed_radar[playerid] = 0;
		radar_delay[playerid] = 0;
	}
	return 1;
}

5. la conectare apeleaza functia DestroyRadar
6. comanda /placeradar:

YCMD:placeradar(playerid, params[], help) { 
	// aici pui tu verificarile daca e copoi

	if(radar_delay[playerid] > gettime()) return SCM(playerid, -1, "Poti folosi aceasta comanda din nou peste %d secunde.", radar_delay[playerid]-gettime());
	if(placed_radar[playerid] != 0) return SCM(playerid, -1, "Ai deja un radar plasat!");
	if(Iter_Count(sv_radars) >= 10) return SCM(playerid, -1, "Eroare: Pot fi maxim 10 radare deodata pe server.");

	new radius, limit;
	if(sscanf(params, "dd", radius, limit)) return SCM(playerid, -1, "/placeradar [raza] [limita de viteza]");
	if(radius < 100 || radius > 300) return SCM(playerid, -1, "Eroare: Raza de actiune trebuie sa fie cuprinsa intre 100 si 300 metri.");
	if(limit < 60 || limit > 200) return SCM(playerid, -1, "Eroare: Limita de viteza trebuie sa fie cuprinsa intre 60 si 200 km/h.");

	PlaceRadar(playerid, radius, limit);
	radar_delay[playerid] = gettime() + 45;

	// pui tu un mesaj de ex care anunta politistii de pe server ca a pus x radar
	return 1;
}

7. in final, timerul pentru verificarea vitezei:

ptask check_radar[1000](playerid) {
	if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER && placed_radar[playerid] == 0) { // verificam daca e intr-un vehicul ca sofer si sa nu-l ia radaru' in caz de el l-a pus
		new speed = Carspeed(playerid);
		foreach(new r : sv_radars) {
			if(IsPlayerInRangeOfPoint(playerid, server_radars[r][radarRadius], server_radars[r][radarPositionX], server_radars[r][radarPositionY], server_radars[r][radarPositionZ])) {
				if((speed+10) >= server_radars[r][radarLimit]) { // verificam daca limita de viteza este incalcata cu minim 10km/h
					// si aici pui sa-l ia radaru'
				}
			}
		}
	}
}

Sper sa te ajute si sa nu fie probleme (n-am testat, am gandit pe loc chestia). Succes!

Edited by irinel77
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.