SA-MP Forums Archive
[Help] Max 1 - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Max 1 (/showthread.php?tid=164266)



[Help] Max 1 - -Xan- - 30.07.2010

hey there, i'm made some teams/families in my script and i want that admin can give the leader to a player with a command

till here it's not a problem, but i want that the leader can be only 1 and if admin tries to make leader another palyer, he can't because there is allready one (connected or not) and he must take the leader to the orther one (connected or not)


Re: [Help] Max 1 - -Xan- - 31.07.2010

*Bump*

please help


Re: [Help] Max 1 - -Xan- - 31.07.2010

*BUMP*

wtf can anyone answer at least


Re: [Help] Max 1 - Hijolion - 31.07.2010

Perhaps, show us some of the script to provide you aid.


Re: [Help] Max 1 - -Xan- - 31.07.2010

example:

PlayerInfo[playerid][LeaderOfFamily] = 1;

with this a player is the leader of a family, i want that NO ONE ELSE can be leader of that family


Re: [Help] Max 1 - Conroy - 31.07.2010

pawn Код:
new FactionHasOwner;
for(new i; i <= MAX_PLAYERS; i++) {
    if(IsPlayerConnected(i)) {
        if(PlayerInfo[i][LeaderOfFamily]) {
            FactionHasOwner = 1;
        }
    }
}
if(FactionHasOwner) return SendClientMessage(playerid, COLOR_RED, "ERROR: This faction already has a leader.");
Use that in the command which gives the leader.


Re: [Help] Max 1 - -Xan- - 01.08.2010

thank you for help but check this

i used this:

pawn Код:
new HasLeaderFBI;

dcmd_giveleaderfbi(playerid,params[])
{
    new target,string[120];
    if(HasLeaderFBI == 1) return SendClientMessage(playerid,red,"The F.B.I. has allready a leader!");
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,red,"You are NOT Authorized to use this command!");
    if(sscanf(params,"d",target)) return SendClientMessage(playerid,red,"USAGE: /giveleaderfbi [ID]");
    if(((PlayerInfo[playerid][LeaderFBI] == 1) || (PlayerInfo[playerid][LeaderVLA] == 1)) return SendClientMessage(playerid,red,"Player is allready leader of a team/family!");

    format(string,sizeof(string),"Congratz, you are now the Federal Bureau of Investigation Leader!");
    SendClientMessage(target,red,"------------------------");
    SendClientMessage(target,lightblue,string);
    SendClientMessage(target,red,"------------------------");
    PlayerInfo[playerid][LeaderFBI] = 1;
    HasLeaderFBI = 1;
    return 1;
}
but when the player disconnects? or when the game mode restarts? how can i save the HasLeaderFBI?


Re: [Help] Max 1 - Retardedwolf - 01.08.2010

You don't need to save HasLeaderFBI.


Save the player enum "LeaderFBI".


Re: [Help] Max 1 - -Xan- - 01.08.2010

so with this will work?

pawn Код:
public OnPlayerDisconnect(playerid,reason)
{
    if (PlayerInfo[playerid][LoggedIn])
    {
    dUserSetINT(PlayerName(playerid)).("LeaderFBI",PlayerInfo[playerid][LeaderFBI]);
    dUserSetINT(PlayerName(playerid)).("LeaderVLA",PlayerInfo[playerid][LeaderVLA]);
    }
    return 1;
}



Re: [Help] Max 1 - Retardedwolf - 01.08.2010

Maybe.

Maybe if you saved it you can check if the player has the value then set "HasLeaderFBI" again.

btw it should be "HasLeaderFBI[playerid]" instead of "HasLeaderFBI"