SA-MP Forums Archive
S.O.S Clan - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: S.O.S Clan (/showthread.php?tid=649527)



S.O.S Clan - Hunud - 10.02.2018

Hi,

I was thinking about, how could i create a command than admin are available to remove clan with name (Ex: /removeclan (ClanName). I use SQLite.

Код:
CMD:removeclan(playerid)
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Only Admins");
    return RemoveClan(playerid);
}
Код:
forward AdminDisband(playerid, clan_name[]);
Код:
stock RemoveClan(playerid)
{
    new CQuery[300], player_name[MAX_PLAYER_NAME];
    
	CallLocalFunction("AdminDisband", "is", playerid, GetPlayerClan(playerid));
	GetPlayerName(playerid,player_name,sizeof(player_name));

	SendClientMessage(playerid, -1, "You removed clan from list.");
	format(CQuery, sizeof(CQuery), "DELETE FROM clans WHERE clanname = '%s'", GetPlayerClan(playerid));
	db_query( Database, CQuery );
	format(CQuery, sizeof(CQuery), "DELETE FROM members WHERE playername = '%s'", player_name);
	db_query( Database, CQuery );
	return 1;
}



Re: S.O.S Clan - JasonRiggs - 10.02.2018

You tried compiling? Any error happened??


Re: S.O.S Clan - Hunud - 10.02.2018

No Errors. It just doesent have an option/syntax to type a clan name which i want to remove/delete.

Whenever i type /removeclan it just say "You removed clan from list. But nothing actually happen lol.


Re: S.O.S Clan - JasonRiggs - 10.02.2018

The command format is wrong..

Try this

PHP код:
CMD:removeclan(playeridparams)
{
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"Only Admins!")
if(
sscanf(params"s[128]" GetPlayerClan(playerid)) return SendClientMessage(playerid, -1"USAGE: /removeclan <Name>")
   
RemoveClan(playerid);




Re: S.O.S Clan - Hunud - 10.02.2018

error 035: argument type mismatch (argument 1)
error 001: expected token: ")", but found "return"

Код:
if(sscanf(params, "s[128]" GetPlayerClan(playerid)) return SendClientMessage(playerid, -1, "USAGE: /removeclan <Name>");



Re: S.O.S Clan - JasonRiggs - 10.02.2018

Okay add this instead

PHP код:
new name GetPlayerClan(playerid);
   if(
sscanf(params"s[128]"name)) return SendClientMessage(playerid, -1"USAGE: /removeclan <name>"



Re: S.O.S Clan - Hunud - 10.02.2018

I used this command and input the clan in but command dosen't excute, it repeat syntax /removeclan <name>


Re: S.O.S Clan - JasonRiggs - 10.02.2018

Quote:
Originally Posted by Hunud
Посмотреть сообщение
I used this command and input the clan in but command dosen't excute, it repeat syntax /removeclan <name>
I bet the reason of it is "GetPlayerClan" I guess you must be in a clan you are trying to delete, send me the function of "GetPlayerClan" please.


Re: S.O.S Clan - Hunud - 10.02.2018

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
I bet the reason of it is "GetPlayerClan" I guess you must be in a clan you are trying to delete, send me the function of "GetPlayerClan" please.
No, I want that only RCON Admin can remove/delete any clan he want with name itself, no admin need tp be in any clan.

Код:
stock GetPlayerClan(playerid)
{
	new player_name[MAX_PLAYER_NAME], CQuery[100], Field[30];
	GetPlayerName(playerid,player_name,sizeof(player_name));
	format(CQuery, sizeof(CQuery), "SELECT `clanname` FROM `members` WHERE `playername` = '%s'", player_name);
	Result = db_query(Database, CQuery);
	db_get_field_assoc( Result, "clanname", Field, 30 );
	db_free_result(Result);
	return Field;
}



Re: S.O.S Clan - JasonRiggs - 10.02.2018

Do you have any clan enums?