Simple Question
#1

Yes, ummm, i've seen this in other things (as its important)....
How can i make it so that like, if i do /makeleader [id] [factionid] the factionid can only be between 0 and 14 or something.. (i got the /makeleader, i just need to know how to make the factionid HAVE to be between 0 and 14)

Helps appreciated,
/DaRealz\
Reply
#2

Paste the code you have for your command /makeleader and we'll be able to help you. It is only a simple if statement that is required to do what you want, but we need to know the names of your variables so we can produce the if statement for you.

If you studied mathematics (which I presume you did at some level at school) you'll probably know the difference between a greater than and lesser than sign, that's what will be used in the if statement to make sure the value entered is within your scope.
Reply
#3

I tested this and it works:
pawn Код:
dcmd_makeleader(playerid, params[])
{
    new
        giveplayerid,
        factionid,
        string[128];
    if (sscanf(params, "ud", giveplayerid, factionid)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /makeleader [playerid/partname] [factionid]");
    else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
    else
    {
        PlayerInfo[giveplayerid][pMemberF] = factionid;
        format(string, sizeof(string), "An admin has set your faction to factionid %d.", PlayerInfo[playerid][pMemberF]);
        SendClientMessage(playerid, COLOR_GREEN, string);
    }
    return 1;
}
Also, if you can, i need help with another problem:
Код:
C:\Users\Administrator\Desktop\samp03csvr_R2-2_win32 (10)\gamemodes\KTS.pwn(312) : warning 217: loose indentation
C:\Users\Administrator\Desktop\samp03csvr_R2-2_win32 (10)\gamemodes\KTS.pwn(355) : warning 213: tag mismatch
C:\Users\Administrator\Desktop\samp03csvr_R2-2_win32 (10)\gamemodes\KTS.pwn(355) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
These are the lines the warnings are taking place:
pawn Код:
stock SavePos(playerid){
    new file[128];
    format(file, sizeof(file), "USERS/%s.ini", pName(playerid));
    new Float:xxx,yyy,zzz;
    GetPlayerPos(playerid, xxx, yyy, zzz);
    dini_FloatSet(file, "PositionX", xxx);
    dini_FloatSet(file, "PositionY", yyy);
    dini_FloatSet(file, "PositionZ", zzz);
}
EDIT: also, if possible, is there a way to make instead of it saying my faction is 1 it says LSPD or something?
Reply
#4

is this r ight? i was looking around:

pawn Код:
dcmd_makeleader(playerid, params[])
{
    new
        giveplayerid,
        factionid,
        string[128];
    if (sscanf(params, "ud", giveplayerid, factionid)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /makeleader [playerid/partname] [factionid]");
    else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
    else
    {
        if(factionid <= 14)
        {
            PlayerInfo[giveplayerid][pMemberF] = factionid;
            format(string, sizeof(string), "An admin has set your faction to factionid %d.", PlayerInfo[playerid][pMemberF]);
            SendClientMessage(playerid, COLOR_GREEN, string);
        }
        else if(factionid >= 14)
        {
            SendClientMessage(playerid, COLOR_GREEN, "The Factionid needs to be between 14 and 0 !");
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)