Variable problems.
#1

Hey. I recently noticed an error on some of my commands, the variables seem to be messing up.

This command works fine under windows and linux
pawn Код:
CMD:random(playerid, params[])
{
    if(!IsAdmin(playerid) && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, AAD_COLOR_RED, "You don't have permission to use this command!");
    if(Current != -1) return SendClientMessage(playerid, AAD_COLOR_RED, "There's a round in progress!");
    if(Gametype != 0) return SendClientMessage(playerid, AAD_COLOR_RED, "Mode must be set to \"0\"");
    if(APlayers < 1 || DPlayers < 1) return SendClientMessage(playerid, AAD_COLOR_RED, "There's not enough players!");

    new
        baseID = random(TBases - 1),
        iStr[90];

    Voting = false;

    format(iStr, sizeof(iStr), "Administrator \"%s\" has started a random base \"%i\"", PNames[playerid], baseID);
    SendClientMessageToAll(COLOR_KHAKI, iStr);

    PreStart(baseID);
    return 1;
}
This one is working ONLY for windows:
pawn Код:
CMD:arandom(playerid, params[])
{
    if(!IsAdmin(playerid) && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, AAD_COLOR_RED, "You don't have permission to use this command!");
    if(Current != -1) return SendClientMessage(playerid, AAD_COLOR_RED, "There's a round in progress!");
    if(Gametype < 1) return SendClientMessage(playerid, AAD_COLOR_RED, "Mode must be set to \"1\" or \"2\"");
    if(APlayers < 1 || DPlayers < 1) return SendClientMessage(playerid, AAD_COLOR_RED, "There's not enough players!");

    new
        ArenaID = random(TArenas - 1),
        iStr[90];

    Voting = false;

    if(Gametype == 1) format(iStr, sizeof(iStr), "Administrator \"%s\" has started a random Arena \"%i\"", PNames[playerid], ArenaID);
    else if(Gametype == 2) format(iStr, sizeof(iStr), "Administrator \"%s\" has started a random TDM \"%i\"", PNames[playerid], ArenaID);
    SendClientMessageToAll(COLOR_KHAKI, iStr);

    PreStart(ArenaID);
    return 1;
}
Yes, ONLY for windows.

I tried printing the info on the "arandom" command and it does give the correct results. In linux though, it prints numbers like "737245356711".

I've already tried renaming the variables and still didn't work.

Please note: It DOES work for windows ( Both commands ). For linux, ONLY the 1st command works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)