Help with displaying ClientMessage
#1

Okay, first off, I know there has been a few posts about this, however, I've tried all the solutions I could find. I am trying to make the message appear before kicking or banning someone. I have already done the process of creating the timer and all this. So here is what my /kick cmd looks like...Anyone see anything wrong?

pawn Код:
if(strcmp(cmd, "/kick", true) == 0)
{
if(gAdminOnDuty[playerid] != 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "You must be on duty to use this command!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_USAGE, "USAGE: /kick [playerid] [reason]");
return 1;
}
new playa;
if(IsStringAName(tmp))
{
playa = GetPlayerID(tmp);
}
else
{
playa = strval(tmp);
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[144];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_USAGE, "USAGE: /kick [playerid] [reason]");
return 1;
}
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pRealAdmin] == 1)
{
format(string, sizeof(string), "AdmCmd: %s Kicked you, Reason: %s",sendername,result);
SendClientMessage(playa, COLOR_ADMIN, string);
KickTimer[playa] = SetTimerEx("KickPlayer",5000,true,"d",playa);
Kick(playa);
format(string, sizeof(string), "AdmCmd: %s Kicked %s, Reason: %s",sendername,giveplayer,result);
printf("%s",string);
KickLog(string);
format(string, sizeof(string), "AdmCmd: %s Kicked %s, Reason: %s",sendername,giveplayer,result);
SendClientMessageToAll(COLOR_ADMIN, string);
}
else
{
SendClientMessage(playerid, COLOR_RED, "Invalid admin level, you cannot use this command");
}
return 1;
}
Reply
#2

ummm i guess to show the message before kicking...the only way is timer lol...u have 5 seconds timer..? i think one second (1000) will work. and i dont see anything wrong and m also noob at scripting lol
Reply
#3

Quote:
Originally Posted by DopeX
Посмотреть сообщение
ummm i guess to show the message before kicking...the only way is timer lol...u have 5 seconds timer..? i think one second (1000) will work. and i dont see anything wrong and m also noob at scripting lol
The 5 secs was just to test to see if the messages where showing to the "playa". Even with a 5 second timer, the messages are still not showing.
Reply
#4

You're still kicking the player regardless of the timer?
pawn Код:
KickTimer[playa] = SetTimerEx("KickPlayer",5000,true,"d",playa);
Kick(playa);
You should only have the kick function inside the timer.
Reply
#5

LOL, I looked right over this. Ill try that now and post with the results.
Reply
#6

Also, i just noticed you've set the timer to true, meaning it will keep repeating untill you use KillTimer, set it to false.
Reply
#7

Thanks bub. It all works now. +rep. I greatly appreciate the help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)