if(dialogid == ReGiStEr){ if(response) { new file[128]; new string[128]; new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); if(strlen(inputtext) == 0) { format(string, sizeof string, \"Regisztráció \\n\\nÜdv %s! \\nTe még nem vagy regisztrálva! \\n\\nKérjük regisztrálj.\", name); ShowPlayerDialog(playerid, ReGiStEr, DIALOG_STYLE_INPUT, \"Regisztráció\", string, \"Register\", \"Cancel.\"); return 0; } format(file,sizeof(file),\"%s.ini\",name); if(!fexist(file)) { dini_Create(file); dini_IntSet(file,\"Password\", udb_hash(inputtext)); dini_IntSet(file,\"pScore\", GetPlayerScore(playerid)); dini_IntSet(file,\"pMoney\", GetPlayerMoney(playerid)); dini_IntSet(file,\"pDeaths\", PlayerInfo[playerid][pDeaths]); dini_IntSet(file,\"pKills\", PlayerInfo[playerid][pKills]); dini_IntSet(file,\"pAdmin\", PlayerInfo[playerid][pAdmin]); format(string, sizeof string,\"Bejelentkezés \\n\\nÜdv %s! \\nTe regisztrálva vagy! \\n\\nKérjük jelentkezz be.\", name); ShowPlayerDialog(playerid, LoGiN, DIALOG_STYLE_INPUT, \"Bejelentkezés\", string, \"Login\", \"Cancel.\"); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); GetPlayerName(playerid, name, sizeof(name)); printf(\"%s sikeresen regisztrált!\", name); SendClientMessage(playerid, COLOR_GRAD1, \"Csatlakoztál a szerverre, kilépéskor a változások mentõdnek!\"); }}if(!response) return Kick(playerid);}
#include <a_samp>enum pTime{Seconds,Minutes,Hours,Days};new PlayerTime[MAX_PLAYERS][pTime];new PlayerTimer[MAX_PLAYERS];public OnPlayerConnect(playerid){new file[100];format(file, sizeof(file), \"%s.ini\", PlayerName(playerid));PlayerTime[playerid][seconds] = dini_Int(file, \"Seconds\");PlayerTime[playerid][Minutes] = dini_Int(file, \"Minutes\");PlayerTime[playerid][Hours] = dini_Int(file, \"Hours\");PlayerTime[playerid][Days] = dini_Int(file, \"Days\");PlayerTimer[playerid] = SetTimer(\"PlayedTime\", 1000, 1, \"%d\", playerid);return 1;}public OnPlayerDisconnect(playerid, reason){dini_IntSet(file, \"Seconds\", PlayerTime[playerid][seconds]);dini_IntSet(file, \"Minutes\", PlayerTime[playerid][Minutes]);dini_IntSet(file, \"Hours\", PlayerTime[playerid][Hours]);dini_IntSet(file, \"Days\", PlayerTime[playerid][Days]);KillTimer(PlayerTimer[playerid]);return 1;}public OnPlayerCommandText(playerid, cmdtext[]){new string[256];if(strcmp(cmdtext, \"/played\", true) == 0){format(string, sizeof(string), \"Played Time: %d days, %d hours, %d minutes, %d seconds..\", PlayerTime[playerid][Days], PlayerTime[playerid][Hours], PlayerTime[playerid][Minutes], PlayerTime[playerid][seconds]);SendClientMessage(playerid, 0xFFFFFFFF, string);return 1;}return 0;}forward PlayedTime(playerid);public PlayedTime(playerid){if(!IsPlayerConnected(playerid)) return 0;PlayerTime[playerid][seconds]++;if(PlayerTime[playerid][seconds] == 60){ PlayerTime[playerid][Minutes]++;PlayerTime[playerid][seconds] = 0;}if(PlayerTime[playerid][Minutes] == 60){ PlayerTime[playerid][Hours]++;PlayerTime[playerid][Minutes] = 0;}if(PlayerTime[playerid][Hours] == 24){ PlayerTime[playerid][Days]++;PlayerTime[playerid][Hours] = 0;}return 1;}stock PlayerName(playerid){new name[MAX_PLAYER_NAME];GetPlayerName(playerid, name, sizeof(name));return name;}
SetTimer
SetTimerEx