Polisek 76 Odesláno: 12. Prosinec, 2014 Share Odesláno: 12. Prosinec, 2014 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 More sharing options...
0 eXot 18 Odesláno: 12. Prosinec, 2014 Share Odesláno: 12. Prosinec, 2014 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 More sharing options...
0 Polisek 76 Odesláno: 12. Prosinec, 2014 Author Share Odesláno: 12. Prosinec, 2014 #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 Link to comment Share on other sites More sharing options...
0 Mort 29 Odesláno: 12. Prosinec, 2014 Share Odesláno: 12. Prosinec, 2014 Nějak nechápu tu podmínku v OnPlayerConnect.. WTF? Link to comment Share on other sites More sharing options...
0 Polisek 76 Odesláno: 12. Prosinec, 2014 Author Share Odesláno: 12. Prosinec, 2014 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 More sharing options...
0 Mort 29 Odesláno: 13. Prosinec, 2014 Share Odesláno: 13. Prosinec, 2014 Jo, ale ty tu podmínku kontroluješ hned při connectu... vždycky tam bude mít nulu.. a jak vidím, tak u nuly napínáš ten timer takže ti to půjde do mínusu Link to comment Share on other sites More sharing options...
Dotaz
Polisek 76
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)
LoadUser ( Načtení Uživatele )
Do spawnu vlastně načtení jestli je hráč v Prisonu
Disconnect ( Odpojení )
(Ukladaní )
A zde odpočítaní času
Jak už mám o něco vejš ten TimerEx
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
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 accountSign in
Already have an account? Sign in here.
Sign In Now