Undefined symbol
#1

If I change this code:

Код:
forward BanPublic(playerid);
public BanPublic(playerid);
stock BanWithMessage(playerid, message[])
{
    SendClientMessage(playerid, 0xFF4444FF, "Jūs uћblokuotas! Uћblokavo neteisingai? Pildyk unban anketą fr.tt.lt");
    SetTimerEx("BanPublic", 1000, 0, "d", playerid);
}
To:

Код:
forward BanPublic(playerid);
public BanPublic(playerid);
stock BanWithMessage(playerid, str[])
{
    SendClientMessage(playerid, 0xFF4444FF, "Jūs uћblokuotas! Uћblokavo neteisingai? Pildyk unban anketą fr.tt.lt");
    SetTimerEx("BanPublic", 1000, 0, "d", playerid);
}
Ban cmd:

Код:
CMD:ban( playerid, params[ ] )
{
    if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage( playerid, -1, "Tu ne administratorius!" );
    new
        id,
        reason[ 64 ]
    ;
    if(sscanf( params, "us[64]", id, reason ) ) return SendClientMessage( playerid, -1, "Naudojimas: /ban [Nickas] [Prieћastis]" );
    if( !IsPlayerConnected( id ) || id == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, "Tokio ћaidėjo nėra." );
    if(PlayerInfo[id][pPadmin] == 1) return SendClientMessage(playerid, -1, "Ką čia darai?");
    new
        str[ 128 ],
        pName[ MAX_PLAYER_NAME ],
        aName[ MAX_PLAYER_NAME ]
    ;
    GetPlayerName( playerid, aName, MAX_PLAYER_NAME );
    GetPlayerName( id, pName, MAX_PLAYER_NAME );
    format( str, sizeof( str ), "%s Uћblokavo ћaidėją %s. (Prieћastis: %s)", aName, pName, reason );
    SendClientMessageToAll( -1, str );
    BanWithMessage(id, str);
    return 1;
}
I get error undefined symbol "str". Str define is in ban cmd, how can I bypass this error?
Reply
#2

Try this.

PS: dont put a stock inside a callback
and you can make new str[size]; instead of putting in stock BanWithMessage(playerid, str[])

pawn Код:
CMD:ban( playerid, params[ ] )
{
    if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage( playerid, -1, "Tu ne administratorius!" );
    new
        id,
        reason[ 64 ]
    ;
    if(sscanf( params, "us[64]", id, reason ) ) return SendClientMessage( playerid, -1, "Naudojimas: /ban [Nickas] [Prieћastis]" );
    if( !IsPlayerConnected( id ) || id == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, "Tokio ћaidejo nera." );
    if(PlayerInfo[id][pPadmin] == 1) return SendClientMessage(playerid, -1, "Ka cia darai?");
    new
        str[ 128 ],
        pName[ MAX_PLAYER_NAME ],
        aName[ MAX_PLAYER_NAME ]
    ;
    GetPlayerName( playerid, aName, MAX_PLAYER_NAME );
    GetPlayerName( id, pName, MAX_PLAYER_NAME );
    format( str, sizeof( str ), "%s Uћblokavo ћaideja %s. (Prieћastis: %s)", aName, pName, reason );
    SendClientMessageToAll( -1, str );
    SetTimerEx("BanPublic", 1000, 0, "d", playerid);
    return 1;
}

forward BanPublic(playerid);
public BanPublic(playerid)
{
    SendClientMessage(playerid, 0xFF4444FF, "Jus uћblokuotas! Uћblokavo neteisingai? Pildyk unban anketa fr.tt.lt");
    BanEx( playerid, "BanPublic" );
    return 1; //you can also use true = 1
}
Reply
#3

Quote:
Originally Posted by pds2012
Посмотреть сообщение
Try this.

PS: dont put a stock inside a callback
and you can make new str[size]; instead of putting in stock BanWithMessage(playerid, str[])

pawn Код:
forward BanPublic(playerid);
public BanPublic(playerid);
{
    SendClientMessage(playerid, 0xFF4444FF, "Jus uћblokuotas! Uћblokavo neteisingai? Pildyk unban anketa fr.tt.lt");
    SetTimerEx("BanPublic", 1000, 0, "d", playerid);
    return 1;
}
C:\Users\Lauris1\Desktop\failai\Servas\gamemodes\b om.pwn(2370) : error 055: start of function body without function header
C:\Users\Lauris1\Desktop\failai\Servas\gamemodes\b om.pwn(2373) : error 010: invalid function or declaration
Reply
#4

Try again, because i did not see that you edited the post and added the command check it, again
Reply
#5

Quote:
Originally Posted by pds2012
Посмотреть сообщение
Try again, because i did not see that you edited the post and added the command check it, again
Same errors. Lines:

forward BanPublic(playerid);
public BanPublic(playerid);
{
SendClientMessage(playerid, 0xFF4444FF, "Jus uћblokuotas! Uћblokavo neteisingai? Pildyk unban anketa fr.tt.lt");
BanEx( playerid, "BanPublic" );
return 1;
}
Reply
#6

ok try again, i forgot to remove ; on public BanPublic
Reply
#7

In samp.ban file writes:

127.0.0.1 [14/02/13 | 18:32:27] Geraldelis - BanPublic

How to make to show admin which banned and reason?
Reply
#8

you need to make your own ban system which save's on scriptfiles and something like scriptfiles/ban.txt.
Reply
#9

Quote:
Originally Posted by Louris
Посмотреть сообщение
In samp.ban file writes:

127.0.0.1 [14/02/13 | 18:32:27] Geraldelis - BanPublic

How to make to show admin which banned and reason?
GetPlayerName(playerid, const name[], len) to get the players name, save the name inside a variable, format the name to a message, then write the formatted message to the text file. I wont be giving you the code, try to create it yourself and learn! Good luck it's really not hard.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)