SA-MP Forums Archive
HELP SendClientMessage?? +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: HELP SendClientMessage?? +Rep (/showthread.php?tid=560492)



HELP SendClientMessage?? +Rep - Mijata - 28.01.2015

why is message is not full



Code:
public OnPlayerConnect(playerid)
{
	new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{E81010}***%s {1DB8F5}has joined the Server {00CF00}(Joined)*** !",pName);
    SendClientMessageToAll(-1,string);
    return 1;

}

public OnPlayerDisconnect(playerid, reason)
{
    new
        szString[64],
        name[MAX_PLAYER_NAME];

    GetPlayerName(playerid, name, MAX_PLAYER_NAME);

    switch(reason)
    {
        case 0: format(szString, sizeof szString, "{E81010}*** %s {1DB8F5}left the Server.{00CF00}(Timed Out/Crashed)***", name);
        case 1: format(szString, sizeof szString, "***{E81010}%s {1DB8F5}left the  Server.{00CF00}(Quit)***", name);
        case 2: format(szString, sizeof szString, "***{E81010}%s {1DB8F5}left the Server.{00CF00}(Kicked/Banned)***", name);
    }

    SendClientMessageToAll(-1, szString);
    return 1;
    }



Re: HELP SendClientMessage?? +Rep - Jefff - 28.01.2015

Change [64] to [128]


Re: HELP SendClientMessage?? +Rep - arlindi - 28.01.2015

new string[124], pName[MAX_PLAYER_NAME]; // This

new
szString[124], // and this


Re: HELP SendClientMessage?? +Rep - Mijata - 28.01.2015

thanks + rep for u


Re: HELP SendClientMessage?? +Rep - AdamsP - 28.01.2015

Yes bro, you need either string length 124 or 128. 128 characters is the max for Sendclientmessages.


Re: HELP SendClientMessage?? +Rep - Mijata - 28.01.2015

how to create here when is admin on duty message for all admin is now on duty and admin is now off duty

Quote:

CMD:aduty(playerid, params[])
{
if(pInfo[playerid][pLevel] >= 1)
{
new skin[MAX_PLAYERS];
if(OnDuty[playerid] == 0)
{
skin[playerid] = GetPlayerSkin(playerid);
SetPlayerSkin(playerid, 217);
SetPlayerHealth(playerid, 100000);
SetPlayerArmour(playerid, 100000);
SetPlayerColor(playerid, 0x01FCFFFF);
OnDuty[playerid] = 1;
}
else if(OnDuty[playerid] == 1)
{
SetPlayerSkin(playerid, skin[playerid]);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
SetPlayerColor(playerid, 0xFFFFFFFF);
OnDuty[playerid] = 0;
}
}
else
{
SendClientMessage(playerid, red, "You are not administrator.");
}
return true;
}




Re: HELP SendClientMessage?? +Rep - Sawalha - 28.01.2015

add this under those statements:
pawn Code:
new msg[128], aname[MAX_PLAYER_NAME];
if(OnDuty[playerid] == 0)
{
skin[playerid] = GetPlayerSkin(playerid);
SetPlayerSkin(playerid, 217);
SetPlayerHealth(playerid, 100000);
SetPlayerArmour(playerid, 100000);
SetPlayerColor(playerid, 0x01FCFFFF);
OnDuty[playerid] = 1;
GetPlayerName(playerid, aname, sizeof aname);
format(msg, sizeof msg, "%s is now on Administrator duty.", aname);
SendClientMessageToAll(-1, msg); // you may change -1 to any other color
}
and:
pawn Code:
else if(OnDuty[playerid] == 1)
{
SetPlayerSkin(playerid, skin[playerid]);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
SetPlayerColor(playerid, 0xFFFFFFFF);
OnDuty[playerid] = 0;
GetPlayerName(playerid, aname, sizeof aname);
format(msg, sizeof msg, "%s is now off Administrator duty.", aname);
SendClientMessageToAll(-1, msg);
}
P.S : you may define 'aname' and 'msg' variables in the command out of those statements, so you don't have to define them twice.
and , your code would be better if you add indentation to it.


Re: HELP SendClientMessage?? +Rep - arlindi - 28.01.2015

PHP Code:
CMD:aduty(playerid)
{
    if(
pInfo[playerid][pLogged] == 1)
    {
        if(
pInfo[playerid][pAdminLevel] >= 1)
        {
               if(
pInfo[playerid][pAdminDuty] == 0)
               {
            
pInfo[playerid][pAdminDuty] = 1;
SetPlayerSkin(playeridskin[playerid]);
SetPlayerHealth(playerid100);
SetPlayerArmour(playerid0);
SetPlayerColor(playerid0xFFFFFFFF);
OnDuty[playerid] = 0;
            }
            else
            {
            if(
pInfo[playerid][pAdminDuty] == 1)
            {
            
pInfo[playerid][pAdminDuty] = 0;
            
SetPlayerHealth(playerid,100);
            }
         }
      }
    }