SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 28/01/2015, 08:01 PM   #1
Mijata
Gangsta
 
Mijata's Avatar
 
Join Date: Mar 2014
Location: Serbia
Posts: 632
Reputation: 8
Default HELP SendClientMessage?? +Rep

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;
    }
Mijata is offline   Reply With Quote
Old 28/01/2015, 08:03 PM   #2
Jefff
Banned
 
Join Date: Dec 2007
Posts: 2,593
Reputation: 326
Default Re: HELP SendClientMessage?? +Rep

Change [64] to [128]
Jefff is offline   Reply With Quote
Old 28/01/2015, 08:04 PM   #3
arlindi
Banned
 
Join Date: May 2014
Posts: 869
Reputation: 27
Default Re: HELP SendClientMessage?? +Rep

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

new
szString[124], // and this
arlindi is offline   Reply With Quote
Old 28/01/2015, 08:04 PM   #4
Mijata
Gangsta
 
Mijata's Avatar
 
Join Date: Mar 2014
Location: Serbia
Posts: 632
Reputation: 8
Default Re: HELP SendClientMessage?? +Rep

thanks + rep for u
Mijata is offline   Reply With Quote
Old 28/01/2015, 08:08 PM   #5
AdamsP
Little Clucker
 
Join Date: Jan 2015
Posts: 49
Reputation: 6
Default Re: HELP SendClientMessage?? +Rep

Yes bro, you need either string length 124 or 128. 128 characters is the max for Sendclientmessages.
AdamsP is offline   Reply With Quote
Old 28/01/2015, 08:12 PM   #6
Mijata
Gangsta
 
Mijata's Avatar
 
Join Date: Mar 2014
Location: Serbia
Posts: 632
Reputation: 8
Default Re: HELP SendClientMessage?? +Rep

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;
}
Mijata is offline   Reply With Quote
Old 28/01/2015, 08:18 PM   #7
Sawalha
Gangsta
 
Join Date: Jun 2012
Location: HKJ
Posts: 510
Reputation: 62
Default Re: HELP SendClientMessage?? +Rep

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.
Sawalha is offline   Reply With Quote
Old 28/01/2015, 08:20 PM   #8
arlindi
Banned
 
Join Date: May 2014
Posts: 869
Reputation: 27
Default Re: HELP SendClientMessage?? +Rep

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);
            }
         }
      }
    } 
arlindi is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SendClientMessage Bug Blackazur Scripting Help 4 05/12/2013 11:52 PM
SendClientMessage Blackazur Scripting Help 2 26/03/2013 08:14 PM
sendclientmessage help. the.et Scripting Help 5 12/01/2012 09:25 AM
TD or SendClientMessage Speed General 5 02/08/2011 09:26 PM
SendClientMessage Help Brickwood Help Archive 9 20/10/2010 07:45 AM


All times are GMT. The time now is 07:25 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.