Szerző Téma: settimer miért csak id0 nak?  (Megtekintve 497 alkalommal)

settimer miért csak id0 nak?
« Dátum: 2013. november 19. - 11:22:22 »
0 Show voters
helló van egy timerem ami a játékosok statisztikájáért felelne de akár mit csinálok csak id0 nál mûködik -_-
kod:
 

forward jatekosUpdate(playerid);
SetTimer(\"jatekosUpdate\",200,true);
public jatekosUpdate(playerid)
{
   new drunknew;
   drunknew = GetPlayerDrunkLevel(playerid);
   if (drunknew < 100) {
       SetPlayerDrunkLevel(playerid, 2000);
   } else {
       if (pDrunkLevelLast[playerid] != drunknew) {
           new wfps = pDrunkLevelLast[playerid] - drunknew;
           if ((wfps > 0) && (wfps < 200))
               pFPS[playerid] = wfps;
           pDrunkLevelLast[playerid] = drunknew;
       }
   }
new FpS[128];
   format(FpS, sizeof(FpS), \"FPS: %d\", pFPS[playerid]);
   TextDrawSetString(FPS[playerid],FpS);
   TextDrawShowForPlayer(playerid,FPS[playerid]);
if(PlayerInfo[playerid][cameramode] == CAMERA_MODE_FLY)
{
new keys,ud,lr;
GetPlayerKeys(playerid,keys,ud,lr);
if(PlayerInfo[playerid][mode] && (GetTickCount() - PlayerInfo[playerid][lastmove] > 100))
{
    MoveCamera(playerid);
}
if(PlayerInfo[playerid][udold] != ud || PlayerInfo[playerid][lrold] != lr)
{
   if((PlayerInfo[playerid][udold] != 0 || PlayerInfo[playerid][lrold] != 0) && ud == 0 && lr == 0)
   {
      StopPlayerObject(playerid, PlayerInfo[playerid][flyobject]);
      PlayerInfo[playerid][mode]      = 0;
      PlayerInfo[playerid][accelmul]  = 0.0;
   }
   else
   {
      PlayerInfo[playerid][mode] = GetMoveDirectionFromKeys(ud, lr);
      MoveCamera(playerid);
   }
}
PlayerInfo[playerid][udold] = ud; PlayerInfo[playerid][lrold] = lr;
return 0;
}
     new Float:Health;
     new HealthString[15];
     GetPlayerHealth(playerid,Health);
     format(HealthString, 15, \"     %d\",floatround(Health));
     TextDrawSetString(HealthBar[playerid],HealthString);
     TextDrawShowForPlayer(playerid,HealthBar[playerid]);
     if(gTeam[playerid]==0||gTeam[playerid]==1)
     {
     if(sawn==1)
     {
     new Float:health, message[15];
GetPlayerHealth(playerid,health);
format(message, sizeof(message), \"%d\",floatround(health));
SetPlayerChatBubble(playerid, message, 0xFFFFFFFF, 100.0, 1000);
}
else
{
    return 1;
}
}
new str[256];
format(str,sizeof(str),\"~r~Score: %d   ~w~Kills: %d   ~g~Deaths: %d   ~g~Ping: %d\",GetPlayerScore(playerid), PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths],GetPlayerPing(playerid));
TextDrawSetString(Text:Stats[playerid],str);
new vsg[256];
if(PlayerInfo[playerid][Deaths] == 0)
{
halal[playerid] = 1;
}
else
{
    halal[playerid]=PlayerInfo[playerid][Deaths];
}
format(vsg,sizeof(vsg),\"Ratio:%0.2f\",Float:PlayerInfo[playerid][Kills]/Float:halal[playerid]);
TextDrawSetString(arany[playerid],vsg);
TextDrawShowForPlayer(playerid,arany[playerid]);
   if(gTeam[playerid]==0)
   {
       new tki[20];
       format(tki,sizeof(tki),\"~r~Teamkill:%d\",clantk);
       TextDrawSetString(tk[playerid],tki);
TextDrawShowForPlayer(playerid,tk[playerid]);
   }
   if(gTeam[playerid]==1)
   {
       new tki[20];
       format(tki,sizeof(tki),\"~r~Teamkill:%d\",alltk);
       TextDrawSetString(tk[playerid],tki);
TextDrawShowForPlayer(playerid,tk[playerid]);
   }
   if(gTeam[playerid]==2)
   {
       new tki[20];
       format(tki,sizeof(tki),\"~r~Teamkill:--\");
       TextDrawSetString(tk[playerid],tki);
TextDrawShowForPlayer(playerid,tk[playerid]);
   }
   return 1;
}

Nem elérhető divkn

  • 3259
    • Profil megtekintése
settimer miért csak id0 nak?
« Válasz #1 Dátum: 2013. november 19. - 12:41:44 »
+1 Show voters
Módosítsd a SetTimer-t SetTimerEx-re.
 
public OnPlayerConnect(playerid)
{
    SetTimerEx(\"jatekosUpdate\", 200, true, \"i\", playerid);
    return 1;
}

settimer miért csak id0 nak?
« Válasz #2 Dátum: 2013. november 19. - 13:34:51 »
0 Show voters
köszi

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal