28.01.2015, 09:08
(
Последний раз редактировалось Airblog; 28.01.2015 в 10:16.
)
Hi all
i'm going to create a dynamic clan system
but it doesn't work
it should be good but...
enum
Stock SaveClans
stock loadclans
CMD:CreateClan
and i have pClan and pClanRank in playerinfo
And stocks
and i put this under onplayerconnect
but in line
if(GetPlayerClan(playerid) == true)
gives me warning tag mistmach
and when i connected clan tag won't add near my name
Please Help i'll give +Rep (Sry bad english)
i'm going to create a dynamic clan system
but it doesn't work
it should be good but...
enum
Код:
enum claninfo { ClanName[32], ClanTag[6], ClanRank, ClanDes[256], ClanMOTD[256], ClanTaken, CMembers, } new ClanInfo[MAX_CLANS][claninfo];
Код:
stock SaveClans() { new idx = 0, File:file; new string[128]; while(idx < MAX_CLANS) { format(string, sizeof(string), "%s|%s|%d|%s|%s|%d|%d\r\n", ClanInfo[idx][ClanName], ClanInfo[idx][ClanTag], ClanInfo[idx][ClanRank], ClanInfo[idx][ClanDes], ClanInfo[idx][ClanMOTD], ClanInfo[idx][ClanTaken], ClanInfo[idx][CMembers]); if(idx == 0) { file = fopen("CLANS.cfg", io_write); } else { file = fopen("CLANS.cfg", io_append); } fwrite(file, string); fclose(file); idx++; } print("Clans saved successfully."); }
Код:
stock LoadClans() { new cinfo[7][128]; new string[256]; new File:file = fopen("CLANS.cfg", io_read); if(file) { new idx = 0; while(idx < MAX_CLANS) { fread(file, string); split(string, cinfo, '|'); format(ClanInfo[idx][ClanName], 32, "%s", cinfo[0]); format(ClanInfo[idx][ClanTag], 6, "%s", cinfo[1]); ClanInfo[idx][ClanRank] = strval(cinfo[2]); format(ClanInfo[idx][ClanDes], 256, "%s", cinfo[3]); format(ClanInfo[idx][ClanMOTD], 64, "%s", cinfo[4]); ClanInfo[idx][ClanTaken] = strval(cinfo[5]); ClanInfo[idx][CMembers] = strval(cinfo[6]); idx++; } } print("CLANS loaded successfully."); return 1; }
Код:
CMD:createclan(playerid,params[]) { if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "First Login."); if(ClanMaker[playerid] == 0) return SCM(playerid,COLOR_ALIREZA,"You Havent Clan Permission"); new cname[30], ctag[30],idx; if(sscanf(params, "is[30]s[30]",idx, cname, ctag)) return SendClientMessage(playerid,-1,"USAGE: /createclan <slot> <clan-name> <clan-tag>"); { if(ClanInfo[idx][ClanTaken]) return SendClientMessage(playerid, COLOR_GREY, "Clan slot is already in use."); if(idx < 1 || idx > 20) return SendClientMessage(playerid, COLOR_GREY, "Clans are between 1 and 20."); format(ClanInfo[idx][ClanName], 32, "%s", cname); format(ClanInfo[idx][ClanTag], 6, "%s",ctag); ClanInfo[idx][ClanTaken] = 1; ClanInfo[idx][CMembers] ++; PlayerInfo[playerid][pClan] = idx; PlayerInfo[playerid][pClanRank] = 6; return 1; } return 1; }
And stocks
Код:
stock GetPlayerClan(playerid) { return PlayerInfo[playerid][pClan]; } stock GetPlayerClanTag(playerid) { return ClanInfo[PlayerInfo[playerid][pClan]][ClanTag]; } stock GetPlayerClanRank(playerid) { return PlayerInfo[playerid][pClanRank]; } stock SendPlayerClanMessage(playerid,color,string[]) { foreach(Player, i) { if(IsPlayerLoggedIn(i) && PlayerInfo[i][pClan] == PlayerInfo[playerid][pClan]) { SCM(i, color, string); } } return 1; }
Код:
if(GetPlayerClan(playerid) == true) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); new n_name[MAX_PLAYER_NAME]; format(n_name, sizeof(n_name), "[%s]%s", GetPlayerClanTag(playerid), name); SetPlayerName(playerid, n_name); }
if(GetPlayerClan(playerid) == true)
gives me warning tag mistmach
and when i connected clan tag won't add near my name
Please Help i'll give +Rep (Sry bad english)