Szerző Téma: OnPlayerUpdate  (Megtekintve 1261 alkalommal)

Nem elérhető Sramm

  • 596
    • Profil megtekintése
OnPlayerUpdate
« Dátum: 2012. December 31. - 16:49:06 »
0 Show voters
Hello!
Azt szeretném kérdezni, hogy van -e arra valamilyen plugin, hogy az OnPlayerUpdate helyett valami kíméletesebb módon lehessen folyamatosan ellenõrizni a játékost. Mert elég sok cucc van nálunk alatta, és olyan ping laggok szoktak lenni, hogy már fáj. Ötlet?

Nem elérhető Flash

  • 5726
  • (っ◕‿◕)っ
    • Profil megtekintése
OnPlayerUpdate
« Válasz #1 Dátum: 2012. December 31. - 16:59:51 »
0 Show voters
timer

OnPlayerUpdate
« Válasz #2 Dátum: 2012. December 31. - 17:41:36 »
0 Show voters
Nem kell hozzá plugin, egyszerûen használd a SetTimerEx funkciót. a wiki.sa-mp.com-on leirja, hogy kell.
 
Idézetet írta: Flash date=1356969591\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"31726\" data-ipsquote-contentclass=\"forums_Topic
timer
 

Nem elérhető Sramm

  • 596
    • Profil megtekintése
OnPlayerUpdate
« Válasz #3 Dátum: 2012. December 31. - 17:54:33 »
0 Show voters
Arra rájöttem én is, de a nagyon gyors timer jobban lassítja.

OnPlayerUpdate
« Válasz #4 Dátum: 2012. December 31. - 21:09:52 »
0 Show voters
Idézetet írta: Sramm date=1356972873\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"31726\" data-ipsquote-contentclass=\"forums_Topic
Arra rájöttem én is, de a nagyon gyors timer jobban lassítja.
 
De viszont ha nagyon sok kód van benne, akkor leáll a játékosfrissités, de ha timerben csinálod, akkor nem.

Nem elérhető DrAkE

  • 2078
    • Profil megtekintése
OnPlayerUpdate
« Válasz #5 Dátum: 2012. December 31. - 21:14:37 »
0 Show voters
Mik vannak alatta, hogy ennyire belaggosítja?

Nem elérhető Sramm

  • 596
    • Profil megtekintése
OnPlayerUpdate
« Válasz #6 Dátum: 2013. Január 01. - 16:42:27 »
0 Show voters
public OnPlayerUpdate(playerid)
{
if(InPick[playerid] == 1)
{
    if(!IsPlayerInRangeOfPoint(playerid,2.0,pickp[0],pickp[1],pickp[2]))
    {
        InPick[playerid] = 0;
}
}
if(trafi[playerid][0] == 1)
{
    new Float:xt,Float:yt,Float:zt;
    GetPlayerPos(playerid,xt,yt,zt);
 foreach(Player, p)
   {
   if(p != playerid)
   {
      if(IsPlayerInRangeOfPoint(p, 10.0, xt, yt, zt))
      {
         if(IsPlayerInAnyVehicle(playerid))
         {
                    new vid = GetPlayerVehicleID(p);
            if(GetVehicleSpeed(vid) > trafi[playerid][1])
            {
                if(trafizva[playerid] != 1)
                {
                    TextDrawShowForPlayer(p,flash);
                    SetTimerEx(\"RemoveFlash\",1200,false,\"i\",p);
                  SendClientMessage(p, Red, \" - | Lekapott a trafipax! | -\");
                  SendFormattedMessage(p,HSARGA, \"- | Sebességed: %d km/h | Megengedett sebesség: %d km/h | Bírság: %d Ft | -\", GetVehicleSpeed(vid), trafi[playerid][1], GetPlayerBirsag(GetVehicleSpeed(vid)));
                  SendClientMessage(p, Red, \"- | -------------------- | -\");
                  GivePlayerMoney(p, -GetPlayerBirsag(GetVehicleSpeed(vid)));
                  trafizva[playerid] = 1;
                  SendFormattedMessage(playerid,HSARGA,\"Valakit sikerült lekapnod! Fizetésedhez hozzáadva: %d Ft\",GetPlayerBirsag(GetVehicleSpeed(vid)));
                           PlayerInfo[playerid][pFizu] += GetPlayerBirsag(GetVehicleSpeed(vid));
                           SetTimerEx(\"Trafile\",minute(2),0,\"i\",playerid);
               }
            }
         }
      }
   }
}
    }
if(jobbgomb[playerid] == 1)
{
    new wid = GetPlayerWeapon(playerid);
    for(new NPCID; NPCID < MAX_PLAYERS; NPCID++)
    {
        if(IsPlayerNPC(NPCID))
        {
      if(wid > 10)
      {
          if(KilledNPC[NPCID] == 0)
         {
              if(IsPlayerFacingPlayer(playerid,NPCID,10) == 1)
              {
                          if(kezfent[NPCID] != 1)
               {
                  ApplyAnimation(NPCID,\"ped\",\"handsup\",4.1,0,1,1,1,0);
                  kezfent[NPCID] = 1;
               }
             }
             else
             {
                   ClearAnimations(NPCID);
                         kezfent[NPCID] = 0;
            }
         }
      }
   }
}
}
 new Float:hp;
    GetPlayerHealth(playerid, hp);
new vehicleid = GetPlayerVehicleID(playerid);
    if(vehicleid)
    {
        GetVehicleHealth(vehicleid, hp);
        if(hp != vhealth[playerid])
        {
                if(hp < vhealth[playerid]) OnVehicleLoseHealth(playerid, vehicleid, floatround(vhealth[playerid] - hp));
                vhealth[playerid] = hp;
        }
        GetVehicleVelocity(vehicleid, velX[playerid], velY[playerid], velZ[playerid]);
    }
if(tazerkezbe[playerid] == 1)
{
if(GetPlayerWeapon(playerid) != 0)
{
   RemovePlayerAttachedObject(playerid, 5);
}
else
{
    if(!IsPlayerAttachedObjectSlotUsed(playerid,5))
   {
       SetPlayerAttachedObject(playerid, 5,18642, 5, 0.12, 0.02, -0.05, 0, 0, 45,1,1,1);
   }
}
}
 
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
    if(sebesseg[playerid] != 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(GetVehicleSpeed(vid) > sebesseg[playerid]/2)
          {
          SetVehicleSpeed(vid, sebesseg[playerid]/2);
   }
}
}
    GetPlayerHealth(playerid,gTmp);
     if(pOldHealth[playerid]>gTmp)
     {
       FadeColorForPlayer(playerid,255,0,0,floatround(pOldHealth[playerid]-gTmp)*10,255,0,0,0,floatround(pOldHealth[playerid]-gTmp),0);
     }
     pOldHealth[playerid]=gTmp;
     if(IsPlayerInAnyVehicle(playerid))
     {
       GetVehicleVelocity(GetPlayerVehicleID(playerid),gtemp[0],gtemp[1],gtemp[2]);
       gtemp[3]=floatsqroot( floatmul(gtemp[0],gtemp[0])+floatmul(gtemp[1],gtemp[1])+floatmul(gtemp[2],gtemp[2]) )*100;
       if(vSpeed[playerid]-gtemp[3]>20)FadeColorForPlayer(playerid,255,0,0,(floatround(vSpeed[playerid]-gtemp[3])-20)*3,255,0,0,0,floatround(vSpeed[playerid]-gtemp[3])-20,0);
       vSpeed[playerid]=gtemp[3];
     }
new Float:armour[MAX_PLAYERS];
GetPlayerArmour(playerid, armour[playerid]);
if(!IsPlayerNPC(playerid))
{
if( armour[playerid] > 0.0 )
{
   SetPlayerAttachedObject( playerid, ARMOUR_INDEX, 19142, 1, 0.085266, 0.042019, -0.000281, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 ); // SWATArmour1 - 2
}
else if( armour[playerid] == 0.0 && IsPlayerAttachedObjectSlotUsed(playerid, ARMOUR_INDEX))
{
   RemovePlayerAttachedObject(playerid, ARMOUR_INDEX); // armour
}
}
if(GetTickCount() - armedbody_pTick[playerid] > 113)
{
//prefix check itter
new
weaponid[13],weaponammo[13],pArmedWeapon;
pArmedWeapon = GetPlayerWeapon(playerid);
GetPlayerWeaponData(playerid,1,weaponid[1],weaponammo[1]);
GetPlayerWeaponData(playerid,2,weaponid[2],weaponammo[2]);
GetPlayerWeaponData(playerid,4,weaponid[4],weaponammo[4]);
GetPlayerWeaponData(playerid,5,weaponid[5],weaponammo[5]);
#if ARMEDBODY_USE_HEAVY_WEAPON
GetPlayerWeaponData(playerid,7,weaponid[7],weaponammo[7]);
#endif
if(weaponid[1] && weaponammo[1] > 0)
{
   if(pArmedWeapon != weaponid[1])
   {
      if(!IsPlayerAttachedObjectSlotUsed(playerid,0))
      {
         SetPlayerAttachedObject(playerid,0,GetWeaponModel(weaponid[1]),1, 0.199999, -0.139999, 0.030000, 0.500007, -115.000000, 0.000000, 1.000000, 1.000000, 1.000000);
      }
   }
   else
   {
      if(IsPlayerAttachedObjectSlotUsed(playerid,0))
      {
         RemovePlayerAttachedObject(playerid,0);
      }
   }
}
else if(IsPlayerAttachedObjectSlotUsed(playerid,0))
{
   RemovePlayerAttachedObject(playerid,0);
}
if(weaponid[2] && weaponammo[2] > 0)
{
   if(pArmedWeapon != weaponid[2])
   {
      if(!IsPlayerAttachedObjectSlotUsed(playerid,1))
      {
         SetPlayerAttachedObject(playerid,1,GetWeaponModel(weaponid[2]),8, -0.079999, -0.039999, 0.109999, -90.100006, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000);
      }
   }
   else
   {
      if(IsPlayerAttachedObjectSlotUsed(playerid,1))
      {
         RemovePlayerAttachedObject(playerid,1);
      }
   }
}
else if(IsPlayerAttachedObjectSlotUsed(playerid,1))
{
   RemovePlayerAttachedObject(playerid,1);
}
if(weaponid[4] && weaponammo[4] > 0)
{
   if(pArmedWeapon != weaponid[4])
   {
      if(!IsPlayerAttachedObjectSlotUsed(playerid,2))
      {
         SetPlayerAttachedObject(playerid,2,GetWeaponModel(weaponid[4]),7, 0.000000, -0.100000, -0.080000, -95.000000, -10.000000, 0.000000, 1.000000, 1.000000, 1.000000);
      }
   }
   else
   {
      if(IsPlayerAttachedObjectSlotUsed(playerid,2))
      {
         RemovePlayerAttachedObject(playerid,2);
      }
   }
}
else if(IsPlayerAttachedObjectSlotUsed(playerid,2))
{
   RemovePlayerAttachedObject(playerid,2);
}
if(weaponid[5] && weaponammo[5] > 0)
{
   if(pArmedWeapon != weaponid[5])
   {
      if(!IsPlayerAttachedObjectSlotUsed(playerid,3))
      {
         SetPlayerAttachedObject(playerid,3,GetWeaponModel(weaponid[5]),1, 0.200000, -0.119999, -0.059999, 0.000000, 206.000000, 0.000000, 1.000000, 1.000000, 1.000000);
      }
   }
   else
   {
      if(IsPlayerAttachedObjectSlotUsed(playerid,3))
      {
         RemovePlayerAttachedObject(playerid,3);
      }
   }
}
else if(IsPlayerAttachedObjectSlotUsed(playerid,3))
{
   RemovePlayerAttachedObject(playerid,3);
}
#if ARMEDBODY_USE_HEAVY_WEAPON
if(weaponid[7] && weaponammo[7] > 0)
{
   if(pArmedWeapon != weaponid[7])
   {
      if(!IsPlayerAttachedObjectSlotUsed(playerid,4))
      {
         SetPlayerAttachedObject(playerid,4,GetWeaponModel(weaponid[7]),1,-0.100000, 0.000000, -0.100000, 84.399932, 112.000000, 10.000000, 1.099999, 1.000000, 1.000000);
      }
   }
   else
   {
      if(IsPlayerAttachedObjectSlotUsed(playerid,4))
      {
         RemovePlayerAttachedObject(playerid,4);
      }
   }
}
else if(IsPlayerAttachedObjectSlotUsed(playerid,4))
{
   RemovePlayerAttachedObject(playerid,4);
}
#endif
armedbody_pTick[playerid] = GetTickCount();
}
new Float:health[MAX_PLAYERS];
GetPlayerHealth(playerid,health[playerid]);
if(health[playerid] < 3)
{
SetPlayerHealth(playerid,0);
SetPlayerHealth(playerid,5);
SetPlayerHealth(playerid,0);
}
    new penz[16];
format(penz, 16, \"Ft %08d\", PlayerInfo[playerid][pMoney]);
PlayerTextDrawSetString(playerid,PenzBox[playerid], penz);
return 1;
}

 
És van egy 1mp-s timer is:
 
public CheckPlayers()
{
foreach(Player, i)
{
    new Float:x,Float:y,Float:z;
new Float:x1,Float:y1,Float:z1;
new drogos = GetPlayerID(\"Drogos_Gyalogos\");
new boltos = GetPlayerID(\"Charlotte_Topkins\");
GetPlayerPos(drogos,x,y,z);
GetPlayerPos(boltos,x1,y1,z1);
    new playerid = i;
    if(GetPlayerMoneyEx(playerid)>10)
{
   new msg[128];
   format(msg,128,\"%st bannolta a rendszer.Indok: Pénz Cheat!\",GetName(playerid));
   SendClientMessageToAll(HPIROS,msg);
   PlayerInfo[playerid][pLock]=1;
   print(msg);
   BanEx(playerid,\"Pénz Cheat\");
}
        Antiweap_ON(playerid);
if(PlayerInfo[playerid][pMission] != 0 && PlayerInfo[playerid][pMission] != 5 && PlayerInfo[playerid][pMission] != 3 && PlayerInfo[playerid][pMission] != 4)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
   {
          if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
      {
          PlayerInfo[playerid][pMission] = 5;
          DestroyVehicle(ktrailer[playerid]);
          SendClientMessage(playerid, Red, \"Elhagytad a pótkocsid! A küldetés véget ért, vidd vissza a kamiont a helyére!\");
          SetPlayerCheckpoint(playerid,1082.0374,-297.3177,74.5982,7);
      }
   }
}
if(GetPlayerSpeed(playerid)>165)
{
   new speed=GetPlayerSpeed(playerid);
   new mig[128];
   format(mig,128,\"[ADMINOK FIGYELEM] %s elért sebessége || %dKM/H || nézz utána!! ( /Spec %d )\",GetName(playerid),speed,playerid);
   SAM(1,mig);
   print(mig);
}
if(!IsPlayerNPC(playerid))
{
   if(IsPlayerConnected(playerid))
   {
       if(KilledNPC[playerid] != 1)
       {
         if(IsPlayerInRangeOfPoint(playerid,2.0,x,y,z))
         {
            if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1)
            {
               if(drogosnale[playerid] == 0)
               {
                  ProxDetector(5.0, drogos, \"Mike Reyley mondja: Jónapot uram! Egzotikus illatszereket árulok, most jöttem fel friss levegõt szívni! Remélem nem baj.\", COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
                  SetPlayerChatBubble(drogos, \"Jónapot uram! Egzotikus illatszereket árulok, most jöttem fel friss levegõt szívni! Remélem nem baj.\", COLOR_WHITE, 5.0, 7000);
                  drogosnale[playerid] = 1;
                  SetTimerEx(\"dumanpc\",minute(1),0,\"i\",playerid);
               }
               return 1;
            }
            if(drogosnale[playerid] == 0)
            {
               drogosnale[playerid] = 1;
               ProxDetector(5.0, drogos, \"Mike Reyley mondja: Na mivan tesa, mi kéne? ((/drogvesz))\", COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
               SetPlayerChatBubble(drogos, \"Na mivan tesa, kéne egy kis cuccos? Nálam megkapod!\", COLOR_WHITE, 5.0, 7000);
               SetTimerEx(\"dumanpc\",minute(1),0,\"i\",playerid);
            }
            return 1;
         }
      }
   }
}
if(PlayerInfo[playerid][pRpWarn]>4)
{
   HU(playerid,FEHER,\"Bannolva lettél mivel nem tudod az RP szabályokat.\");
   HU(playerid,ZOLD,\"Vedd fel az adminokkal a kapcsolatot, és kérj unbannt.\");
   HU(playerid,PIROS,\"Tanuld meg a szabályokat.\");
   BanEx(playerid,\"Warnok\");
   return 1;
}
}
return 1;
}

Nem elérhető Casamiro

  • 1046
    • Profil megtekintése
OnPlayerUpdate
« Válasz #7 Dátum: 2013. Január 01. - 16:52:45 »
0 Show voters
Így próbáld meg:

public OnPlayerUpdate(playerid)
{
        if(InPick[playerid] == 1)
        {
            if(!IsPlayerInRangeOfPoint(playerid,2.0,pickp[0],pickp[1],pickp[2]))
            {
                InPick[playerid] = 0;
                }
        }
        if(trafi[playerid][0] == 1)
        {
            new Float:xt,Float:yt,Float:zt;
            GetPlayerPos(playerid,xt,yt,zt);
                 foreach(Player, p)
                        {
                        if(p != playerid)
                        {
                                if(IsPlayerInRangeOfPoint(p, 10.0, xt, yt, zt))
                                {
                                        if(IsPlayerInAnyVehicle(playerid))
                                        {
                            new vid = GetPlayerVehicleID(p);
                                                if(GetVehicleSpeed(vid) > trafi[playerid][1])
                                                {
                                                    if(trafizva[playerid] != 1)
                                                    {
                                                        TextDrawShowForPlayer(p,flash);
                                                        SetTimerEx(\"RemoveFlash\",1200,false,\"i\",p);
                                                                SendClientMessage(p, Red, \" - | Lekapott a trafipax! | -\");
                                                                SendFormattedMessage(p,HSARGA, \"- | Sebességed: %d km/h | Megengedett sebesség: %d km/h | Bírság: %d Ft | -\", GetVehicleSpeed(vid), trafi[playerid][1], GetPlayerBirsag(GetVehicleSpeed(vid)));
                                                                SendClientMessage(p, Red, \"- | -------------------- | -\");
                                                                GivePlayerMoney(p, -GetPlayerBirsag(GetVehicleSpeed(vid)));
                                                                trafizva[playerid] = 1;
                                                                SendFormattedMessage(playerid,HSARGA,\"Valakit sikerült lekapnod! Fizetésedhez hozzáadva: %d Ft\",GetPlayerBirsag(GetVehicleSpeed(vid)));
                                        PlayerInfo[playerid][pFizu] += GetPlayerBirsag(GetVehicleSpeed(vid));
                                        SetTimerEx(\"Trafile\",minute(2),0,\"i\",playerid);
                                                        }
                                                }
                                        }
                                }
                        }
                }
    }
        if(jobbgomb[playerid] == 1)
        {
            new wid = GetPlayerWeapon(playerid);
            if(wid > 10)
            {
                for(new NPCID; NPCID < MAX_PLAYERS; NPCID++)
                {
                    if(!IsPlayerConnected(NPCID) || !IsPlayerNPC(NPCID)) continue;
                    if(KilledNPC[NPCID] == 0)
                    {
                        if(IsPlayerFacingPlayer(playerid,NPCID,10) == 1)
                        {
                            if(kezfent[NPCID] != 1)
                            {
                                 ApplyAnimation(NPCID,\"ped\",\"handsup\",4.1,0,1,1,1,0);
                                 kezfent[NPCID] = 1;
                            }
                         }
                         else
                         {
                              ClearAnimations(NPCID);
                              kezfent[NPCID] = 0;
                         }
                    }
                }
            }
        }
         new Float:hp;
    GetPlayerHealth(playerid, hp);
        new vehicleid = GetPlayerVehicleID(playerid);
    if(vehicleid)
    {
        GetVehicleHealth(vehicleid, hp);
        if(hp != vhealth[playerid])
        {
                if(hp < vhealth[playerid]) OnVehicleLoseHealth(playerid, vehicleid, floatround(vhealth[playerid] - hp));
                vhealth[playerid] = hp;
        }
        GetVehicleVelocity(vehicleid, velX[playerid], velY[playerid], velZ[playerid]);
    }
        if(tazerkezbe[playerid] == 1)
        {
                if(GetPlayerWeapon(playerid) != 0)
                {
                        RemovePlayerAttachedObject(playerid, 5);
                }
                else
                {
                    if(!IsPlayerAttachedObjectSlotUsed(playerid,5))
                        {
                            SetPlayerAttachedObject(playerid, 5,18642, 5, 0.12, 0.02, -0.05, 0, 0, 45,1,1,1);
                        }
                }
        }
 
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            if(sebesseg[playerid] != 0)
            {
                new vid = GetPlayerVehicleID(playerid);
                if(GetVehicleSpeed(vid) > sebesseg[playerid]/2)
                {
                        SetVehicleSpeed(vid, sebesseg[playerid]/2);
                        }
                }
        }
    GetPlayerHealth(playerid,gTmp);
        if(pOldHealth[playerid]>gTmp)
        {
        FadeColorForPlayer(playerid,255,0,0,floatround(pOldHealth[playerid]-gTmp)*10,255,0,0,0,floatround(pOldHealth[playerid]-gTmp),0);
        }
        pOldHealth[playerid]=gTmp;
        if(IsPlayerInAnyVehicle(playerid))
        {
        GetVehicleVelocity(GetPlayerVehicleID(playerid),gtemp[0],gtemp[1],gtemp[2]);
        gtemp[3]=floatsqroot( floatmul(gtemp[0],gtemp[0])+floatmul(gtemp[1],gtemp[1])+floatmul(gtemp[2],gtemp[2]) )*100;
        if(vSpeed[playerid]-gtemp[3]>20)FadeColorForPlayer(playerid,255,0,0,(floatround(vSpeed[playerid]-gtemp[3])-20)*3,255,0,0,0,floatround(vSpeed[playerid]-gtemp[3])-20,0);
        vSpeed[playerid]=gtemp[3];
        }
        new Float:armour[MAX_PLAYERS];
        GetPlayerArmour(playerid, armour[playerid]);
        if(!IsPlayerNPC(playerid))
        {
                if( armour[playerid] > 0.0 )
                {
                        SetPlayerAttachedObject( playerid, ARMOUR_INDEX, 19142, 1, 0.085266, 0.042019, -0.000281, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 ); // SWATArmour1 - 2
                }
                else if( armour[playerid] == 0.0 && IsPlayerAttachedObjectSlotUsed(playerid, ARMOUR_INDEX))
                {
                        RemovePlayerAttachedObject(playerid, ARMOUR_INDEX); // armour
                }
        }
        if(GetTickCount() - armedbody_pTick[playerid] > 113)
        {
                //prefix check itter
                new
                weaponid[13],weaponammo[13],pArmedWeapon;
                pArmedWeapon = GetPlayerWeapon(playerid);
                GetPlayerWeaponData(playerid,1,weaponid[1],weaponammo[1]);
                GetPlayerWeaponData(playerid,2,weaponid[2],weaponammo[2]);
                GetPlayerWeaponData(playerid,4,weaponid[4],weaponammo[4]);
                GetPlayerWeaponData(playerid,5,weaponid[5],weaponammo[5]);
                #if ARMEDBODY_USE_HEAVY_WEAPON
                GetPlayerWeaponData(playerid,7,weaponid[7],weaponammo[7]);
                #endif
                if(weaponid[1] && weaponammo[1] > 0)
                {
                        if(pArmedWeapon != weaponid[1])
                        {
                                if(!IsPlayerAttachedObjectSlotUsed(playerid,0))
                                {
                                        SetPlayerAttachedObject(playerid,0,GetWeaponModel(weaponid[1]),1, 0.199999, -0.139999, 0.030000, 0.500007, -115.000000, 0.000000, 1.000000, 1.000000, 1.000000);
                                }
                        }
                        else
                        {
                                if(IsPlayerAttachedObjectSlotUsed(playerid,0))
                                {
                                        RemovePlayerAttachedObject(playerid,0);
                                }
                        }
                }
                else if(IsPlayerAttachedObjectSlotUsed(playerid,0))
                {
                        RemovePlayerAttachedObject(playerid,0);
                }
                if(weaponid[2] && weaponammo[2] > 0)
                {
                        if(pArmedWeapon != weaponid[2])
                        {
                                if(!IsPlayerAttachedObjectSlotUsed(playerid,1))
                                {
                                        SetPlayerAttachedObject(playerid,1,GetWeaponModel(weaponid[2]),8, -0.079999, -0.039999, 0.109999, -90.100006, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000);
                                }
                        }
                        else
                        {
                                if(IsPlayerAttachedObjectSlotUsed(playerid,1))
                                {
                                        RemovePlayerAttachedObject(playerid,1);
                                }
                        }
                }
                else if(IsPlayerAttachedObjectSlotUsed(playerid,1))
                {
                        RemovePlayerAttachedObject(playerid,1);
                }
                if(weaponid[4] && weaponammo[4] > 0)
                {
                        if(pArmedWeapon != weaponid[4])
                        {
                                if(!IsPlayerAttachedObjectSlotUsed(playerid,2))
                                {
                                        SetPlayerAttachedObject(playerid,2,GetWeaponModel(weaponid[4]),7, 0.000000, -0.100000, -0.080000, -95.000000, -10.000000, 0.000000, 1.000000, 1.000000, 1.000000);
                                }
                        }
                        else
                        {
                                if(IsPlayerAttachedObjectSlotUsed(playerid,2))
                                {
                                        RemovePlayerAttachedObject(playerid,2);
                                }
                        }
                }
                else if(IsPlayerAttachedObjectSlotUsed(playerid,2))
                {
                        RemovePlayerAttachedObject(playerid,2);
                }
                if(weaponid[5] && weaponammo[5] > 0)
                {
                        if(pArmedWeapon != weaponid[5])
                        {
                                if(!IsPlayerAttachedObjectSlotUsed(playerid,3))
                                {
                                        SetPlayerAttachedObject(playerid,3,GetWeaponModel(weaponid[5]),1, 0.200000, -0.119999, -0.059999, 0.000000, 206.000000, 0.000000, 1.000000, 1.000000, 1.000000);
                                }
                        }
                        else
                        {
                                if(IsPlayerAttachedObjectSlotUsed(playerid,3))
                                {
                                        RemovePlayerAttachedObject(playerid,3);
                                }
                        }
                }
                else if(IsPlayerAttachedObjectSlotUsed(playerid,3))
                {
                        RemovePlayerAttachedObject(playerid,3);
                }
                #if ARMEDBODY_USE_HEAVY_WEAPON
                if(weaponid[7] && weaponammo[7] > 0)
                {
                        if(pArmedWeapon != weaponid[7])
                        {
                                if(!IsPlayerAttachedObjectSlotUsed(playerid,4))
                                {
                                        SetPlayerAttachedObject(playerid,4,GetWeaponModel(weaponid[7]),1,-0.100000, 0.000000, -0.100000, 84.399932, 112.000000, 10.000000, 1.099999, 1.000000, 1.000000);
                                }
                        }
                        else
                        {
                                if(IsPlayerAttachedObjectSlotUsed(playerid,4))
                                {
                                        RemovePlayerAttachedObject(playerid,4);
                                }
                        }
                }
                else if(IsPlayerAttachedObjectSlotUsed(playerid,4))
                {
                        RemovePlayerAttachedObject(playerid,4);
                }
                #endif
                armedbody_pTick[playerid] = GetTickCount();
        }
        new Float:health[MAX_PLAYERS];
        GetPlayerHealth(playerid,health[playerid]);
        if(health[playerid] < 3)
        {
                SetPlayerHealth(playerid,0);
                SetPlayerHealth(playerid,5);
                SetPlayerHealth(playerid,0);
        }
        return 1;
}

 

public CheckPlayers()
{
        foreach(Player, i)
        {
            new Float:x,Float:y,Float:z;
                new Float:x1,Float:y1,Float:z1;
                new drogos = GetPlayerID(\"Drogos_Gyalogos\");
                new boltos = GetPlayerID(\"Charlotte_Topkins\");
                GetPlayerPos(drogos,x,y,z);
                GetPlayerPos(boltos,x1,y1,z1);
            new playerid = i;
           new penz[16];
           format(penz, 16, \"Ft %08d\", PlayerInfo[playerid][pMoney]);
           PlayerTextDrawSetString(playerid,PenzBox[playerid], penz);
            if(GetPlayerMoneyEx(playerid)>10)
                {
                        new msg[128];
                        format(msg,128,\"%st bannolta a rendszer.Indok: Pénz Cheat!\",GetName(playerid));
                        SendClientMessageToAll(HPIROS,msg);
                        PlayerInfo[playerid][pLock]=1;
                        print(msg);
                        BanEx(playerid,\"Pénz Cheat\");
                }
        Antiweap_ON(playerid);
                if(PlayerInfo[playerid][pMission] != 0 && PlayerInfo[playerid][pMission] != 5 && PlayerInfo[playerid][pMission] != 3 && PlayerInfo[playerid][pMission] != 4)
                {
                    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                        {
                                if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
                                {
                                    PlayerInfo[playerid][pMission] = 5;
                                    DestroyVehicle(ktrailer[playerid]);
                                    SendClientMessage(playerid, Red, \"Elhagytad a pótkocsid! A küldetés véget ért, vidd vissza a kamiont a helyére!\");
                                    SetPlayerCheckpoint(playerid,1082.0374,-297.3177,74.5982,7);
                                }
                        }
                }
                if(GetPlayerSpeed(playerid)>165)
                {
                        new speed=GetPlayerSpeed(playerid);
                        new mig[128];
                        format(mig,128,\"[ADMINOK FIGYELEM] %s elért sebessége || %dKM/H || nézz utána!! ( /Spec %d )\",GetName(playerid),speed,playerid);
                        SAM(1,mig);
                        print(mig);
                }
                if(!IsPlayerNPC(playerid))
                {
                        if(IsPlayerConnected(playerid))
                        {
                            if(KilledNPC[playerid] != 1)
                            {
                                        if(IsPlayerInRangeOfPoint(playerid,2.0,x,y,z))
                                        {
                                                if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1)
                                                {
                                                        if(drogosnale[playerid] == 0)
                                                        {
                                                                ProxDetector(5.0, drogos, \"Mike Reyley mondja: Jónapot uram! Egzotikus illatszereket árulok, most jöttem fel friss levegõt szívni! Remélem nem baj.\", COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
                                                                SetPlayerChatBubble(drogos, \"Jónapot uram! Egzotikus illatszereket árulok, most jöttem fel friss levegõt szívni! Remélem nem baj.\", COLOR_WHITE, 5.0, 7000);
                                                                drogosnale[playerid] = 1;
                                                                SetTimerEx(\"dumanpc\",minute(1),0,\"i\",playerid);
                                                        }
                                                        return 1;
                                                }
                                                if(drogosnale[playerid] == 0)
                                                {
                                                        drogosnale[playerid] = 1;
                                                        ProxDetector(5.0, drogos, \"Mike Reyley mondja: Na mivan tesa, mi kéne? ((/drogvesz))\", COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
                                                        SetPlayerChatBubble(drogos, \"Na mivan tesa, kéne egy kis cuccos? Nálam megkapod!\", COLOR_WHITE, 5.0, 7000);
                                                        SetTimerEx(\"dumanpc\",minute(1),0,\"i\",playerid);
                                                }
                                                return 1;
                                        }
                                }
                        }
                }
                if(PlayerInfo[playerid][pRpWarn]>4)
                {
                        HU(playerid,FEHER,\"Bannolva lettél mivel nem tudod az RP szabályokat.\");
                        HU(playerid,ZOLD,\"Vedd fel az adminokkal a kapcsolatot, és kérj unbannt.\");
                        HU(playerid,PIROS,\"Tanuld meg a szabályokat.\");
                        BanEx(playerid,\"Warnok\");
                        return 1;
                }
        }
        return 1;
}

Nem elérhető Sramm

  • 596
    • Profil megtekintése
OnPlayerUpdate
« Válasz #8 Dátum: 2013. Január 01. - 16:54:51 »
0 Show voters
Ugyanúgy pinglagg  :(

Nem elérhető DrAkE

  • 2078
    • Profil megtekintése
OnPlayerUpdate
« Válasz #9 Dátum: 2013. Január 01. - 19:47:44 »
0 Show voters
Hát, valamiért nem nagyon csodálkozok, hogy laggol, ennyi ciklus után. Tisztában vagy, hányszor hívódik meg ez a függvény, ha mozog a játékos?

Nem elérhető ZyZu.

  • Globális moderátor
  • 8939
  • my turbo diesel forum
  • Discord: ZyZu.
    • Profil megtekintése
OnPlayerUpdate
« Válasz #10 Dátum: 2013. Január 01. - 21:41:59 »
0 Show voters
Ez igaz nem kéne ennyi függvényt elõhívni az OnPlayerUpdate alatt inkább használj timert mert az OnPlayerUpdate az nagyon sokszor frissûl elõ hívja a függvényeket vagy 100x 1 perc alatt majd nagy laggot és pinget csinál a szerveren.
« Utoljára szerkesztve: 2013. Január 01. - 21:44:03 írta ZyZu »

Nem elérhető DrAkE

  • 2078
    • Profil megtekintése
OnPlayerUpdate
« Válasz #11 Dátum: 2013. Január 01. - 22:01:52 »
0 Show voters
Idézetet írta: ZyZu date=1357072919\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"31726\" data-ipsquote-contentclass=\"forums_Topic
Ez igaz nem kéne ennyi függvényt elõhívni az OnPlayerUpdate alatt inkább használj timert mert az OnPlayerUpdate az nagyon sokszor frissûl elõ hívja a függvényeket vagy 100x 1 perc alatt majd nagy laggot és pinget csinál a szerveren.
 
Kicsit helyesbítek, ha nem mozog a játékos percenként 60 - 120x hívódik meg. Ha mozog a játékos, akkor percenként 960 - 1200x hívódik meg (JÁTÉKOSONKÉNT!). Tehát ha van 30 játékos a szervereden, akkor minimum 1800 - 3600x hívódik meg (ha nem mozognak a játékosok), és maximum 28800 - 36000x hívódik meg (ha mozognak a játékosok).

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal