make this shorter?
#1

pawn Код:
forward One();
forward Two();
//etc..

public Two()
{
    GameTextForAll("~y~2",3000,4);
    SoundForAll(1056);
    return 1;
}

public One()
{
    GameTextForAll("~r~1",3000,4);
    SoundForAll(1056);
    return 1;
}

// up to go

COMMAND:countdown(playerid, params[])
{
    if(Countdown == 1) return SendClientMessage(playerid, Red, "countdown already on");
    SendClientMessage(playerid, Green, "count started");
    SetTimer("Three", 1000, 0);
    SetTimer("Two", 2000, 0);
    SetTimer("One", 3000, 0);
    SetTimer("Go", 4000, 0);
    Countdown = 1;
    return 1;
}
how to make it shorter? I dont want so many publics and all
Reply
#2

bump, also another question

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(!success)
        {
            new IP[16], string[128], pName[MAX_PLAYER_NAME];
            GetPlayerIp(i, IP, sizeof(IP));
            GetPlayerName(i, pName, sizeof(pName));
            RCONAttempts(pName, ip, password);
            if(!strcmp(ip, IP, true))
            {
                LoginAttempt[i]++;
                if(LoginAttempt[i] == 1) return SendClientMessage(i, AdminColor, "Wrong RCON login. 2 attempts left");
                if(LoginAttempt[i] == 2) return SendClientMessage(i, AdminColor, "Wrong RCON login. 1 attempts left");
                if(LoginAttempt[i] == 3)
                {
                    SendClientMessage(i, AdminColor, "banned .. ");
                    LoginAttempt[i] = 0;
                    Ban(i);
                }
            }
        }
        else
        {
            SendClientMessage(i, AdminColor, "logged in");
        }
    }
    return 1;
}
The code works perfectly fine, but it still shows the old messages? Like SERVER: Bad RCON Login. Repeated times ....., and when you logged in "SERVER: You have logged in as an admin"

I want that away, I want my own messages how to ?
Reply
#3

how is this
pawn Код:
forward Go(playerid);
new GoTimer[MAX_PLAYERS],GoTCount,GTStr[10];
public Go(playerid){
    switch(GoTCount){
        case 0:{
            GTStr = "~g~GO!!";
            KillTimer(GoTimer[playerid]);
            GoTimer[playerid] = 0;
        }
        default:format(GTStr,sizeof(GTStr),"~r~%d",g);
    }
    GameTextForAll(GTStr,3000,4);
    SoundForAll(1056);
    GoTCount--;
    return 1;
}

// up to go

COMMAND:countdown(playerid, params[])
{
    if(Countdown == 1) return SendClientMessage(playerid, Red, "countdown already on");
    SendClientMessage(playerid, Green, "count started");
    GoTimer[playerid] = SetTimer("Go",4000,1,"i",playerid);
    Countdown = 1;
    GoTCount = 5;
    return 1;
}
Reply
#4

edit: didnt work well
Reply
#5

Place a return 1; under if(!success), and under the "else" part too.
Reply
#6

Quote:
Originally Posted by (SF)Noobanatior
Посмотреть сообщение
how is this
pawn Код:
forward Go(playerid);
new GoTimer[MAX_PLAYERS],GoTCount,GTStr[10];
public Go(playerid){
    switch(GoTCount){
        case 0:{
            GTStr = "~g~GO!!";
            KillTimer(GoTimer[playerid]);
            GoTimer[playerid] = 0;
        }
        default:format(GTStr,sizeof(GTStr),"~r~%d",g);
    }
    GameTextForAll(GTStr,3000,4);
    SoundForAll(1056);
    GoTCount--;
    return 1;
}

// up to go

COMMAND:countdown(playerid, params[])
{
    if(Countdown == 1) return SendClientMessage(playerid, Red, "countdown already on");
    SendClientMessage(playerid, Green, "count started");
    GoTimer[playerid] = SetTimer("Go",4000,1,"i",playerid);
    Countdown = 1;
    GoTCount = 5;
    return 1;
}
Timer and countdown variables? SIMPLIFICATION FAIL.

pawn Код:
forward Go();
new GoTCount, GTStr[10];
public Go(){
    switch(GoTCount){
        case 0: GTStr = "~g~GO!!";
        default:format(GTStr,sizeof(GTStr),"~r~%d",GoTCount);
    }
    GameTextForAll(GTStr,1500,4);
    SoundForAll(1056);
    if(GoTCount > 0)
    {
        GoTCount--;
        SetTimer("Go",1000,0);
    }
    return 1;
}

// up to go

COMMAND:countdown(playerid, params[])
{
    if(GoTCount != 0) return SendClientMessage(playerid, Red, "countdown already on");
    SendClientMessage(playerid, Green, "count started");
    SetTimer("Go",1000,0);
    GoTCount = 5;
    return 1;
}
Reply
#7

What about the RCON thingy?
Reply
#8

Ask a second question, and also, I don't think it is possible.
Reply
#9

Then it's really ugly

it will be like this

Код:
SERVER: 3 Attempts left // mine.
SERVER: Bad admin password. Repeated attempts will get you banned. // server
but as it wont work I won't use it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)