SA-MP Forums Archive
Help with displaying ClientMessage - 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: Help with displaying ClientMessage (/showthread.php?tid=564437)



Help with displaying ClientMessage - Blade_Cervetti - 21.02.2015

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;
}



Re: Help with displaying ClientMessage - Ritzy2K - 21.02.2015

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


Re: Help with displaying ClientMessage - Blade_Cervetti - 21.02.2015

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.


Re: Help with displaying ClientMessage - CalvinC - 21.02.2015

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.


Re: Help with displaying ClientMessage - Blade_Cervetti - 21.02.2015

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


Re: Help with displaying ClientMessage - CalvinC - 21.02.2015

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


Re: Help with displaying ClientMessage - Blade_Cervetti - 21.02.2015

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