#1

hi guys i need help i want to send this message to all player in server.i try to make but its not working.i m noob at scripting

Код:
COMMAND:aod(playerid, params[])
{
	if(playerData[playerid][playerLoggedIn])
	{
		if(playerData[playerid][playerLevel] >= 1)
		{
			// If AdminDuty is 1
			if (!playerData[playerid][playerAdminDuty])
			{
				SendClientMessage(playerid, COLOR_WHITE, "{OOFFOO}[ADMIN] {FFFFFF}You're now an on duty Administrator.");
				playerData[playerid][playerAdminDuty] = true;
				playerData[playerid][playerAdminLabel] = Create3DTextLabel("Admin on Duty", 0x00ff00ff, 30.0, 40.0, 50.0, 60.0, -1, 1);
				Attach3DTextLabelToPlayer(playerData[playerid][playerAdminLabel], playerid, 0.0, 0.0, 0.4);

				// Give them infinite health.
				SetPlayerHealth(playerid, 9999999);
				SetPlayerColor(playerid, 0x00ff00);
				TextDrawShowForPlayer(playerid, Text:AdminDuty);
                           }
                        else
			{
                         SendClientMessageToAll(COLOR_WHITE,"{00FF00}[ADMIN] {FF69A6}%s is now an on duty of Administrator.For resistance use /ask!)", playerData[playerid][tempAdminName]);
		        }
       			else

			{
				// Admin is already on duty, so we'll now put them off duty
				SendClientMessage(playerid, COLOR_WHITE, "{00FF00}[ADMIN] {FFFFFF}You're now an off duty Administrator.");
				playerData[playerid][playerAdminDuty] = false;
				Delete3DTextLabel(playerData[playerid][playerAdminLabel]);
			
				// Give them default health
				SetPlayerHealth(playerid, 100);
				newPlayerColour(playerid);
				TextDrawHideForPlayer(playerid, Text:AdminDuty);
                       }


                        else
			{
                         SendClientMessageToAll(COLOR_WHITE,"{00FF00}[ADMIN] {FF69A6}%s is now an off duty of Administrator!)", playerData[playerid][tempAdminName]);
			}
		}
		else
		{
			return 0;
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You must be logged in to use commands.");
	}
	
	return 1;
}
i just add sendclientmessagetoall part help me to fix it .
Reply
#2

https://sampwiki.blast.hk/wiki/Format
Reply
#3

i dont need wiki can u modify it for me plz
Reply
#4

If you are looking for someone to script for you, this is the right section:

https://sampforum.blast.hk/showthread.php?tid=447813

This is "Scripting Help", not "Do it for me".
Reply
#5

You can use the format like that:

PHP код:
new string[80+MAX_PLAYER_NAME]; // You can enter the number of characters inside the brackets. MAX_PLAYER_NAME = 24.
format(stringsizeof(string), "%s is now admin on-duty, please type /ask for assistance"playerData[playerid][tempAdminName]"); // Here you can format the string we defined above, you can use any other name of the defination instead of 'string', it's up to you.
SendClientMessageToAll(COLOR_WHITE, string); // Here we can send the formatted string into a client message. 
Reply
#6

Quote:
Originally Posted by TopShooter2
Посмотреть сообщение
You can use the format like that:

PHP код:
new string[80+MAX_PLAYER_NAME]; // You can enter the number of characters inside the brackets. MAX_PLAYER_NAME = 24.
format(stringsizeof(string), "%s is now admin on-duty, please type /ask for assistance"playerData[playerid][tempAdminName]"); // Here you can format the string we defined above, you can use any other name of the defination instead of 'string', it's up to you.
SendClientMessageToAll(COLOR_WHITE, string); // Here we can send the formatted string into a client message. 
No need for 80, just 54 + MAX_PLAYER_NAME.
Reply
#7

Try this:

PHP код:
CMD:aod(playeridparams[])
{
    if(
playerData[playerid][playerLoggedIn])
    {
        if(
playerData[playerid][playerLevel] >= 1)
        {
            if(!
playerData[playerid][playerAdminDuty])
            {
                    new 
string[128];
                
SendClientMessage(playeridCOLOR_WHITE"{OOFFOO}[ADMIN]{FFFFFF} You're now an on duty Administrator.");
                
playerData[playerid][playerAdminDuty] = true;
                
playerData[playerid][playerAdminLabel] = Create3DTextLabel("Admin on Duty"0x00ff00ff30.040.050.060.0, -11);
                
Attach3DTextLabelToPlayer(playerData[playerid][playerAdminLabel], playerid0.00.00.4);
                
                
//Sends message to everybody
                
format(stringsizeof(string), "{00FF00}[ADMIN] {FF69A6}%s is now an on duty Administrator. Use /ask!"playerData[playerid][tempAdminName]);
                
SendClientMessageToAll(COLOR_WHITEstring);
                
// Give them infinite health.
                
SetPlayerHealth(playerid9999999);
                
SetPlayerColor(playerid0x00ff00);
                
TextDrawShowForPlayer(playeridText:AdminDuty);
            }
            else
            {
                
// Admin is already on duty, so we'll now put them off duty
                
SendClientMessage(playeridCOLOR_WHITE"{00FF00}[ADMIN] {FFFFFF}You're now an off duty Administrator.");
                
playerData[playerid][playerAdminDuty] = false;
                
Delete3DTextLabel(playerData[playerid][playerAdminLabel]);
                
// Give them default health
                
SetPlayerHealth(playerid100);
                
newPlayerColour(playerid);
                
TextDrawHideForPlayer(playeridText:AdminDuty);
                
                
//Sends message to everybody
                
format(stringsizeof(string), "{00FF00}[ADMIN] {FF69A6}%s is now an off duty Administrator."playerData[playerid][tempAdminName]);
                
SendClientMessageToAll(COLOR_WHITEstring);
            }
        }
        else
        {
            
SendClientMessage(playeridCOLOR_WHITE"{B7B7B7}[SERVER]{FFFFFF} You're not an admin.");
        }
    }
    return 
1;

Reply
#8

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
Try this:

PHP код:
CMD:aod(playeridparams[])
{
    if(
playerData[playerid][playerLoggedIn])
    {
        if(
playerData[playerid][playerLevel] >= 1)
        {
            if(!
playerData[playerid][playerAdminDuty])
            {
                    new 
string[128];
                
SendClientMessage(playeridCOLOR_WHITE"{OOFFOO}[ADMIN]{FFFFFF} You're now an on duty Administrator.");
                
playerData[playerid][playerAdminDuty] = true;
                
playerData[playerid][playerAdminLabel] = Create3DTextLabel("Admin on Duty"0x00ff00ff30.040.050.060.0, -11);
                
Attach3DTextLabelToPlayer(playerData[playerid][playerAdminLabel], playerid0.00.00.4);
                
                
//Sends message to everybody
                
format(stringsizeof(string), "{00FF00}[ADMIN] {FF69A6}%s is now an on duty Administrator. Use /ask!"playerData[playerid][tempAdminName]);
                
SendClientMessageToAll(COLOR_WHITEstring);
                
// Give them infinite health.
                
SetPlayerHealth(playerid9999999);
                
SetPlayerColor(playerid0x00ff00);
                
TextDrawShowForPlayer(playeridText:AdminDuty);
            }
            else
            {
                
// Admin is already on duty, so we'll now put them off duty
                
SendClientMessage(playeridCOLOR_WHITE"{00FF00}[ADMIN] {FFFFFF}You're now an off duty Administrator.");
                
playerData[playerid][playerAdminDuty] = false;
                
Delete3DTextLabel(playerData[playerid][playerAdminLabel]);
                
// Give them default health
                
SetPlayerHealth(playerid100);
                
newPlayerColour(playerid);
                
TextDrawHideForPlayer(playeridText:AdminDuty);
                
                
//Sends message to everybody
                
format(stringsizeof(string), "{00FF00}[ADMIN] {FF69A6}%s is now an off duty Administrator."playerData[playerid][tempAdminName]);
                
SendClientMessageToAll(COLOR_WHITEstring);
            }
        }
        else
        {
            
SendClientMessage(playeridCOLOR_WHITE"{B7B7B7}[SERVER]{FFFFFF} You're not an admin.");
        }
    }
    return 
1;

PHP код:
                //Sends message to everybody 
                
format(stringsizeof(string), "{00FF00}[ADMIN] {FF69A6}%s is now an off duty Administrator."playerData[playerid][tempAdminName]); 
                
SendClientMessageToAll(COLOR_WHITEstring); 
This will return an error due to not defining "string". (The formatted string after else).
Reply
#9

Quote:
Originally Posted by Variable™
Посмотреть сообщение
No need for 80, just 54 + MAX_PLAYER_NAME.
I'm bad at counting words xd.
Reply
#10

Quote:
Originally Posted by Variable™
Посмотреть сообщение
PHP код:
                //Sends message to everybody 
                
format(stringsizeof(string), "{00FF00}[ADMIN] {FF69A6}%s is now an off duty Administrator."playerData[playerid][tempAdminName]); 
                
SendClientMessageToAll(COLOR_WHITEstring); 
This will return an error due to not defining "string". (The formatted string after else).
this lines give 4 error.when i use this line
new string[80+MAX_PLAYER_NAME];
it gives about 20+ error due to string

thnx for help fix now
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)