HELP SendClientMessage?? +Rep
#1

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;
    }
Reply
#2

Change [64] to [128]
Reply
#3

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

new
szString[124], // and this
Reply
#4

thanks + rep for u
Reply
#5

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

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

Reply
#7

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.
Reply
#8

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


Forum Jump:


Users browsing this thread: 1 Guest(s)