War system
#1

I made this war system but i get those warning:

pawn Код:
C:\Users\Fiore\Desktop\PCRP\Palomino Creek Roleplay V1\zGaming RP\gamemodes\pcrp.pwn(26860) : warning 204: symbol is assigned a value that is never used: "IsWar"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
This is the war system:

pawn Код:
new wtimer[MAX_PLAYERS];
new acceptwar = 0;
new Killing[MAX_FAMILIES],
    bool:IsWar;

CMD:startwar(playerid, params[])
{
    new family;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pFamRank] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not a family leader.");
    if(sscanf(params, "i", family)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /startwar [familyid]");
    if(family < 1 || family > 10) return SendClientMessage(playerid, COLOR_GREY, "Families are between 1 and 10.");
    if(wtimer[playerid] < 1) return SendClientMessage(playerid, COLOR_GREY, "You must wait 12 hours for every war");
    if(acceptwar == 1)
    {
        SendPlayerFamMessage(playerid, COLOR_LIGHTBLUE, "[WAR-INFO] A war has started!");
    }
    wtimer[playerid] = 3000000;
    return 1;
}

CMD:acceptwar(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pFamRank] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not a family leader.");
    if(acceptwar == 1)
    {
        acceptwar = 0;
        SendClientMessageToAll(COLOR_LIGHTBLUE,"|________WAR STARTED________|");
        //SendClientMessageToAll(COLOR_LIGHTBLUE,"%s VS %s"); //fix this
        SendClientMessageToAll(COLOR_LIGHTBLUE,"|___________________________|");
        for(new fam=1; fam< MAX_FAMILIES; fam++)
        {
            Killing[fam] = 0;
        }
        IsWar = true;
    }
    return 1;
}

forward WarEnded();
public WarEnded()
{
    new str[128];
    IsWar = false;
    format(str, 128,"{FFFFFF}[WAR OVER]:Cuneo: %d points || {CD3278}Tattaglia: %d points,",Killing[1], Killing[2]);
    SendClientMessageToAll(COLOR_WHITE,str);
    if(Killing[1] > Killing[2])
    {
        for(new a; a<MAX_PLAYERS;a++)
        {
            if(PlayerInfo[a][pFam] == 1)
            {
                SendClientMessageToAll(COLOR_WHITE,"Cuneo-VS-Tattaglia - [Cuneo]Win the war");
            }
        }
    }
    else
    {
        for(new k; k<MAX_PLAYERS;k++)
        {
            if(PlayerInfo[k][pFam] == 2)
            {
                SendClientMessageToAll(COLOR_WHITE,"Tattaglia-VS-Cuneo - [Tattaglia]Win the war");
            }
        }
    }
    for(new fam=1; fam< MAX_FAMILIES; fam++)
    {
        Killing[fam] = 0;
    }
    return 1;
}
Reply
#2

You're assigning the bool IsWar values, but you're never using it in a statement or a function.
Reply
#3

Nothing serious, it just means that you have defined a variable and never used it.
Reply
#4

How should i solve it? How do i define it true or false?
Reply
#5

Quote:
Originally Posted by Fiore
Посмотреть сообщение
How should i solve it? How do i define it true or false?
There's nothing to solve, you're just not using it so you can remove it. It's not needed. UNLESS you want to use it somewhere, for example if you want to check if there's a war going on, so you can use 'if(IsWar == true' ...
Reply
#6

so i just:

pawn Код:
new IsWar;

if(IsWar == false)
{
// something here
}
right?
Reply
#7

Quote:
Originally Posted by Fiore
Посмотреть сообщение
so i just:

pawn Код:
new IsWar;

if(IsWar == false)
{
// something here
}
right?
First of all, IsWar should be defined as a boolean:
pawn Код:
new bool: IsWar;
Second, yes, this is correct but it's useless. You should value IsWar somewhere first. For example, if some command is executed, IsWar = true, and so on.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)