Code not working
#9

pawn Код:
#include <a_samp>
#include <foreach>

public OnGameModeInit()
{
    SetTimer("TimeUpdater",1000,true);
    return 1;
}

forward TimeUpdater(playerid);
public TimeUpdater(playerid)
{
    foreach(Player, i)
    {
        SendClientMessage(i, -1, "increased your seconds by 1");
        PlayerInfo[i][Seconds]++;

        if(PlayerInfo[i][Seconds] >= 59)
        {
            PlayerInfo[i][Seconds] = 0;
            PlayerInfo[i][Minutes] ++;

            if(PlayerInfo[i][Minutes] >= 59)
            {
                PlayerInfo[i][Minutes] = 0;
                PlayerInfo[i][Hours] = ++;
            }
        }
    }
    return 1;
}

CMD:timeplayed(playerid,params[])
{
    new String[128];
    format(String, sizeof(String), "Time played: Seconds: %d %d Minute %d Hours", PlayerInfo[playerid][Seconds],PlayerInfo[playerid][Minutes],PlayerInfo[playerid][Hours]);
    SendClientMessage(playerid,RED,String);
    return 1;
}
How are you declaring your enum, it seems you're not adding [playerid] to them, try this code and if it didn't work show me your enum for players info
Reply


Messages In This Thread
Code not working - by Gaurav_Rawat - 20.01.2015, 15:31
Re: Code not working - by Schneider - 20.01.2015, 15:39
Re: Code not working - by xVIP3Rx - 20.01.2015, 15:45
Re: Code not working - by Gaurav_Rawat - 20.01.2015, 16:04
Re: Code not working - by Schneider - 20.01.2015, 16:05
Re: Code not working - by xVIP3Rx - 20.01.2015, 16:09
Re: Code not working - by Gaurav_Rawat - 20.01.2015, 16:20
Re: Code not working - by Schneider - 20.01.2015, 16:24
Re: Code not working - by xVIP3Rx - 20.01.2015, 16:27
Re: Code not working - by Gaurav_Rawat - 20.01.2015, 16:27

Forum Jump:


Users browsing this thread: 3 Guest(s)