OnPlayerText 1 problem
#1

I have sucessfully made Auto-Tag means if a player is in Gang ID 5 then [TAG] Will be shown but it is only working for 1 person, Not for all players in that gang! Heres that part of onplayertext
Код:
                    if(gangData[playerid][gangID] == 5)
                    /*if(gangData[i][gangID] == 5)*/
                    {
                        format(tag, sizeof(tag),"{%s}[BL]%s(%i): {FFFFFF}%s", color, playerData[playerid][playerNamee], playerid, text);
                    }
                    else
                    {
                        format(tag, sizeof(tag),"{%s}%s(%i): {FFFFFF}%s", color, playerData[playerid][playerNamee], playerid, text);
                    }
                    SendClientMessageToAll(COLOR_WHITE, tag);
Complete OnPlayerText:-
Код:
public OnPlayerText(playerid, text[])
{
	if(playerData[playerid][playerLoggedIn])
	{
	    if (playerData[playerid][playerScore] < 4)
    	{
    	    TextDrawSetString(chat, "You need to have atleast 5 score to chat!");
            TextDrawHideForPlayer(playerid, chat);
            TextDrawShowForPlayer(playerid, chat);
           	SetTimerEx("chat1", 3000, false, "i", playerid);
	        return 0;
	    }
        if(text[0] == '@' && playerData[playerid][playerLevel] >= 1)
		{
	 	    new string[128];
	 		GetPlayerName(playerid, string, sizeof(string));
	        format(string, sizeof(string), "{47476B}[Admin Chat] {FFFFFF}%s: %s", string, text[1]);
			adminchat(COLOR_WHITE, string);
	        return 0;
	    }
	    else if(text[0] == '#' && playerData[playerid][playerHelper] == 1)
		{
	 	    new string[128];
	 		GetPlayerName(playerid, string, sizeof(string));
	        format(string, sizeof(string), "{A5DF00}[Helper Chat] {FFFFFF}%s: %s", string, text[1]);
			helperchat(COLOR_WHITE, string);
	        return 0;
	    }
	    else
	    {
			if (playerData[playerid][playerMuteTime] != 0)
			{
			    new message[128];
				format(message, sizeof(message), "{FFDC2E}[MUTED] {FFFFFF}You are muted for another {FFDC2E}%i {FFFFFF}seconds and cannot talk!", playerData[playerid][playerMuteTime]);
				SendClientMessage(playerid, COLOR_WHITE, message);
				return 0;
			}
			else
			{
			    if (FindIP(text))
			    {
		            SendClientMessage(playerid, COLOR_WHITE, "{FFDC2E}[SPAM] {FFFFFF}Advert detected! If this occurs frequently, you will be kicked.");
		            playerData[playerid][adDetected]++;
                    new administratorAlert[256];
					format(administratorAlert, sizeof(administratorAlert), "{C73E3E}[ADVERTISING] {FFFFFF}%s(%d): %s", playerData[playerid][playerNamee], playerid, text);
					adminchat(COLOR_WHITE, administratorAlert);
		            if (playerData[playerid][adDetected] == 2)
		            {
		                // Kick
		                KickWithMessage(playerid, "You have been kicked for advertising.");
		            }

		            return 0;
				}


	    		if(strfind(text, "asshole", true) != -1 || strfind(text, "fuck", true) != -1 || strfind(text, "fucker", true) != -1 || strfind(text, "fuk", true) != -1 || strfind(text, "bitch", true) != -1 || strfind(text, "assfuck", true) != -1)
			    {
		            SendClientMessage(playerid, COLOR_WHITE, "{FFDC2E}[ABUSE] {FFFFFF}Please donot abuse.");
		            return 0;
			    }

			    if (playerData[playerid][messageCount] != 3)
			    {
					new tag[400], color[20];

					switch(playerData[playerid][playerClass])
					{
						case 0, 6, CLASS_FIREFIGHTER:
						{
							if(playerData[playerid][playerWantedLevel] == 0)
							{
								if (playerData[playerid][vipColour])
								{
									color = "58D3F7";
								}
								else
								{
									if(playerData[playerid][playerClass] == CLASS_MEDIC)
									{
										// Medic Colour
									    color = "F78181";
									}
									else if(playerData[playerid][playerClass] == CLASS_FIREFIGHTER)
									{
										color = "9C3D36";
									}
									else
									{
										color = "FFFFFF";
									}
								}
							}

							if (playerData[playerid][playerWantedLevel] >= 1)
							{
								// Yellow Wanted Level
								color = "FFEC41";
							}

							if(playerData[playerid][playerWantedLevel] >= 6)
							{
								// Orange Wanted Level
								color = "DF802D";
							}

							if(playerData[playerid][playerWantedLevel] >= 25)
							{
								// Red Wanted Level
							    color = "D92C3C";
							}
						}

						case 1: // Police
						{
							if (playerData[playerid][vipColour])
							{
								color = "58D3F7";
							}
							else
							{
								color = "3E7EFF";
							}
						}
						case 2: // FBI
						{
							if (playerData[playerid][vipColour])
							{
								color = "58D3F7";
							}
							else
							{
								color = "8F48F5";
							}
						}
						case 3: // CIA
						{
							if (playerData[playerid][vipColour])
							{
								color = "58D3F7";
							}
							else
							{
								color = "2F205B";
							}
						}
						case 4: // Army
						{
							if (playerData[playerid][vipColour])
							{
								color = "58D3F7";
							}
							else
							{
								color = "1C3EFF";
							}
						}
						case 7: // Secret Service
						{
							if (playerData[playerid][vipColour])
							{
								color = "58D3F7";
							}
							else
							{
								color = "2F205B";
							}
						}
					}

					if (playerData[playerid][playerAdminDuty]) // Admin On Duty
					{
					    color = "063684";
					}

                    if(gangData[playerid][gangID] == 5)
                    /*if(gangData[i][gangID] == 5)*/
                    {
                        format(tag, sizeof(tag),"{%s}[BL]%s(%i): {FFFFFF}%s", color, playerData[playerid][playerNamee], playerid, text);
                    }
                    else
                    {
                        format(tag, sizeof(tag),"{%s}%s(%i): {FFFFFF}%s", color, playerData[playerid][playerNamee], playerid, text);
                    }
                    SendClientMessageToAll(COLOR_WHITE, tag);


					playerData[playerid][messageCount]++;
					KillTimer(playerData[playerid][spamTimer]);
					playerData[playerid][spamTimer] = SetTimerEx("StopSpam", 2000, false, "i", playerid);
				}
				else
				{
				    	TextDrawSetString(spam, "Please don't spam!");
                        TextDrawHideForPlayer(playerid, spam);
                        TextDrawShowForPlayer(playerid, spam);
                      	SetTimerEx("spam1", 3000, false, "i", playerid);
				}
		    }
		}
	}

	return 0;
}
Reply
#2

How do i use for(i) in this??
Reply
#3

What happens with other guys when they use it?
Reply
#4

Nothing happens, When two guys from same gang join, It shows tag for only one not for both :/
Reply
#5

Quote:
Originally Posted by TheBeastKhan
Посмотреть сообщение
How do i use for(i) in this??
PHP код:
if(!strcmp(text[0], "!") && gangData[playerid][gangID] == 5)//Try this
                
                    
{
                        
format(tagsizeof(tag),"{%s}[BL]%s(%i): {FFFFFF}%s"colorplayerData[playerid][playerNamee], playeridtext);
                    }
                    else
                    {
                        
format(tagsizeof(tag),"{%s}%s(%i): {FFFFFF}%s"colorplayerData[playerid][playerNamee], playeridtext);
                    }
                    
SendClientMessageToAll(COLOR_WHITEtag); 
Reply
#6

Dude you're lazy asf!

I already answered you in your older post but you aren't taking look at it and your just making new thread that contains the same problem...


Btw you've got to use Loop:

PHP код:
                    for(new 0MAX_PLAYERSi++) 
                    { 
                    if(
gangData[i][gangID] == 5
                    { 
                        
format(tagsizeof(tag),"{%s}[BL]%s(%i): {FFFFFF}%s"colorplayerData[playerid][playerNamee], playeridtext); 
                    } 
                    else 
                    { 
                        
format(tagsizeof(tag),"{%s}%s(%i): {FFFFFF}%s"colorplayerData[playerid][playerNamee], playeridtext); 
                    } 
                    
SendClientMessageToAll(COLOR_WHITEtag); 
                    } 
Reply
#7

Quote:
Originally Posted by RxErT
Посмотреть сообщение
Dude you're lazy asf!

I already answered you in your older post but you aren't taking look at it and your just making new thread that contains the same problem...


Btw you've got to use Loop:

PHP код:
                    for(new 0MAX_PLAYERSi++) 
                    { 
                    if(
gangData[i][gangID] == 5
                    { 
                        
format(tagsizeof(tag),"{%s}[BL]%s(%i): {FFFFFF}%s"colorplayerData[playerid][playerNamee], playeridtext); 
                    } 
                    else 
                    { 
                        
format(tagsizeof(tag),"{%s}%s(%i): {FFFFFF}%s"colorplayerData[playerid][playerNamee], playeridtext); 
                    } 
                    
SendClientMessageToAll(COLOR_WHITEtag); 
                    } 
Wait, What? Why a loop there? OnPlayerText is called per player already.. you dont have to add any loop there.
Reply
#8

But still without loop, it works for only one person :/
Reply
#9

Is it a specific ID or specific name? I mean for whom this code works?
Reply
#10

Like, why 5 man? What's so special about 5?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)