SendClientMessageToAll +1 rep - 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: SendClientMessageToAll +1 rep (
/showthread.php?tid=520108)
SendClientMessageToAll +1 rep -
[SU]Spartan - 17.06.2014
Hello,
I forgot usage.
I got this code
Код:
if (strcmp("/afk", cmdtext, true) == 0)
{
SendClientMessage(playerid, 0xFFFF00C8 , "You have activated AFK mode,Use /back to return to the game!");
SetPlayerHealth(playerid, 1000000000);
TogglePlayerControllable(playerid,0);
return 1;
}
How will I add the message "[INFO] Player (player's name) is now AFK!"? Also help me at (player's name)i dont remember how to add his name to be shown.
+1 Rep will be given!
Re: SendClientMessageToAll +1 rep -
Rittik - 17.06.2014
pawn Код:
if (strcmp("/afk", cmdtext, true) == 0)
{
new name[128],str[128];
SendClientMessage(playerid, 0xFFFF00C8 , "You have activated AFK mode,Use /back to return to the game!");
SetPlayerHealth(playerid, 1000000000);
TogglePlayerControllable(playerid,0);
GetPlayerName(playerid,name,sizeof(name));
format(str,sizeof(str),"[INFO] Player (%s) is now AFK!",name);
SendClientMessageToAll(-1,str);
return 1;
}
Re: SendClientMessageToAll +1 rep -
Konstantinos - 17.06.2014
https://sampwiki.blast.hk/wiki/GetPlayerName
https://sampwiki.blast.hk/wiki/Format
https://sampwiki.blast.hk/wiki/SendClientMessageToAll
Re: SendClientMessageToAll +1 rep -
Threshold - 17.06.2014
pawn Код:
if(!strcmp("/afk", cmdtext, true))
{
SendClientMessage(playerid, 0xFFFF00C8 , "You have activated AFK mode. Use /back to return to the game!");
SetPlayerHealth(playerid, 99999.0);
TogglePlayerControllable(playerid, 0);
new fstr[55], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(fstr, sizeof(fstr), "[INFO] Player %s is now AFK.", name);
SendClientMessageToAll(-1, fstr);
return 1;
}
Sources:
https://sampwiki.blast.hk/wiki/Format
https://sampwiki.blast.hk/wiki/GetPlayerName
https://sampwiki.blast.hk/wiki/SendClientMessageToAll
Re: SendClientMessageToAll +1 rep -
Sojo12 - 17.06.2014
Remove did not refresh.
Re: SendClientMessageToAll +1 rep -
[SU]Spartan - 17.06.2014
thanks you guys.I wil try to give repuration to all of you today.
Re: SendClientMessageToAll +1 rep -
Kimossab - 17.06.2014
https://sampwiki.blast.hk/wiki/Function:...ntMessageToAll
https://sampwiki.blast.hk/wiki/GetPlayerName
https://sampwiki.blast.hk/wiki/Format
You'll need those 3 functions ^
when you don't know what funtion it is just go to ****** and search for what you want, like "Player Name samp wiki" and you'll get it right away.
anyway, since I'm in a coding mood here's what you have to do:
pawn Код:
if (strcmp("/afk", cmdtext, true) == 0)
{
new String[280], Name[MAX_PLAYER_NAME];
SendClientMessage(playerid, 0xFFFF00C8 , "You have activated AFK mode,Use /back to return to the game!");
GetPlayerName(playerid, Name, sizeof(Name));
format(String, sizeof(String), "[INFO] %d (%s) is now AFK!", playerid, Name);
SendClientMessageToAll(0xFFFF00C8 , String);
SetPlayerHealth(playerid, 1000000000);
TogglePlayerControllable(playerid,0);
return 1;
}
EDIT:
Seriously, my net is so pro, just noticed that this topic got over helped xD