BanEx problem
#1

I have this cmd:
pawn Код:
CMD:ban(playerid, params[])
{
    if(!CheckAdmin(playerid, ADMIN_LEVEL_1)) return NotAuthMSG(playerid);
    new id, reason[128];
    if(sscanf(params,"us[128]",id,reason)) return SyntaxMSG(playerid, "/ban [playerid/PartOfName] [reason]");
    if(!PlayerIsOn(id)) return NotConnectedMSG(playerid);
    format(msg, sizeof(msg), "AdmCmd: %s was banned by %s, reason: %s.", GetName(id), GetName(playerid), reason);
    format(query, sizeof(query), "INSERT INTO `bans` (name, reason, playerIP) VALUES ('%s', '%s', '%s')", GetName(id),reason,GetPlayerIP(id));
    mysql_function_query(dbHandle, query, true, "BanWithMSGEx", "iss", id, msg, reason);
    return 1;
}
And the cached data is:
pawn Код:
public BanWithMSGEx(playerid, message[], reason[])
{
    PlayerInfo[playerid][pBanned] = 1;
    SCMALL(0xFF4444FF, message);
    SetTimerEx("BanPlayerEx",100,0,"ds[128]",playerid,reason);
}
Timer:BanPlayerEx
pawn Код:
public BanPlayerEx(playerid, reason[])
{
    BanEx(playerid, reason);
}
And on samp.ban
127.0.0.1 [15/04/13 | 01:58:19] Drake_Jonhonson - (null)

why it's null?
Reply
#2

You cant send string in SetTimerEx

1. You dont use cache so use false
pawn Код:
mysql_function_query(dbHandle, query, false, "BanWithMSGEx", "iss", id, msg, reason);
2. Why ban? you have your own banlist so kick player
Reply
#3

Damn dude, you got a lot of custom functions there don't you? Lol.

For "PlayerIsOn", why not just use "IsPlayerConnected()"? Lol.
Reply
#4

Damn dude, you got a lot of custom functions and string defines there don't you? Lol.

For "PlayerIsOn", why not just use "IsPlayerConnected()"? Lol.
Reply
#5

Quote:
Originally Posted by zDivine
Посмотреть сообщение
Damn dude, you got a lot of custom functions and string defines there don't you? Lol.

For "PlayerIsOn", why not just use "IsPlayerConnected()"? Lol.
Because it's shorter for me and these custom things are good.

pawn Код:
stock PlayerIsOn(playerid)
{
    if(PlayerLogged(playerid) && playerid != INVALID_PLAYER_ID)
        return true;
        return false;
}

stock NotConnectedMSG(playerid)
{
    return ServerMSG(playerid, "This player is not connected.");
}
Instead of writing This player is not connected.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)