Error

Started by (SpCy)Alex, Aug 06, 2018, 10:40 AM

Previous topic - Next topic

(SpCy)Alex

I have a hunger system that gives me error in the tointeger (what is bad here i dont found error and it no work if one can help me please

local type = stream.ReadString();
   if(GetTok(type," ",1) == "spawn")
   {
      try{
      ::stats.Text = "Wanted level:"+GetTok(type," ",2)+" XP:"+GetTok(type," ",3);
      ::hunger.Value = GetTok(type," ",6).tointeger(); <------ Says it no exist  and spam in server this (the index 'tointeger' does not exist)
      }
      catch(e) Console.Print(e);
   }
Here he sends data to "spawn"

local hunger = ReadIniInteger("PlayerStats.ini","Hunger",player.Name);
   local xp = ReadIniInteger("PlayerStats.ini","XP",player.Name);
   Stream.StartWrite();
   Stream.WriteString("spawn "+player.WantedLevel+" "+xp+" "+hunger);
   Stream.SendStream(player)

///When player enter checkpoint
if(CheckpointColors(checkpoint,restaurant) == true)
   {
      Stream.StartWrite();
      Stream.WriteString("food");
      Stream.SendStream(player);
   }
   local hunger = ReadIniInteger("PlayerStats.ini","Hunger",player.Name);
   local xp = ReadIniInteger("PlayerStats.ini","XP",player.Name);
   Stream.StartWrite();
   Stream.WriteString("spawn "+player.WantedLevel+" "+xp+" "+hunger);
   Stream.SendStream(player);

if(GetTok(type," ",1) == "food")
   {
      switch(GetTok(type," ",2).tointeger())
      {
         case 1:
         {
            cash = 5;
            hunger = 5;