SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 20/11/2013, 11:54 AM   #1
iOxide
Huge Clucker
 
Join Date: Nov 2013
Location: Inside PAWNO
Posts: 386
Reputation: 16
Default Player color

Ok so i have made this

pawn Code:
public OnPlayerText(playerid, text[])
{
      new playertext[128], name[MAX_PLAYER_NAME];
      GetPlayerName(playerid, name, sizeof(name));
      format(playertext, sizeof(playertext), "[%d]%s: {FFFFFF}%s", playerid, name, text);
      SendClientMessageToAll(playerid, playertext);
      return 0;
}

But when player sends a text, playerid and playername are black. How do i get the color of player and it's id? I want the name and id's color display as what color the player class has. How to fix it, please Help!
iOxide is offline   Reply With Quote
Old 20/11/2013, 12:01 PM   #2
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,067
Reputation: 2660
Default Re: Player color

Re-check the syntax of SendClientMessageToAll. Especially what variables should be put there.
__________________
Vince is offline   Reply With Quote
Old 20/11/2013, 12:15 PM   #3
iOxide
Huge Clucker
 
Join Date: Nov 2013
Location: Inside PAWNO
Posts: 386
Reputation: 16
Default Re: Player color

I just want to know how do i get the player's color depending their classes.
iOxide is offline   Reply With Quote
Old 20/11/2013, 12:29 PM   #4
newbie scripter
Gangsta
 
newbie scripter's Avatar
 
Join Date: Apr 2012
Location: Heaven <3
Posts: 798
Reputation: 34
Default Re: Player color

return 1;

This forum requires that you wait 240 seconds between posts. Please try again in 165 seconds. Faq it

Second Post of urs:

pawn Code:
public OnPlayerText(playerid, text[])
{
      new playertext[128];
     if(Rank /* replace Rank with the enum or smthing u saved with */ == the number) // then use else { if or if.
{
      format(playertext, sizeof(playertext), "[%d]%s: {FFFFFF}%s", playerid, name, text);
}
if(Rank == 5)
{
      format(playertext, sizeof(playertext), "[%d]%s: {FFFFFF}%s", playerid, name, text); // change the HEX code to the color u want
}
      SendClientMessageToAll(playerid, playertext);
      return 1;
}
__________________
SUGGESTION FOR FUTURE SA-MP
pawn Code:
forward SetWeaponRange(weaponid, maxrange); // if weapon is fist and 100 range, it may give a warn or super punch xD
forward SetWeaponRecoil(weapoinid, maxrecoil);
newbie scripter is offline   Reply With Quote
Old 20/11/2013, 12:38 PM   #5
InglewoodRoleplay
Big Clucker
 
Join Date: Oct 2013
Posts: 67
Reputation: 8
Default Re: Player color

Your SendClientMessageToAll syntax is wrong.
If you're sending a message to everyone, you shouldn't require a playerid. The string color goes where you wrote "playerid". I think -1 means white but I'm not sure.

Check this out:
http://wiki.sa-mp.com/wiki/Function:...ntMessageToAll

pawn Code:
public OnPlayerText(playerid, text[])
{
      new playertext[128], name[MAX_PLAYER_NAME];
      GetPlayerName(playerid, name, sizeof(name));
      format(playertext, sizeof(playertext), "[%d]%s: {FFFFFF}%s", playerid, name, text);
      SendClientMessageToAll(-1, playertext);
      return 0;
}
__________________
Code:
xor eax, eax
call eax
InglewoodRoleplay is offline   Reply With Quote
Old 20/11/2013, 12:39 PM   #6
iOxide
Huge Clucker
 
Join Date: Nov 2013
Location: Inside PAWNO
Posts: 386
Reputation: 16
Default Re: Player color

I tried using -1, still the same problem, didn't work ._.
iOxide is offline   Reply With Quote
Old 20/11/2013, 01:18 PM   #7
-Prodigy-
Huge Clucker
 
Join Date: Dec 2010
Posts: 398
Reputation: 45
Default Re: Player color

You mean this function http://wiki.sa-mp.com/wiki/SendPlayerMessageToAll ? If so, just replace it with "SendClientMessageToAll"
-Prodigy- is offline   Reply With Quote
Old 20/11/2013, 02:34 PM   #8
iOxide
Huge Clucker
 
Join Date: Nov 2013
Location: Inside PAWNO
Posts: 386
Reputation: 16
Default Re: Player color

I replaced SendClientMessageToAll(playerid, playertext); with SendClientMessageToAll(GetPlayerColor(playerid), playertext); and its working as i wanted lol
iOxide 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
help : color for name player morocco Scripting Help 2 26/03/2013 10:23 PM
Player color Aarab Scripting Help 3 23/02/2013 04:00 PM
[Help] Player Color Neil. Scripting Help 4 13/04/2012 08:43 PM
player color help +rep Anthony_X Scripting Help 14 11/01/2012 06:10 PM
player color Robbin237 Help Archive 0 22/04/2009 04:29 PM


All times are GMT. The time now is 08:55 PM.


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