SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 19/09/2018, 08:45 AM   #11
xMoBi
Big Clucker
 
xMoBi's Avatar
 
Join Date: Jul 2017
Location: Islamic Republic of Pakistan
Posts: 110
Reputation: 26
Default Re: Using ! or # as a command?

PHP Code:
if (text[0] == '#' && text[1] != EOS
Use this.
xMoBi is offline   Reply With Quote
Old 23/09/2018, 10:05 PM   #12
CrystalMethod
Big Clucker
 
CrystalMethod's Avatar
 
Join Date: Dec 2011
Location: Grand Rapids, MI
Posts: 105
Reputation: 14
Default Re: Using ! or # as a command?

Quote:
Originally Posted by xMoBi View Post
PHP Code:
if (text[0] == '#' && text[1] != EOS
Use this.
Still sends like [ADMIN CHAT]Player: #text
:/
__________________

https://discord.gg/TaAXEth
UNDER DEVELOPMENT
CrystalMethod is offline   Reply With Quote
Old 23/09/2018, 10:26 PM   #13
Undef1ned
Big Clucker
 
Undef1ned's Avatar
 
Join Date: Aug 2018
Location: Venezuela
Posts: 190
Reputation: 12
Default Re: Using ! or # as a command?

Pass me the full administrator chat code to help you.
Undef1ned is offline   Reply With Quote
Old 23/09/2018, 10:28 PM   #14
CrystalMethod
Big Clucker
 
CrystalMethod's Avatar
 
Join Date: Dec 2011
Location: Grand Rapids, MI
Posts: 105
Reputation: 14
Default Re: Using ! or # as a command?

Quote:
Originally Posted by Undef1ned View Post
Pass me the full administrator chat code to help you.
Code:
if (text[0] == '#' && text[1] != EOS)
    {
        // Setup local variables
	new Name[24], Msg[128], Message[128];

	// Send the command to all admins so they can see it
	SendAdminText(playerid, "#", text);

	// Get the player's name
	GetPlayerName(playerid, Name, sizeof(Name));

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the player is an admin
		if (APlayerData[playerid][PlayerLevel] > 0)
		{
			if (sscanf(text, "s[128]", Message)) SendClientMessage(playerid, 0xFF0000AA, "[SERVER] Usage: \"# <Your Message>\"");
			else
			{
				// Loop through all players
				for (new i; i < MAX_PLAYERS; i++)
				{
				    // Check if the player is logged in
					if (APlayerData[i][LoggedIn] == true)
					{
					    // Check if the other player is also an admin
					    if (APlayerData[i][PlayerLevel] > 0)
					    {
							format(Msg, 128, "[ADMIN CHAT] {faff00}%s: %s", Name, Message);
							SendClientMessage(i, 0xfaff00FF, Msg);
					    }
					}
				}
			}
		}
		else
		    return 0;
	}
	else
	    return 0;

	// Let the server know that this was a valid command
	return 0;
    }
__________________

https://discord.gg/TaAXEth
UNDER DEVELOPMENT
CrystalMethod is offline   Reply With Quote
Old 23/09/2018, 10:41 PM   #15
Undef1ned
Big Clucker
 
Undef1ned's Avatar
 
Join Date: Aug 2018
Location: Venezuela
Posts: 190
Reputation: 12
Default Re: Using ! or # as a command?

PHP Code:
if(text[0] == '#' && (APlayerData[playerid][PlayerLevel] >= || IsPlayerAdmin(playerid)))
    {
        
// Setup local variables
        
new Name[24], Msg[145];

        
// Send the command to all admins so they can see it
        
SendAdminText(playerid"#"text);

        
GetPlayerName(playeridNameMAX_PLAYER_NAME);
        
        if(
APlayerData[playerid][LoggedIn])
        {
            for(new 
0GetPlayerPoolSize(); <= ji++)
            {
                if(
IsPlayerConnected(i))
                {
                    if(
IsPlayerAdmin(i) || APlayerData[i][PlayerLevel])
                    {
                        if(
APlayerData[i][LoggedIn])
                        {
                            
format(Msgsizeof(Msg), "[ADMIN CHAT] {faff00}%s: %s"Nametext[1]);
                            
SendClientMessage(i0xfaff00FFMsg);
                        }
                    }
                }
            }
        }
        return 
0;
    } 
Undef1ned is offline   Reply With Quote
Old 24/09/2018, 01:03 AM   #16
CrystalMethod
Big Clucker
 
CrystalMethod's Avatar
 
Join Date: Dec 2011
Location: Grand Rapids, MI
Posts: 105
Reputation: 14
Default Re: Using ! or # as a command?

Great, thank you so much!
__________________

https://discord.gg/TaAXEth
UNDER DEVELOPMENT
CrystalMethod is offline   Reply With Quote
Old 24/09/2018, 06:57 AM   #17
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 15,129
Reputation: 3171
Default Re: Using ! or # as a command?

Use y_comands, it has this natively.
Y_Less is online now   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
Help with YCMD proces command and problem with "Server:Unknown command JoDe Scripting Help 1 20/04/2018 12:12 PM
[Plugin] mcmd Command Engine - Plugin based command processing Mellnik Plugin Development 108 08/05/2016 01:55 PM
i had this command in my gamemode, when i type this in game,it tells server unknow command? Chrisli520 Scripting Help 3 24/11/2013 10:02 AM
Executed ZCMD command returns SERVER: Unknown Command SexTourist Scripting Help 12 03/01/2012 03:38 PM
Slap command returns an Unknown Command when player is not connected HydraX Help Archive 16 01/08/2011 05:19 AM


All times are GMT. The time now is 12:29 AM.


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