Szerző Téma: Mi a hiba?  (Megtekintve 642 alkalommal)

Mi a hiba?
« Dátum: 2010. Június 12. - 15:19:43 »
0 Show voters
#include <a_samp>
new Float:health;
forward for20hp(playerid);
public for20hp(playerid)
{
   if(GetPlayerHealth(playerid,health) >= 20)
   {
      ApplyAnimation(playerid,\"CRACK\",\"crckdeth2\",4.1,1,1,1,1,1);
   }
   return 1;
}
public OnFilterScriptInit() { return SetTimer(\"for20hp\", 1000, 1); }
public OnPlayerCommandText(playerid, cmdtext[])
{
   new giveplayerid, idx;
   new tmp[256];
   new cmd[256];
   cmd = strtok(cmdtext, idx);
   if(strcmp(cmd, \"/segit\",true) == 0)
   {
       if (giveplayerid == playerid)
      {
         SendClientMessage(playerid, 0xFFFF00AA, \"Magadat nem segítheted fel.\");
      }
        tmp = strtok(cmdtext, idx);
       if(!strlen(tmp))
       {
          SendClientMessage(playerid, 0xFFFFFFAA, \"HASZNÁLD: /segit [playerid]\");
             return 1;
       }
       giveplayerid = strval(tmp);
          if(IsPlayerConnected(giveplayerid))
          {
              SetPlayerHealth(giveplayerid,30);
              ClearAnimations(giveplayerid);
              SendClientMessage(playerid, 0xFFFFFFAA, \"Felsegítetted a játékost.\");
              SendClientMessage(giveplayerid, 0xFFFFFFAA, \"Menj, gyorsan tölsd fel az életed!\");
             return 1;
          }
             else
          {
             SendClientMessage(playerid, 0xFFFFFFAA, \"Nincs ilyen ID!\");
           }
         return 1;
   }
   return 0;
}
strtok(const string[], &index)
{
   new length = strlen(string);
   while ((index < length) && (string[index] <= \' \'))
   {
      index++;
   }
   new offset = index;
   new result[20];
   while ((index < length) && (string[index] > \' \') && ((index - offset) < (sizeof(result) - 1)))
   {
      result[index - offset] = string[index];
      index++;
   }
   result[index - offset] = EOS;
Sajnos nemesik animba 20hp alatt!És szeretnék egy ojat kérni amibe hogyha nekimész a falnak akkor lemegy a hpd. Köszönm
   return result;
}

Nem elérhető Lömpi

  • 1257
    • Profil megtekintése
Mi a hiba?
« Válasz #1 Dátum: 2010. Június 12. - 15:28:20 »
0 Show voters
ez mit keres az strtok beágyazásánál ??
 
Sajnos nemesik animba 20hp alatt!És szeretnék egy ojat kérni amibe hogyha nekimész a falnak akkor lemegy a hpd. Köszönm[/quote]

GroX

  • Vendég
Mi a hiba?
« Válasz #2 Dátum: 2010. Június 12. - 15:34:05 »
0 Show voters
Ez amúgy se jó mert csak a 0-ás azonosítójú játékosnál fog menni.
OnFilterScriptInit alól töröld ki a SetTimert, és:
 
public OnPlayerConnect(playerid)
{
    SetTimerEx(\"for20hp\",1000,1,\"i\",playerid);
    return 1;
}

 
Ezt másold be.

Mi a hiba?
« Válasz #3 Dátum: 2010. Június 12. - 15:48:16 »
0 Show voters
Igy is van 6 Warning: S

Mi a hiba?
« Válasz #4 Dátum: 2010. Július 22. - 19:05:45 »
0 Show voters
Köszönöm a segit parancsot :D

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal