19.07.2010, 08:21
Well I can't get it to add the [Clan] tag before the player's name, which is saved in the userfiles.
It most of time ended up with crashing the server or giving me empty "[]Name" tags.
That's my enum so far.
That's my login command.
And that's the command I made for creating a clan tag
Any suggestions?
It most of time ended up with crashing the server or giving me empty "[]Name" tags.
That's my enum so far.
Код:
enum pInfo { pLogged, pAdmin, pClanTag, pMoney, } new PlayerInfo[MAX_PLAYERS][pInfo];
Код:
CMD:login(playerid, params[]) { if(IsPlayerConnected(playerid)) { new file[128]; new password[256]; new message[128]; new spassword[256]; format(file, sizeof(file), "%s.ini", ReturnPlayerName(playerid)); if(sscanf(params, "s", password)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /login [password]"); if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You need to register first, type /register"); if(PlayerInfo[playerid][pLogged]) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You're already logged in"); spassword = dini_Get(file, "hashPW"); if(udb_hash(password) != strval(spassword)) { format(message, sizeof(message), "SERVER: Invalid password"); SendClientMessage(playerid, COLOR_WHITE, message); } else { PlayerInfo[playerid][pLogged] = 1; PlayerInfo[playerid][pAdmin] = dini_Int(file, "admlvl"); PlayerInfo[playerid][pMoney] = dini_Int(file, "money"); PlayerInfo[playerid][pClanTag] = dini_Int(file, "clantag"); GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]); format(message, sizeof(message), "SERVER: Welcome back, %s.", ReturnPlayerName(playerid)); SendClientMessage(playerid, COLOR_WHITE, message); } } return 1; }
Код:
CMD:createclan(playerid, params[]) { if(IsPlayerConnected(playerid)) { new clantag[128]; new message[128]; new file[128]; format(file, sizeof(file), "%s.ini", ReturnPlayerName(playerid)); if(sscanf(params, "s", clantag)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createclan [tag]"); dini_Set(file, "clantag", clantag); format(message, sizeof(message), "You have successfully created the [%s] clan. Relog to use it.", clantag); SendClientMessage(playerid, COLOR_LIGHTBLUE, message); } return 1; }