SA-MP Forums Archive
Skipping SendClientMessage - 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: Skipping SendClientMessage (/showthread.php?tid=456420)



Skipping SendClientMessage - Rokzlive - 05.08.2013

I got a ban function that does EVERYTHING except sends the client message. Wtf?

pawn Код:
public DynBan(playerid,days,reason[])
{
    new IP[16];
    GetPlayerIp(playerid, IP, sizeof(IP));
    new Query[200];
    new BanTime = days * 86400;
    new FinalBanTime = gettime() + BanTime;
    format(Query,sizeof(Query),"INSERT INTO `bans` (`username`,`ip`,`reason`,`time`) VALUES ('%s','%s','%s','%i')",PlayerName(playerid),IP,reason,FinalBanTime);
    mysql_query(Query);
    new String[200];
    format(String,sizeof(String),"You have been banned for %i days for %s!",days,reason);
    SendClientMessage(playerid,COLOR_RED,String);
    Kick(playerid);
    return 1;
}



Re: Skipping SendClientMessage - SuperViper - 05.08.2013

http://forum.sa-mp.com/showthread.ph...35#post2438435


Re: Skipping SendClientMessage - Rokzlive - 05.08.2013

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
So basically i have to delay it.


Re: Skipping SendClientMessage - Edix - 05.08.2013

or you could make it so it will send the msg first and then by the time it gives the ban he might get the msg.


Re: Skipping SendClientMessage - Luis- - 05.08.2013

Quote:
Originally Posted by Edix
Посмотреть сообщение
or you could make it so it will send the msg first and then by the time it gives the ban he might get the msg.
That wouldn't work, you need to set a timer.


Re: Skipping SendClientMessage - George_Fratelli - 06.08.2013

pawn Код:
public DynBan(playerid,days,reason[])
{
    new IP[16];
    GetPlayerIp(playerid, IP, sizeof(IP));
    new Query[200];
    new BanTime = days * 86400;
    new FinalBanTime = gettime() + BanTime;
    format(Query,sizeof(Query),"INSERT INTO `bans` (`username`,`ip`,`reason`,`time`) VALUES       ('%s','%s','%s','%i')",PlayerName(playerid),IP,reason,FinalBanTime);
    mysql_query(query);
    new String[200];
    format(String,sizeof(String),"You have been banned for %i days for %s!",days,reason);
    SendClientMessage(playerid,COLOR_RED,String);
    KickPlayer(playerid);
    return 1;
}

pawn Код:
stock KickPlayer(playerid)
{
    SetPVarInt(playerid, "PlayerKicked", 1);
    SetTimerEx("KickTimer", 5, false, "i", playerid);
    return 1;
}
Add this stock and the public below.

pawn Код:
forward KickTimer(playerid);
public KickTimer(playerid)
{
    Kick(playerid);
    return 1;
}