04.06.2013, 15:14
Heey all,
Whats wrong with this command?
When i use the command it says i am already in a clan.
How can i fix this? I am not even in the mysql database.
Admigo
Whats wrong with this command?
pawn Код:
dcmd_cclan(playerid,params[])
{
new cname[30], ctag[30], cpass[30], cw1, cw2, cw3;
if(!sscanf(params, "s[30]s[30]s[30]iii", cname, ctag, cpass, cw1, cw2, cw3))
{
CreateClan(playerid, cname, ctag, cpass, "", "", cw1, cw2, cw3);
return 1;
}
else SendClientMessage(playerid,-1,"USAGE: /cclan <clan-name> <clan-tag> <clan-pass> <weap1> <weap2> <weap3>");
return 1;
}
stock CreateClan(playerid, clan_name[], clan_tag[], clan_pass[], clan_description[], clan_motd[], weap1, weap2, weap3)
{
if(strlen(clan_pass) < 3 || strlen(clan_pass) > 10) return SendClientMessage(playerid,-1,"{FF0000}ERROR: {FFFFFF}Clan password lenght is {FF0000}invalid{FFFFFF}, please try again!");
if(IsPlayerAnyClanMember(playerid) == 0)
{
CallLocalFunction("OnPlayerClanCreate", "is", playerid, clan_name);
new clanquery3[100];
format(clanquery3, sizeof(clanquery3), "SELECT clanname FROM a_clans WHERE clanname = '%s'", clan_name);
mysql_query(clanquery3, _THREAD_GET_CLAN_CLAN_NAME, playerid, gSQL);
mysql_store_result();
new rows = mysql_num_rows();
if(rows >= 1) return SendClientMessage(playerid,-1,"{FF0000}ERROR: {FFFFFF}Clan with that name already exists!");
mysql_free_result();
new clanquery[300];
format(clanquery,sizeof(clanquery),"INSERT INTO a_clans(clanname, clantag, clanpass, clandes, clanmotd, weap1, weap2, weap3) VALUES('%s', '%s', '%s', '%s', '%s', %d, %d, %d)", clan_name, clan_tag, clan_pass, clan_description, clan_motd, weap1, weap2, weap3);
mysql_query(clanquery, _THREAD_SET_CLAN, playerid, gSQL);
new player_name[MAX_PLAYER_NAME];
GetPlayerName(playerid,player_name,sizeof(player_name));
new clanquery2[300];
format(clanquery2,sizeof(clanquery2),"INSERT INTO a_clans_members(clanname, playername, playerclanrank, isinclan) VALUES('%s', '%s', 4, 1)", clan_name, player_name);
mysql_query(clanquery2, _THREAD_SET_CLAN_MEMBER, playerid, gSQL);
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new msg_for_all[100];
format(msg_for_all,sizeof(msg_for_all),"{03F2FF}CLAN: {00FF40}%s {FFFFFF}have created a clan named {00FF40}%s", name, clan_name);
SendClientMessageToAll(-1,msg_for_all);
return 1;
}
else SendClientMessage(playerid,-1,"{FF0000}ERROR: {FFFFFF}You are already in a clan, you cant create new one!");
return 1;
}
stock IsPlayerAnyClanMember(playerid)
{
new player_name[MAX_PLAYER_NAME];
GetPlayerName(playerid,player_name,sizeof(player_name));
new clanquery[100];
format(clanquery, sizeof(clanquery), "SELECT playername FROM a_clans_members WHERE playername = '%s'", player_name);
mysql_query(clanquery, _THREAD_GET_MEMBER_IS_IN_A_CLAN, playerid, gSQL);
mysql_store_result();
new rows = mysql_num_rows();
mysql_free_result();
if(!rows) return 0;
else return 1;
}
How can i fix this? I am not even in the mysql database.
Admigo