*** This topic title is not descriptive.
#1

----------------------
Reply
#2

I think i found the problem....

Код:
public OnPlayerDisconnect(playerid, reason)
{
    new string[180], pname[MAX_PLAYER_NAME];
    new playerfile[100];
    GetPlayerName(playerid, pname, sizeof(pname));
	if(logged[playerid] == 1)
    {
    format(playerfile, sizeof(playerfile), "Tropical/Users/%s.ini",pname);
    dini_IntSet(playerfile, "Level", level[playerid]);
    dini_IntSet(playerfile, "Cash", GetPlayerMoney(playerid));
    dini_IntSet(playerfile, "Score", GetPlayerScore(playerid));
    }
    level[playerid] = 0;
    logged[playerid] = 0;
    /*#if defined leavemes
    new string[180], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), " ",);
    SendClientMessageToAll(grey, string);
    */
    switch(reason)
    {
        case 0: format(string, sizeof(string), "{999900}%s {FFFFFF}Has Left The Server | {999900}Lost Connection", pname);
        case 1: format(string, sizeof(string), "{999900}%s {FFFFFF}Has Left The Server | {999900}Leaving", pname);
        case 2: format(string, sizeof(string), "{999900}%s {FFFFFF}Has Left The Server | {999900}Kicked/Banned", pname);
    }
    SendClientMessageToAll(0xAAAAAAAA, string);
    return 1;
}
Hope it helps!
Reply
#3

pawn Код:
new string[180], pname[MAX_PLAYER_NAME];
    new playerfile[100];
    GetPlayerName(playerid, pname, sizeof(pname));
    if(logged[playerid] == 1)
    {
        format(playerfile, sizeof(playerfile), "Tropical/Users/%s.ini",pname);
        dini_IntSet(playerfile, "Level", level[playerid]);
        dini_IntSet(playerfile, "Cash", GetPlayerMoney(playerid));
        dini_IntSet(playerfile, "Score", GetPlayerScore(playerid));
    }
Reply
#4

Quote:
Originally Posted by adithegman
Посмотреть сообщение
I think i found the problem....

Код:
public OnPlayerDisconnect(playerid, reason)
{
    new string[180], pname[MAX_PLAYER_NAME];
    new playerfile[100];
    GetPlayerName(playerid, pname, sizeof(pname));
	if(logged[playerid] == 1)
    {
    format(playerfile, sizeof(playerfile), "Tropical/Users/%s.ini",pname);
    dini_IntSet(playerfile, "Level", level[playerid]);
    dini_IntSet(playerfile, "Cash", GetPlayerMoney(playerid));
    dini_IntSet(playerfile, "Score", GetPlayerScore(playerid));
    }
    level[playerid] = 0;
    logged[playerid] = 0;
    /*#if defined leavemes
    new string[180], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), " ",);
    SendClientMessageToAll(grey, string);
    */
    switch(reason)
    {
        case 0: format(string, sizeof(string), "{999900}%s {FFFFFF}Has Left The Server | {999900}Lost Connection", pname);
        case 1: format(string, sizeof(string), "{999900}%s {FFFFFF}Has Left The Server | {999900}Leaving", pname);
        case 2: format(string, sizeof(string), "{999900}%s {FFFFFF}Has Left The Server | {999900}Kicked/Banned", pname);
    }
    SendClientMessageToAll(0xAAAAAAAA, string);
    return 1;
}
Hope it helps!
This should fix it, but you should explain what he had done wrong so I'll do it... you used pname before giving it a value, in this case, before using GetPlayerName.
Reply
#5

Quote:
Originally Posted by adithegman
Посмотреть сообщение
I think i found the problem....

Код:
public OnPlayerDisconnect(playerid, reason)
{
    new string[180], pname[MAX_PLAYER_NAME];
    new playerfile[100];
    GetPlayerName(playerid, pname, sizeof(pname));
	if(logged[playerid] == 1)
    {
    format(playerfile, sizeof(playerfile), "Tropical/Users/%s.ini",pname);
    dini_IntSet(playerfile, "Level", level[playerid]);
    dini_IntSet(playerfile, "Cash", GetPlayerMoney(playerid));
    dini_IntSet(playerfile, "Score", GetPlayerScore(playerid));
    }
    level[playerid] = 0;
    logged[playerid] = 0;
    /*#if defined leavemes
    new string[180], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), " ",);
    SendClientMessageToAll(grey, string);
    */
    switch(reason)
    {
        case 0: format(string, sizeof(string), "{999900}%s {FFFFFF}Has Left The Server | {999900}Lost Connection", pname);
        case 1: format(string, sizeof(string), "{999900}%s {FFFFFF}Has Left The Server | {999900}Leaving", pname);
        case 2: format(string, sizeof(string), "{999900}%s {FFFFFF}Has Left The Server | {999900}Kicked/Banned", pname);
    }
    SendClientMessageToAll(0xAAAAAAAA, string);
    return 1;
}
Hope it helps!
Thanks !
Reply
#6

Okay i will explain!

We moved that up because:
here i have 2 brakets:
{
}

now if i put new pname in those 2 brakets it will be able to work with the content that those 2 brakets have! for ex:

{
...
{
new pname[...]
...
...
...
}
and here we have a fuction that uses that pname, it will not work
format(...,...,...,pname);
}

so that why we moved pname at the begining
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)