open.mp forum
[Pawn] How i can add this to my command? - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] How i can add this to my command? (/showthread.php?tid=1685)



How i can add this to my command? - Nicolas_Belic - 2021-02-19

How can I make sure that only the players who are in my virtual world can read the message that I send, and that those who are not in my virtual world do not read the message?



Code:
CMD:gl(playerid, params[])

{

? ? new Text[132], string[128], PlayerName[MAX_PLAYER_NAME];



? ? if(sscanf(params, "s[132]", Text))

? ? {

? ? ? ? SendClientMessage(playerid, -1, "{D41818}[COMANDO]{AFAFAF} /gl <texto>");

? ? }

? ? else

? ? {

? ? ? ? GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); // storing player name first in the PlayerName variable



? ? ? ? format(string, sizeof(string), "[ID:%d - %s]: %s",playerid, PlayerName, Text); //[ID:12 - Sebasti?n Price] texto

? ? ? ? SendClientMessageToAll(0xFFFFFF00, string);

? ? }



? ? return 1;

}



RE: How i can add this to my command? - Radical - 2021-02-19

PHP Code:
foreach(new Player

{

? ? if(
GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))

? ? {

? ? ? ? 
SendClientMessage(i,?0xFFFFFF00string);

? ? }