Random welcome/leaving messages come up when restarting
#1

Hey guys, when someone leaves or the server restarts, this happens:

http://i48.tinypic.com/34e5nvp.png

As you can see, two messages come up saying no name joined and left. and a random id came up saying nothing. It is really bugged! Please help
Reply
#2

Show Code?
Reply
#3

http://pastebin.com/yHpbvagK

whole code. problem i think is on onplayerdisconnect or maybe onplayerconnect!
Reply
#4

plz help some1
Reply
#5

You see there is 2 mistakes..

1st is Is Joined

2nd Leaving

so I tihink

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    QuestionAsked[playerid] = false;
    format(Question[playerid], 256, " ");
    new pname[MAX_PLAYER_NAME], string[128 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    SendClientMessageToAll(0xA8A8A8FF, string);
    //Same as OnDialogResponse, we will save their stats inside of their user's account
    if(fexist(Path(playerid)))//Will check if the file is exit or not inside of User's folder that we have created.
    {
        new INI:file = INI_Open(Path(playerid)); //will open their file
        INI_SetTag(file,"Player's Data");//We will set a tag inside of user's account called "Player's Data"
        INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]); //If you've set his/her admin level, then his/her admin level will be saved inside of his/her account
        INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
        INI_WriteInt(file,"Money",GetPlayerMoney(playerid));//We will save his money inside of his account
        INI_WriteInt(file,"Scores",GetPlayerScore(playerid));//We will save his score inside of his account
        INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);//As explained above
        INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);//As explained above
        INI_Close(file);//Now after we've done saving their data, we now need to close the file
        return 1;
    }
    switch(reason)
    {
        case 0:
                format(string, sizeof(string), "* %s has left the server. (Lost Connection)", pname);
        case 1:
                format(string, sizeof(string), "* %s has left the server. (Leaving)", pname);
        case 2:
                format(string, sizeof(string), "* %s has left the server. (Kicked/Banned)", pname);
    }
    return 1;
}
public OnPlayerConnect(playerid)
{
    format(string, sizeof(string), "* %s has joined the server", pname);
    SendClientMessage(playerid, 0xFFC400FF, "MOTD: Use /updates to viewer our newest server updates");
    new pname[MAX_PLAYER_NAME], string[128 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    SendClientMessageToAll(0xA8A8A8FF, string);
    TextDrawShowForPlayer(playerid,Startup0);
    TextDrawShowForPlayer(playerid,Startup1);
    TextDrawShowForPlayer(playerid,Startup2);
    TextDrawShowForPlayer(playerid,Startup3);
    TextDrawShowForPlayer(playerid,Startup4);
    TextDrawShowForPlayer(playerid,Startup5);
    PlayAudioStreamForPlayer(playerid, "http://mixconnect.com/disk2/mp3/1e1a51b28bdc93803dcbf.mp3");
    new name[MAX_PLAYER_NAME]; //Making a new variable called 'name'. name[MAX_PLAYER_NAME] is created so we can use it to get player's name.
    GetPlayerName(playerid,name,sizeof(name)); //Get player's name
    if(fexist(Path(playerid))) /* Check if the connected user is registered or not. fexist stands for file exist. So if file exist in the files(Path(playerid)),*/
    {// then
        INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid); //Will load user's data using INI_Parsefile.
        ShowPlayerDialog(playerid,dlogin, DIALOG_STYLE_PASSWORD,""COL_GREEN"Login",""COL_WHITE"This account is {00FF22}already registered.\n{FFFFFF}Please login by entering your password in below","Login","Quit");
    }
    else //If the connected user is not registered,
    {//then we will 'force' him to register :)
                ShowPlayerDialog(playerid,dregister, DIALOG_STYLE_PASSWORD,""COL_RED"Register",""COL_WHITE"This account is{F81414} not yet registered \n{FFFFFF}Please create an account by writing a password below","Register","Quit");
        return 1;
    }
    return 1;
}
Reply
#6

Now this comes up!

Reply
#7

Try using a stock instead of making a variable for pname.

Try this.
pawn Код:
stock GetName(playerid)
{
    new Name[MAX_PLAYER_NAME];
    if(IsPlayerConnected(playerid))
    {
        GetPlayerName(playerid, Name, sizeof(Name));
    }
    return Name;
}
pawn Код:
format(string, sizeof(string), "* %s has joined the server", GetName);
Reply
#8

Код:
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(421) : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Код:
format(string, sizeof(string), "* %s has joined the server", GetName1);
stock:

Код:
stock GetName1(playerid)
{
    new Name[MAX_PLAYER_NAME];
    if(IsPlayerConnected(playerid))
    {
        GetPlayerName(playerid, Name, sizeof(Name));
    }
    return Name;
}
plz help
Reply
#9

paste the line the error is on please.

EDIT: Remove this from your script. No need, since we have it as a stock.
pawn Код:
new pname[MAX_PLAYER_NAME], string[128 + MAX_PLAYER_NAME];

    GetPlayerName(playerid, pname, sizeof(pname));
Reply
#10

Код:
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(420) : error 076: syntax error in the expression, or invalid function call
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(419) : warning 204: symbol is assigned a value that is never used: "pname"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Код:
	new pname[MAX_PLAYER_NAME], string[128 + MAX_PLAYER_NAME];
	format(string, sizeof(string), "* %s has joined the server", GetName1);
plz help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)