DanN Posted March 5, 2017 Posted March 5, 2017 Pasul 1 Primul lucru pe care trebuie sa il faceti este sa adaugati aceasta variabila, pday langa celelalte de la pinfo enum pInfo { //// pDay, }; new PlayerInfo[MAX_PLAYERS][pInfo]; Pasul 2 Acum va trebuie sa stocam aceasta data, o vom salva si desigur o vom incarca cand jucatorul va intra pe server Adaugam langa celelalte la OnPlayerRegister format(var, 32, "pDay=%d\n",PlayerInfo[playerid][pDay]);fwrite(hFile, var); Pentru a salva adaugam langa celelalte la SavePlayerData format(var, 32, "pDay=%d\n",PlayerInfo[playerid][pDay]);fwrite(hFile, var); Iar cand jucatorul intra pe server, adaugam langa celelalte la OnPlayerLogin if( strcmp( key , "pDay" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDay] = strval( val ); } Pasul 3 In acest pas trebuie sa determinam timpul pe care trebuie sa il indeplineasca utilizatorul pt a lua paycheck Mergem la OnPlayerConnect si adaugam jos de tot langa celelalte PlayerInfo[playerid][pDay] = 3600; // 3600 inseamna o ora in secunde Pasul 4 Ca sa creeam timpul scurs trebuie sa adaugam urmatorul cod la public OtherTime if(PlayerInfo[pDay] >= 0) { PlayerInfo[pDay]--; if(PlayerInfo[pDay] <= 0) { PlayerInfo[pDay] = 3600; PayDay(); } } COLOR_GREEN,"________________________________________________________________________________________"); format(coordsstring, sizeof(coordsstring)," xxx [ %s - Level %d, %s] xxx",name,plevel,ttext); SendClientMessage(playerid, COLOR_LIGHTGREEN,coordsstring); format(coordsstring, sizeof(coordsstring),"» NextPay [%d] OnlineHours [%d]",pday/60,ptime); SendClientMessage(playerid, 0xCFCFCFFF,coordsstring); SendClientMessage(playerid, COLOR_GREEN,"________________________________________________________________________________________"); return 1; } Pasul 5 Aici trebuie sa eliminati payday-ul anterior care va venea la si fix, cum faceti asta ? Simplu, inlocuiti SyncTime cu acesta de mai jos public SyncTime() { new string[64]; new tmphour; new tmpminute; new tmpsecond; gettime(tmphour, tmpminute, tmpsecond); FixHour(tmphour); tmphour = shifthour; if ((tmphour > ghour) || (tmphour == 0 && ghour == 23)) { format(string, sizeof(string), "SERVER: The time is now %d:00 hours",tmphour+1); BroadCast(COLOR_WHITE,string); ghour = tmphour; if (realtime) { SetWorldTime(tmphour); } } }
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