SA-MP Forums Archive
BanEx problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: BanEx problem (/showthread.php?tid=430720)



BanEx problem - PaulDinam - 14.04.2013

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?


Re: BanEx problem - Jefff - 14.04.2013

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


Re: BanEx problem - zDivine - 14.04.2013

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

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


Re: BanEx problem - zDivine - 14.04.2013

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.


Re: BanEx problem - PaulDinam - 14.04.2013

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.