Jump to content
  • 0

pomoc Prison Time - Odpočet [ YSI ]


Polisek

Dotaz

Zdravím vás potřebuji poradit ohledně odčítaní času v prisonu

 

1.) Čas neubíhá

 

Takže v PlayerInfo mám   ( Toto je zatím jen pro Info)

Prison,

LoadUser ( Načtení Uživatele )

INI_Int("Prison",PlayerInfo[playerid][Prison]);

Do spawnu vlastně načtení jestli je hráč v Prisonu

if(PlayerInfo[playerid][Prison] == 0)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
INI_Close(File);
SetTimerEx("Odpocet", 1000, true, "i", playerid);
     }

Disconnect ( Odpojení )

(Ukladaní )

INI_WriteInt(File,"Prison",PlayerInfo[playerid][Prison]);

A zde odpočítaní času

 

Jak už mám o něco vejš ten TimerEx

forward Odpocet(playerid);

public Odpocet(playerid)
{
PlayerInfo[playerid][Prison]--;
    return 1;
}

Co by to mělo dělat ?

 

Každou vteřinu odečíst jednen Prison  vlastně čas v Prisonu z PlayerInfo

 

 

Děkuji za Help a Informace Předem

 

Popřípadě i urážky na moje chyby atd....

 

 

Samozřejmě že pak udělám z KillTimerem ale to ted není důležité jde jen o tento Code

Link to comment
Share on other sites

5 odpovědí na tuto otázku

Recommended Posts

  • 0

Postni mi sem celý enum.

 

Po načítaní skús printnúť hodnotu premennej aby si si overil že v načítaní chyba neni.

printf("%i",PlayerInfo[playerid][Prison]);
Link to comment
Share on other sites

  • 0
 

 

 

#include <a_samp>
#include <YSI\y_ini>
#include <zcmd>
#include <sscanf2>


#define PATH "/hraci/%s.ini"


enum pInfo
{
Prison
}
new PlayerInfo[MAX_PLAYERS][pInfo];


stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
#pragma tabsize 0


forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
   INI_Int("Prison",PlayerInfo[playerid][Prison]);
    return 1;
}








#if defined FILTERSCRIPT


public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}


public OnFilterScriptExit()
{
return 1;
}


#else




#endif




public OnPlayerConnect(playerid)
{
    if(PlayerInfo[playerid][Prison] == 0)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
printf("%i",PlayerInfo[playerid][Prison]);
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
    INI_Close(File);
    SetTimerEx("Odpocet", 1000, true, "i", playerid);
     }
return 1;
}


public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
INI_WriteInt(File,"Prison",PlayerInfo[playerid][Prison]);
    INI_Close(File);


return 1;
}






forward Odpocet(playerid);


public Odpocet(playerid)
{
PlayerInfo[playerid][Prison]--;
    return 1;
}

Code když ho dám do FS


Díky za nápady :d

Link to comment
Share on other sites

  • 0

Pokud hráč má Čas v Prisonu na 0  nic se nespustí

Dejme tomu že to Editnu na:

<1

 

Ale pokud má hráč čas v Prisonu na 1 a více

A pokud má více než 1 tak se spustí Timer kterej každou vteřinu Ubere PrisonTime o 1 s

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...