+Rep if you Help me.
#1

Everything on the server works out just fine, except, when I connect as the first player, I get ID(0) And my name is QWERTY on the server.

The second player that connects Get's ID(1) and his name is ASDFGH.


Now to the problem, ID(1) Sees my name as QWERTY but when I myself, type in the chat, I see my own name as ASDFGH.

If ASDFGH connects to the server first and gets ID(0) and I connect to the server and gets ID(1).
I see his name as ASDFGH but when he types in the chat he sees his own name as QWERTY.


What's causing this?
Been trying all day to find a solution for this without any results.
Reply
#2

well maybe your
pawn Код:
public OnPlayerText
is messed up
Reply
#3

What do you use to get the name of the player? A custom one or just GetPlayerName? Is the word QUERTY in of your script? Perhaps, hidden in an include?
Reply
#4

Alright, let's try to solve this then. I am using 1 FS's with a Gamemode.

Gamemode: LuxAdmin 1.6.
FS: Chat bot.

PHP код:
#include <a_samp>
#define MAX_MESSAGES 100
#define TIMER 600000 // This will set the Timer Length (Miliseconds) For the Random Messages
#define COLOR_BOT 0x808080FF // This will set the Bot's Color (Pink by Default)
new BotName[24] = "Overkill"// This will set the Bot's Name
new RANDOMMSG 1// 1 = On - 0 = Off  ( 0 = only SendBotMessage() without RandomMessage - 1 = Everything will work)
new MAXMESSAGE;
new 
BOTMESSAGE[MAX_PLAYERS][128];
forward Random(playerid);
new 
RandomMsg[][] =
{
        
"Hello,",
        
"Heya, ",
        
"Not now, I'm busy. Fuck you ",
        
"Wazzap, "
};
public 
OnFilterScriptInit()
{
        if(
RANDOMMSG == 1)
        {
                
SetTimer("SendRandomMessage",TIMER,1);
        }
        
AddRandomMessage("Did you know, you can talk with me?.");
        
AddRandomMessage("Do you enjoy this server? Come back Tomorrow!.");
        
AddRandomMessage("Is someone breaking the rules? Use /Report (ID) (Reason).");
        
AddRandomMessage("Respect the Staff and the Players around you or leave!.");
        print(
"Chatbot Loaded!");
        return 
1;
}
public 
OnPlayerConnect(playerid)
{
        
SendBotMessage("Welcome to the Server. Please Read the /rules or I'll rape you :).");
        return 
1;
}
forward SendRandomMessage();
public 
SendRandomMessage()
{
        for(new 
playerid=0;playerid<MAX_PLAYERS;playerid++)
        {
            if(
IsPlayerConnected(playerid)==&& GetPlayerColor(playerid) != 0)
            {
                        new 
pName[18];
                        
format(pName,sizeof(pName),"%s",PlayerName(playerid));
                        new 
ColorSave GetPlayerColor(playerid);
                        
SetPlayerColor(playerid,COLOR_BOT);
                        
SetPlayerName(playerid,BotName);
                        
SendPlayerMessageToAll(playerid,BOTMESSAGE[random(MAXMESSAGE)]);
                        
SetPlayerColor(playerid,ColorSave);
                        
SetPlayerName(playerid,pName);
                        return 
1;
                }
        }
        return 
1;
}
forward SendBotMessage(msg[]);
public 
SendBotMessage(msg[])
{
        for(new 
playerid=0;playerid<MAX_PLAYERS;playerid++)
        {
            if(
IsPlayerConnected(playerid)==&& GetPlayerColor(playerid) != 0)
            {
                        new 
pName[18];
                        
format(pName,sizeof(pName),"%s",PlayerName(playerid));
                        new 
ColorSave GetPlayerColor(playerid);
                        
SetPlayerColor(playerid,COLOR_BOT);
                        
SetPlayerName(playerid,BotName);
                        
SendPlayerMessageToAll(playerid,msg);
                        
SetPlayerColor(playerid,ColorSave);
                        
SetPlayerName(playerid,pName);
                        return 
1;
                }
        }
        return 
1;
}
stock AddRandomMessage(msg[])
{
        
format(BOTMESSAGE[MAXMESSAGE],128,"%s",msg);
        
MAXMESSAGE++;
        return 
1;
}
stock PlayerName(playerid)
{
        new 
pName2[MAX_PLAYER_NAME];
        
GetPlayerName(playeridpName2MAX_PLAYER_NAME);
        return 
pName2;
}
public 
OnPlayerText(playeridtext[])
{
    if(!
strcmp(text"Fuck you"true))
        {
        
SendPlayerMessageToAll(playeridtext);
        
SendBotMessage("HEY! Behave or get Fucked yourself!.");
        return 
0;
        }
    if(!
strcmp(text"How are you today bot?"true) || !strcmp(text"How are you today bot"true))
        {
        
SendPlayerMessageToAll(playeridtext);
        
SendBotMessage("Fine as a fuck, thnx! :D");
        return 
0;
        }
      if(!
strcmp(text"Any Admin here?"true) || !strcmp(text"Any Admin?"true) ||
        !
strcmp(text"Admin here?"true) || !strcmp(text"Admin online?"true) ||
        !
strcmp(text"Admin on?"true) || !strcmp(text"Any Admin here"true))
        {
        
SendPlayerMessageToAll(playeridtext);
        
SendBotMessage("Type /Admins to see the Online Admins.");
        return 
0;
        }
     if(!
strcmp(text"What are you doing bot"true) || !strcmp(text"What are you doing bot?"true))
        {
        
SendPlayerMessageToAll(playeridtext);
        
SendBotMessage("Oh, you know... 0101001011 Stuff, thnx for asking! :).");
        return 
0;
        }
     if(!
strcmp(text"Hacker"true))
        {
        
SendPlayerMessageToAll(playeridtext);
        
SendBotMessage("A Hacker?!? Try to contact an Admin or Use /Report (ID) (Reason) immediately! :@.");
        return 
0;
        }
    if(!
strcmp(text"How to be Admin"true) || !strcmp(text"How to be Admin?"true))
        {
        
SendPlayerMessageToAll(playeridtext);
        
SendBotMessage("You can't!.");
        return 
0;
        }
     if(!
strcmp(text"How to be VIP"true) || !strcmp(text"How to Be VIP?"true))
        {
        
SendPlayerMessageToAll(playeridtext);
        
SendBotMessage("Interested in VIP? Visit the Forum and make an application.");
        return 
0;
        }
    if(!
strcmp(text"Hahahahaha"true))
        {
        
SendPlayerMessageToAll(playeridtext);
        
SendBotMessage("HAHAHAHA!!! XDXDXD LOLOLOLOL!");
        return 
0;
        }
     if(!
strcmp(text"SERVERINFO"true))
        {
        
SendPlayerMessageToAll(playeridtext);
        
SendBotMessage("==========Bot==========");
        
SendBotMessage("Created on: ");
        
SendBotMessage("Created by: ");
        
SendBotMessage("Admins: , ");
        
SendBotMessage("VIP: ");
        
SendBotMessage("Max Players:");
        
SendBotMessage("==========Bot==========");
        return 
0;
        }
    if(!
strcmp(text"Hi bot"true) || !strcmp(text"Sup bot"true) || !strcmp(text"Wazza bot"true) || !strcmp(text"Hey bot"true))
        {
        
SendPlayerMessageToAll(playeridtext);
        
Random(playerid);
        return 
0;
        }
    return 
1;
}
public 
Random(playerid)
{
                new 
str[128];
                new 
randMSG random(sizeof(RandomMsg));
                
format(strsizeof(str), "%s %s"RandomMsg[randMSG], PlayerName(playerid));
                
SendBotMessage(str);
                return 
1;

WHen i disable this FS everything works fine.

Any idea on what i might need to adjust?
Reply
#5

Come on, help a guy out, I've tried to solve this since i made the post, without any results. I can't see anything suspicious with the code.

I suspect that this is the script part that mess things up:

Код:
forward SendRandomMessage();
public SendRandomMessage()
{
        for(new playerid=0;playerid<MAX_PLAYERS;playerid++)
        {
            if(IsPlayerConnected(playerid)==1 && GetPlayerColor(playerid) != 0)
            {
                        new pName[18];
                        format(pName,sizeof(pName),"%s",PlayerName(playerid));
                        new ColorSave = GetPlayerColor(playerid);
                        SetPlayerColor(playerid,COLOR_BOT);
                        SetPlayerName(playerid,BotName);
                        SendPlayerMessageToAll(playerid,BOTMESSAGE[random(MAXMESSAGE)]);
                        SetPlayerColor(playerid,ColorSave);
                        SetPlayerName(playerid,pName);
                        return 1;
                }
        }
        return 1;
}
But what do I know, I'm new to Pawno, had Zero knowledge of scripting 1 week ago, trying as hard as i can to learn. I only ask for help after I've spent hours and hours of searching. I have encountered many errors and I've fixed most of them using ****** and searching on this forum.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)