SA-MP Forums Archive
CMD problem - 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: CMD problem (/showthread.php?tid=638942)



CMD problem - xAlecsu - 08.08.2017

Hello, I have some small problems ... if you can help me o.0

I want to appear the name of the faction, not faction id ..
I tried something but it did not work
I use YSI for save account
And sorry for my bad english...
Код:
CMD:fackick(playerid,params[])
{
	if(pInfo[playerid][AdminLevel] >= 3 || pInfo[playerid][pFacLeader] == 1)
	{
	    new targetid;
	    new string[128];
	    new sext[64];
	    
	    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_RED, "/fackick [id]");
	    if(targetid != INVALID_PLAYER_ID)
	    {
	        if(pInfo[targetid][pFacID] == 1) { sext = "Police Departament"; }
			pInfo[targetid][pFacID] = 0;
			pInfo[targetid][pFacPRank] = 0;
			format(string,sizeof(string),"Ai fost dat afara din factiunea %s",pInfo[playerid][pFacID]);
			SendClientMessage(playerid,0xFFFFFFAA,string);
	    }
	}
	else
	{
	    SendClientMessage(playerid, COLOR_RED, "Only certain levels of Administration have access to this command.");
	}
	return 1;
}



Re: CMD problem - iLearner - 08.08.2017

The enumator probably has something like pFacName ?


Re: CMD problem - xAlecsu - 08.08.2017

nope ,in "enum pInfo" i have only

pFacID << Faction id
pFacPRank <<player rank
pFacLeader <<faction leader


Re: CMD problem - iLearner - 08.08.2017

Can you show me Factions enumator?


Re: CMD problem - xAlecsu - 08.08.2017

I did the factions after this tutorial

https://sampforum.blast.hk/showthread.php?tid=548348


Re: CMD problem - Swarn - 08.08.2017

Maybe add this to the script?

Код:
stock FactionIDtoName(playerid)
{
	new FactionName[144];
	switch(PlayerInfo[playerid][pFacID])
	{
		case 0: FactionName = "Police Departament";
		// case 1: FactionName = "other names";
	}
	return FactionName;
}
Код:
CMD:fackick(playerid,params[])
{
	if(pInfo[playerid][AdminLevel] >= 3 || pInfo[playerid][pFacLeader] == 1)
	{
	    new targetid;
	    new string[128];
	    new sext[64];
	    
	    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_RED, "/fackick [id]");
	    if(targetid != INVALID_PLAYER_ID)
	    {
	        if(pInfo[targetid][pFacID] == 1) { sext = "Police Departament"; }
			pInfo[targetid][pFacID] = 0;
			pInfo[targetid][pFacPRank] = 0;
			format(string,sizeof(string),"Ai fost dat afara din factiunea %s",FactionIDtoName(playerid));
			SendClientMessage(playerid,0xFFFFFFAA,string);
	    }
	}
	else
	{
	    SendClientMessage(playerid, COLOR_RED, "Only certain levels of Administration have access to this command.");
	}
	return 1;
}



Re: CMD problem - xAlecsu - 08.08.2017

I have solved, thank you very much for help