[Help] /setbl
#1

OK, i have maked a BL faction....

The player needs to be a BL to spawn....

So I want to make him a BL with /setbl....

Once he've been seted, then he can spawn....

I want rcon admin only to do /setbl
Reply
#2

Plz help. I will give Rep
Reply
#3

Do you have the command?

If yes you must add at the top of the command:
pawn Код:
if(!IsPlayerAdmin(playerid)) return 0;
Reply
#4

pawn Код:
new BLFaction[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    BLFaction[playerid] = 0;
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    if(BLFaction[playerid] == 0)
    {
        if(!IsPlayerAdmin(playerid))
        {
            SendClientMessage(playerid, 0xFF0000FF, "You Have Not Been Authorised To Spawn.");
            return 0;
        }
    }
    return 1;
}

CMD:setbl(playerid,params[])
{
    new id;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You Must Be Logged Into RCON To Use This Command.");
    if(sscanf(params,"u",id)) return SendClientMessage(playerid, 0xFF0000FF, "SYNTAX ERROR: {00FF00}/SETBL {FFFF00}<PlayerID>");
    if(id == INVALID_PLAYER_ID || !IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "This Player Is Not Connected.");
    if(BLFaction[id] != 0) return SendClientMessage(playerid, 0xFF0000FF, "This Player Has Already Been Authorised.");
    new string[70];
    new AdminName[MAX_PLAYER_NAME], PlayersName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, AdminName, MAX_PLAYER_NAME);
    GetPlayerName(id, PlayersName, MAX_PLAYER_NAME);
    format(string,sizeof(string),"Administrator %s Has Authorised You To Spawn.",AdminName);
    SendClientMessage(id, 0xFFFF00FF, string);
    format(string,sizeof(string),"You Have Authorised %s To Spawn.",PlayersName);
    SendClientMessage(playerid, 0xFFFF00FF, string);
    BLFaction[id] = 1;
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    BLFaction[playerid] = 0;
    return 1;
}
NOTE: You need the following includes:
ZCMD, SSCANF2, A_SAMP
Reply
#5

Hey..
Use bool, it saves some bites:
pawn Код:
new bool:BLFaction[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    BLFaction[playerid] = false;
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    if(!BLFaction[playerid])
    {
        if(!IsPlayerAdmin(playerid))
        {
            SendClientMessage(playerid, 0xFF0000FF, "You Have Not Been Authorised To Spawn.");
            return 0;
        }
    }
    return 1;
}

CMD:setbl(playerid,params[])
{
    new id;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You Must Be Logged Into RCON To Use This Command.");
    if(sscanf(params,"u",id)) return SendClientMessage(playerid, 0xFF0000FF, "SYNTAX ERROR: {00FF00}/SETBL {FFFF00}<PlayerID>");
    if(id == INVALID_PLAYER_ID || !IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "This Player Is Not Connected.");
    if(BLFaction[id]) return SendClientMessage(playerid, 0xFF0000FF, "This Player Has Already Been Authorised.");
    new string[70];
    new AdminName[MAX_PLAYER_NAME], PlayersName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, AdminName, MAX_PLAYER_NAME);
    GetPlayerName(id, PlayersName, MAX_PLAYER_NAME);
    format(string,sizeof(string),"Administrator %s Has Authorised You To Spawn.",AdminName);
    SendClientMessage(id, 0xFFFF00FF, string);
    format(string,sizeof(string),"You Have Authorised %s To Spawn.",PlayersName);
    SendClientMessage(playerid, 0xFFFF00FF, string);
    BLFaction[id] = true;
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    BLFaction[playerid] = false;
    return 1;
}
Reply
#6

True, cheers.
Reply
#7

K thnk guys, but... what about gTeam? Is there anyway to do with BL gTeam?
Reply
#8

This?
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>

#define BLFACTION 1
new gTeam[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    gTeam[playerid] = 0;
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    if(gTeam[playerid] == 0)
    {
        if(!IsPlayerAdmin(playerid))
        {
            SendClientMessage(playerid, 0xFF0000FF, "You Have Not Been Authorised To Spawn.");
            return 0;
        }
    }
    return 1;
}

CMD:setbl(playerid,params[])
{
    new id;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You Must Be Logged Into RCON To Use This Command.");
    if(sscanf(params,"u",id)) return SendClientMessage(playerid, 0xFF0000FF, "SYNTAX ERROR: {00FF00}/SETBL {FFFF00}<PlayerID>");
    if(id == INVALID_PLAYER_ID || !IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "This Player Is Not Connected.");
    if(gTeam[id] != BLFACTION) return SendClientMessage(playerid, 0xFF0000FF, "This Player Has Already Been Authorised.");
    new string[70];
    new AdminName[MAX_PLAYER_NAME], PlayersName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, AdminName, MAX_PLAYER_NAME);
    GetPlayerName(id, PlayersName, MAX_PLAYER_NAME);
    format(string,sizeof(string),"Administrator %s Has Authorised You To Spawn.",AdminName);
    SendClientMessage(id, 0xFFFF00FF, string);
    format(string,sizeof(string),"You Have Authorised %s To Spawn.",PlayersName);
    SendClientMessage(playerid, 0xFFFF00FF, string);
    gTeam[id] = BLFACTION;
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    gTeam[playerid] = 0;
    return 1;
}
Reply
#9

Thnk, 1 rep to each of u guys
Reply
#10

BTW, what does this mean?
pawn Код:
gTeam[playerid] = 0;
I want to know what it is
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)