SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 16/08/2010, 05:08 PM   #1
jonnyboy
Huge Clucker
 
jonnyboy's Avatar
 
Join Date: Aug 2010
Location: Sweden
Posts: 410
Reputation: 3
Default New chat commands

- I re posted on this section becuse i posted the another one in the wrong section :S -


Hey, Im doing a chat commands and it worked when i made my commands:

Code:
#include <a_samp>
#include "../include/chat.inc"

#define MESSAGE_COLOR 		  0xEEEEEEFF
#define ECHO_COLOR 		  	  0xEEEEEEFF
#define ACTION_COLOR     	  0xEE66EEFF

//------------------------------------------------

public OnFilterScriptInit()
{
	print("\n--New Chat Commands from scratch -By JonnyBoy-.\n");
	return 1;
}

//------------------------------------------------

public OnPlayerText(playerid, text[])
{
	 if(strlen(text) > 128) return 0;

	 new to_others[MAX_CHATBUBBLE_LENGTH+1];
	 new to_me[MAX_CHATBUBBLE_LENGTH+1];

	 format(to_others,MAX_CHATBUBBLE_LENGTH,"Says: %s",text);
	 format(to_me,MAX_CHATBUBBLE_LENGTH,">> %s",text);

     SetPlayerChatBubble(playerid,to_others,MESSAGE_COLOR,35.0,10000);
     SendClientMessage(playerid,ECHO_COLOR,to_me);

     return 0; // can't do normal chat with this loaded
}

//------------------------------------------------

public OnPlayerCommandText(playerid, cmdtext[])
{
	new cmd[256];
	new Message[256];
	new	idx;
	new actiontext[MAX_CHATBUBBLE_LENGTH+1];

	cmd = strtok(cmdtext, idx);

	// Action command
	if(strcmp("/me", cmd, true) == 0)
	{
	    Message = strrest(cmdtext,idx);
	    format(actiontext,MAX_CHATBUBBLE_LENGTH,"* %s",Message);
       	SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,20.0,10000);
    	SendClientMessage(playerid,ACTION_COLOR,actiontext);
		return 1;
	}
	if(strcmp("/sa", cmd, true) == 0)
	{
	    Message = strrest(cmdtext,idx);
	    format(actiontext,MAX_CHATBUBBLE_LENGTH,"[Server Admin] %s",Message);
       	SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,10.0,10000);
    	SendClientMessage(playerid,ACTION_COLOR,actiontext);
		return 1;
	}
	if(strcmp("/ad", cmd, true) == 0)
	{
	    Message = strrest(cmdtext,idx);
	    format(actiontext,MAX_CHATBUBBLE_LENGTH,"[Admin] %s",Message);
       	SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,5.0,10000);
    	SendClientMessage(playerid,ACTION_COLOR,actiontext);
		return 1;
	}
	if(strcmp("/n", cmd, true) == 0)
	{
	    Message = strrest(cmdtext,idx);
	    format(actiontext,MAX_CHATBUBBLE_LENGTH,"[Newbie] %s",Message);
       	SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,3.0,10000);
    	SendClientMessage(playerid,ACTION_COLOR,actiontext);
		return 1;
	}
	if(strcmp("/h", cmd, true) == 0)
	{
	    Message = strrest(cmdtext,idx);
	    format(actiontext,MAX_CHATBUBBLE_LENGTH,"[Helper] %s",Message);
       	SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,3.0,10000);
    	SendClientMessage(playerid,ACTION_COLOR,actiontext);
		return 1;
	}
	if(strcmp("/race", cmd, true) == 0)
	{
	    Message = strrest(cmdtext,idx);
	    format(actiontext,MAX_CHATBUBBLE_LENGTH,"[Race] Race at %s and win 2000$! /ra for [Race] Chat!",Message);
       	SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,2.0,10000);
    	SendClientMessage(playerid,ACTION_COLOR,actiontext);
		return 1;
	}
	if(strcmp("/ra", cmd, true) == 0)
	{
	    Message = strrest(cmdtext,idx);
	    format(actiontext,MAX_CHATBUBBLE_LENGTH,"[Race] %s",Message);
       	SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,2.0,10000);
    	SendClientMessage(playerid,ACTION_COLOR,actiontext);
		return 1;
	}
	if(strcmp("/s", cmd, true) == 0)
	{
	    Message = strrest(cmdtext,idx);
	    format(actiontext,MAX_CHATBUBBLE_LENGTH,"[STOP] %s",Message);
       	SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,4.0,10000);
    	SendClientMessage(playerid,ACTION_COLOR,actiontext);
		return 1;
	}
	return 0; // not handled by this script
}

//------------------------------------------------
when im doing another chat command "Example /helpme" i get some wierd errors

and btw, how can i know what colors:

Code:
ACTION_COLOR,4.0,10000);
have?
__________________

Special thanks to [GMS]toX.
jonnyboy is offline  
Old 16/08/2010, 05:11 PM   #2
billiout
Huge Clucker
 
billiout's Avatar
 
Join Date: Apr 2010
Location: Greece
Posts: 247
Reputation: 0
Default Re: New chat commands

first show the errors, second the action_color id defined here #define ACTION_COLOR < 0xEE66EEFF> this is hex color. for more info about colors look here http://wiki.sa-mp.com/wiki/Hex_colors
__________________
Click here for my toolkit.

Last edited by billiout; 16/08/2010 at 05:23 PM.
billiout is offline  
Old 16/08/2010, 05:14 PM   #3
jonnyboy
Huge Clucker
 
jonnyboy's Avatar
 
Join Date: Aug 2010
Location: Sweden
Posts: 410
Reputation: 3
Default Re: New chat commands

html colors? Thanks!! now this will be easy

and i will show u the errors when it shows up, ok? (it comes randomly)
__________________

Special thanks to [GMS]toX.
jonnyboy is offline  
 

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
[FilterScript] [FS] Chat Commands Thrarod Filterscripts 7 04/09/2014 04:07 PM
[FilterScript] New chat commands jonnyboy Filterscripts 2 16/08/2010 05:05 PM
[FilterScript] [FS]Chat Commands patchkinson Filterscripts 3 09/07/2010 05:39 PM
[SOLVED] Chat Commands Only Cop's Smiths Help Archive 1 15/08/2009 09:10 PM
[FilterScript] [FS] Ranged Chat Commands Hecky Filterscripts 2 05/08/2009 12:06 AM


All times are GMT. The time now is 10:45 PM.


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