SA-MP Forums Archive
Faction Help!!! - 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: Faction Help!!! (/showthread.php?tid=499086)



Faction Help!!! - CallumDaBest - 06.03.2014

Code for my /makeleader!


Код:
CMD:makeleader(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] != 7)
    {
        new targetid,level,string[128];
        if(sscanf(params, "ud", targetid, level)) return  SendClientMessage(playerid,COLOR_GREY,"Syntax: /makeleader [playerid] [ID]");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,"Player is not online");
        if(level < 0 || level > 7) return SendClientMessage(playerid,-1,"Factions IDS: do /factions");
        PlayerInfo[targetid][pMember] = level;
        format(string, sizeof(string), "You have set %s(ID:%d) to Level %s(%d)",PlayerName(targetid),targetid,(targetid),level);
        SendClientMessage(playerid, -1, string);
        format(string, sizeof(string), "%s(ID:%d) has set your level to %s(%d)",PlayerName(playerid),playerid,(targetid),level);
        SendClientMessage(playerid, -1, string);
    }
    else SendClientMessage(playerid,-1,"You are not an admin.");
    return 1;
}
But the problem is everyone can do this and it does nothing and comes up Name has made you the leader of (1)
But i want it to do /makeleader for admin level 4+ and it says You have been made the leader of FACTION-Name(ID)

Faction ids i have:

Код:
stock Factions(playerid)
{
	new factionname[128];
	switch(PlayerInfo[playerid][pMember)
	{
	    case 0: factionname = "N/A";
	    case 1: factionname = "LSPD";
	    case 2: factionname = "FDSA";
	    case 3: factionname = "RR";
	}
	return factionname;
}



Re: Faction Help!!! - Clad - 06.03.2014

I think you should use this in the command
PHP код:
    if(PlayerInfo[playerid][pAdmin] > 4)
    { 



Re: Faction Help!!! - ThaCrypte - 06.03.2014

pawn Код:
if(PlayerInfo[playerid][pAdmin] != 7)
The !=7 in facts stand for Isn't 7.

Make it:
pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 7)



Re: Faction Help!!! - XK - 06.03.2014

it should be
pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 4)



Re: Faction Help!!! - ConnorHunter - 06.03.2014

For future reference,

Quote:

> Greater than
< Less than
>= Equal too and above
=< Equal too and less
== Equal too
!= Not equal too