SA-MP Forums Archive
A problem in OnPlayerDisconnect - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: A problem in OnPlayerDisconnect (/showthread.php?tid=343325)

Pages: 1 2


A problem in OnPlayerDisconnect - Firo - 17.05.2012

Hey guy's since my last topic had 5 pages, i decided to open a new thread about my problem.
https://sampforum.blast.hk/showthread.php?tid=342893 - My last theard.


PHP Code:
public OnPlayerDisconnect(playeridreason)
{
        if(
pLogged[playerid] == 1) {
        new 
INI:iFile INI_Open(PlayerPath(playerid));
        
INI_SetTag(iFile,"data");
        
INI_WriteInt(iFile,"Cash",GetPlayerMoney(playerid));
        
INI_WriteInt(iFile,"Score",GetPlayerScore(playerid));
        
INI_Close(iFile);
    }
        
pLogged[playerid] = 0;
        
TextDrawHideForPlayer(playeridTextdrawConnect0);  // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect1); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect2); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect3); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect4); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect5); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect6); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect7); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect8); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect9); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect10); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect11); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect12); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect13); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect14); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect15); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect16); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect17); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect18); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect19); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTime1), TextDrawHideForPlayer(playeridDate); // DATE AND TIME
        
TextDrawHideForPlayer(playeridCredit); // Credits
        
StopAudioStreamForPlayer(playerid);
        
Radio[playerid] = false;
        return 
1;
    }
        return 
0;

PHP Code:
(781) : error 029invalid expressionassumed zero 
(781) : error 004: function "S@@_OnPlayerDisconnect" is not implemented 
The line 781 is the 'public OnPlayerDisconnect....'.


Re: A problem in OnPlayerDisconnect - iRage - 17.05.2012

Why do you return 0?


Re: A problem in OnPlayerDisconnect - Firo - 17.05.2012

It's still error without that return 0.


Re: A problem in OnPlayerDisconnect - $$Killer$$ - 17.05.2012

try to make it to return 1;


Re: A problem in OnPlayerDisconnect - Firo - 17.05.2012

Quote:
Originally Posted by $$Killer$$
View Post
try to make it to return 1;
PHP Code:
public OnPlayerDisconnect(playeridreason)
{
        if(
pLogged[playerid] == 1) {
        new 
INI:iFile INI_Open(PlayerPath(playerid));
        
INI_SetTag(iFile,"data");
        
INI_WriteInt(iFile,"Cash",GetPlayerMoney(playerid));
        
INI_WriteInt(iFile,"Score",GetPlayerScore(playerid));
        
INI_Close(iFile);
    }
        
pLogged[playerid] = 0;
        
TextDrawHideForPlayer(playeridTextdrawConnect0);  // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect1); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect2); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect3); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect4); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect5); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect6); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect7); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect8); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect9); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect10); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect11); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect12); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect13); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect14); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect15); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect16); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect17); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect18); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTextdrawConnect19); // Connect Textdraw
        
TextDrawHideForPlayer(playeridTime1), TextDrawHideForPlayer(playeridDate); // DATE AND TIME
        
TextDrawHideForPlayer(playeridCredit); // Credits
        
TextDrawHideForPlayer(playerid,PlayerN);// Player Name Textdraw
        
StopAudioStreamForPlayer(playerid);
        
Radio[playerid] = false;
        return 
1;
    }

There's already a return 1; ..


Re: A problem in OnPlayerDisconnect - $$Killer$$ - 17.05.2012

i mean like this
PHP Code:
public OnPlayerDisconnect(playeridreason

        if(
pLogged[playerid] == 1) { 
        new 
INI:iFile INI_Open(PlayerPath(playerid)); 
        
INI_SetTag(iFile,"data"); 
        
INI_WriteInt(iFile,"Cash",GetPlayerMoney(playerid)); 
        
INI_WriteInt(iFile,"Score",GetPlayerScore(playerid)); 
        
INI_Close(iFile); 
    } 
      {
        
pLogged[playerid] = 0
        
TextDrawHideForPlayer(playeridTextdrawConnect0);  // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect1); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect2); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect3); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect4); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect5); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect6); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect7); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect8); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect9); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect10); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect11); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect12); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect13); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect14); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect15); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect16); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect17); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect18); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect19); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTime1), TextDrawHideForPlayer(playeridDate); // DATE AND TIME 
        
TextDrawHideForPlayer(playeridCredit); // Credits 
        
StopAudioStreamForPlayer(playerid); 
        
Radio[playerid] = false
        return 
1
    } 
        return 
0




Re: A problem in OnPlayerDisconnect - Firo - 17.05.2012

Quote:
Originally Posted by $$Killer$$
View Post
i mean like this
PHP Code:
public OnPlayerDisconnect(playeridreason

        if(
pLogged[playerid] == 1) { 
        new 
INI:iFile INI_Open(PlayerPath(playerid)); 
        
INI_SetTag(iFile,"data"); 
        
INI_WriteInt(iFile,"Cash",GetPlayerMoney(playerid)); 
        
INI_WriteInt(iFile,"Score",GetPlayerScore(playerid)); 
        
INI_Close(iFile); 
    } 
      {
        
pLogged[playerid] = 0
        
TextDrawHideForPlayer(playeridTextdrawConnect0);  // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect1); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect2); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect3); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect4); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect5); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect6); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect7); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect8); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect9); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect10); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect11); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect12); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect13); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect14); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect15); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect16); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect17); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect18); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTextdrawConnect19); // Connect Textdraw 
        
TextDrawHideForPlayer(playeridTime1), TextDrawHideForPlayer(playeridDate); // DATE AND TIME 
        
TextDrawHideForPlayer(playeridCredit); // Credits 
        
StopAudioStreamForPlayer(playerid); 
        
Radio[playerid] = false
        return 
1
    } 
        return 
0

It's giving 26 errors....


Re: A problem in OnPlayerDisconnect - Kitten - 17.05.2012

pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
    if(pLogged[playerid] == 1)
    {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Cash",GetPlayerMoney(playerid));
        INI_WriteInt(iFile,"Score",GetPlayerScore(playerid));
        INI_Close(iFile);
    }

    pLogged[playerid] = 0;
    TextDrawHideForPlayer(playerid, TextdrawConnect0);
    TextDrawHideForPlayer(playerid, TextdrawConnect1);
    TextDrawHideForPlayer(playerid, TextdrawConnect2);
    TextDrawHideForPlayer(playerid, TextdrawConnect3);
    TextDrawHideForPlayer(playerid, TextdrawConnect4);
    TextDrawHideForPlayer(playerid, TextdrawConnect5);
    TextDrawHideForPlayer(playerid, TextdrawConnect6);
    TextDrawHideForPlayer(playerid, TextdrawConnect7);
    TextDrawHideForPlayer(playerid, TextdrawConnect8);
    TextDrawHideForPlayer(playerid, TextdrawConnect9);
    TextDrawHideForPlayer(playerid, TextdrawConnect10);
    TextDrawHideForPlayer(playerid, TextdrawConnect11);
    TextDrawHideForPlayer(playerid, TextdrawConnect12);
    TextDrawHideForPlayer(playerid, TextdrawConnect13);
    TextDrawHideForPlayer(playerid, TextdrawConnect14);
    TextDrawHideForPlayer(playerid, TextdrawConnect15);
    TextDrawHideForPlayer(playerid, TextdrawConnect16);
    TextDrawHideForPlayer(playerid, TextdrawConnect17);
    TextDrawHideForPlayer(playerid, TextdrawConnect18);
    TextDrawHideForPlayer(playerid, TextdrawConnect19);
    TextDrawHideForPlayer(playerid, Time1);
    TextDrawHideForPlayer(playerid, Date);        // DATE AND TIME
    TextDrawHideForPlayer(playerid, Credit);      // Credits
    StopAudioStreamForPlayer(playerid); // I find this pointless
    Radio[playerid] = false;
    return 1;
}



Re: A problem in OnPlayerDisconnect - $$inSane - 17.05.2012

put these TextDrawHideForPlayer thing in OnPlayerGamemodeExit(playerid)


Re: A problem in OnPlayerDisconnect - Firo - 17.05.2012

Quote:
Originally Posted by Kitten
View Post
pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
    if(pLogged[playerid] == 1)
    {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Cash",GetPlayerMoney(playerid));
        INI_WriteInt(iFile,"Score",GetPlayerScore(playerid));
        INI_Close(iFile);
    }

    pLogged[playerid] = 0;
    TextDrawHideForPlayer(playerid, TextdrawConnect0);
    TextDrawHideForPlayer(playerid, TextdrawConnect1);
    TextDrawHideForPlayer(playerid, TextdrawConnect2);
    TextDrawHideForPlayer(playerid, TextdrawConnect3);
    TextDrawHideForPlayer(playerid, TextdrawConnect4);
    TextDrawHideForPlayer(playerid, TextdrawConnect5);
    TextDrawHideForPlayer(playerid, TextdrawConnect6);
    TextDrawHideForPlayer(playerid, TextdrawConnect7);
    TextDrawHideForPlayer(playerid, TextdrawConnect8);
    TextDrawHideForPlayer(playerid, TextdrawConnect9);
    TextDrawHideForPlayer(playerid, TextdrawConnect10);
    TextDrawHideForPlayer(playerid, TextdrawConnect11);
    TextDrawHideForPlayer(playerid, TextdrawConnect12);
    TextDrawHideForPlayer(playerid, TextdrawConnect13);
    TextDrawHideForPlayer(playerid, TextdrawConnect14);
    TextDrawHideForPlayer(playerid, TextdrawConnect15);
    TextDrawHideForPlayer(playerid, TextdrawConnect16);
    TextDrawHideForPlayer(playerid, TextdrawConnect17);
    TextDrawHideForPlayer(playerid, TextdrawConnect18);
    TextDrawHideForPlayer(playerid, TextdrawConnect19);
    TextDrawHideForPlayer(playerid, Time1);
    TextDrawHideForPlayer(playerid, Date);        // DATE AND TIME
    TextDrawHideForPlayer(playerid, Credit);      // Credits
    StopAudioStreamForPlayer(playerid); // I find this pointless
    Radio[playerid] = false;
    return 1;
}
Same thing, 26 errors..
What pointless in StopAudioStreamForPlayer?


Re: A problem in OnPlayerDisconnect - Kitten - 17.05.2012

Quote:
Originally Posted by $$inSane
View Post
put these TextDrawHideForPlayer thing in OnPlayerGamemodeExit(playerid)
why would you do that, why you're trying to hide a player textdraw when the gamemode exits, instead just hide/destroy the textdraw.


Re: A problem in OnPlayerDisconnect - $$inSane - 17.05.2012

Quote:
Originally Posted by Kitten
View Post
why would you do that, why you're trying to hide a player textdraw when the gamemode exits, instead just hide/destroy the textdraw.
yup i mean that only just got confused


Re: A problem in OnPlayerDisconnect - Firo - 17.05.2012

Quote:
Originally Posted by $$inSane
View Post
put these TextDrawHideForPlayer thing in OnPlayerGamemodeExit(playerid)
Those textdraws are always on the screen till the player left the server, By the way i don't have OnPlayerGameModeExit public.


Re: A problem in OnPlayerDisconnect - Firo - 17.05.2012

Quote:
Originally Posted by Y_Less
View Post
Looks like a braces problem. Make sure all your code is correctly indented. Especially all the code before the current problem functions.
I love you man!
Finally fixed those errors but i need that fuction so here's the end of OnDialogRespone public (the public before OnPlayerDisconnect)


PHP Code:
    if(dialogid == DEIALOG_ID)
    {
        if(
listitem == sizeof(radiolist)) return OnPlayerCommandText(playerid,"/radio");
        if(
listitem == sizeof(radiolist)+1) return StopAudioStreamForPlayer(playerid),Radio[playerid] = false;
        
StopAudioStreamForPlayer(playerid);
        
PlayAudioStreamForPlayer(playerid,radiolist[listitem][0]);
        new 
str[50]; format(str,50,"Now listening to \"%s\"...",radiolist[listitem][1]);
        
SendClientMessage(playerid,0x33CCFFAA,str);
        
SendClientMessage(playerid,0xFFFFFFAA,"Stop listening: /MOFF");
        
Radio[playerid] = true;
        return 
1;
    }
        return 
0;

What's the problem here? (It's not the whole OnPlayerResponeDialog.
And i have 2 warnings in something about /help command.
PHP Code:
(737) : warning 202number of arguments does not match definition 
PHP Code:
format(string,sizeof(string),"\t"lyellow2"Hey,%s! Welcome to the help page of Europe Deathmatch!\n\nWe have several jobs in our server:\n* Trucker \n"lblue"* Police \n"lorange"* Assistance \n"lgreen"* Driver \n",GetPlayerName(playerid)); 
Thanks!!!


Re: A problem in OnPlayerDisconnect - Firo - 17.05.2012

Help please?


Re: A problem in OnPlayerDisconnect - Firo - 17.05.2012

Quote:
Originally Posted by Y_Less
View Post
Pretty sure someone already answered that one in your other topic - look at how GetPlayerName is declared and compare that to how you are using it.
I already added
PHP Code:
    new string[1550];
    new 
PlayerName[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,PlayerName,sizeof(PlayerName)); 
upto the /help command, but from the guide i took it from it said to add upto the command
PHP Code:
#pragma unused params 
but when i'm adding that is saying
PHP Code:
(731) : error 017undefined symbol "params" 



Re: A problem in OnPlayerDisconnect - Firo - 17.05.2012

Quote:
Originally Posted by Y_Less
View Post
So don't do that bit then! If the guide you read doesn't tell you WHY to do that (and more importantly when NOT to do that) I wouldn't call it a very good guide.
Well because i'm kinda start user at Pawno i decided to go trough this guide anyway now that Register system works great but i have those 2 warnings in the /Help command..

You want the whole command to see the problem?
PHP Code:
    if(!strcmp(cmdtext"/help",true))
    {
//    #pragma unused params
    
new string[1550];
    new 
PlayerName[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
    
format(string,sizeof(string),"\t"lyellow2"Hey,%s! Welcome to the help page of Europe Deathmatch!\n\nWe have several jobs in our server:\n* Trucker \n"lblue"* Police \n"lorange"* Assistance \n"lgreen"* Driver \n",GetPlayerName(playerid));
    
strcat(string,"Trucker is the most common job in this server: Just spawn, get a truck(van), attach a trailer and type /work! \nYou'll have to deliver different loads from different points to other. \nBy doing that you are gaining money and score, which can be used for buying your own vehicle, house, and more! \n");
    
strcat(string,""lblue"To be a police man you need at least 50 score, which can be earned by doing trucking missions. \nYou'll need to catch players breaking the rules, such as not following speed limits, robbing people etc. \nYou can first use /ticket to give them a ticket, or /arrest if they got a higher wanted level! \n");
    
strcat(string,""lorange"The assistance job is easy: just spawn as an assistance man, get in your tow truck and wait for help requests! \nYou can fix any vehicle by typing /fixcar, fill it up by typing /fuelcar, or press 2 to tow a vehicle while near one! \n");
    
strcat(string,""lgreen"By being a taxi driver, you should transport players to where you they want to. \nYou can type /fare while in a taxi to set up your fare, and wait for players! \nYou get paid every 10 seconds a passanger is in your vehicle if you are on duty. \n");
    
strcat(string,"\t"lred"Other:\n\n "lred"/phelp - "lyellow"Accurate help about your job! \n/credits - see the founders of Ultimate Trucking! \n/cmds - See the list of the available commands on the server! \n/rules - See the server rules!\n\n\t\t"lred"www.-.net");
    
ShowPlayerDialog(playerid,5555,0,""lyellow"GENERAL HELP",string,"OK","");
    return 
1;
    } 



Re: A problem in OnPlayerDisconnect - Firo - 17.05.2012

Quote:
Originally Posted by Y_Less
View Post
You now have "GetPlayerName" twice - once done correctly and once done wrong, just use the first.
Thanks buddy, i didn't noticed about that..
PHP Code:
pawno\include\YSI\internal\y_dohooks.inc(2501) : warning 235: public function lacks forward declaration (symbol "OnVehicleDamageStatusUpdate")
pawno\include\YSI\internal\y_dohooks.inc(2566) : warning 235: public function lacks forward declaration (symbol "OnUnoccupiedVehicleUpdate")
pawno\include\YSI\internal\y_dohooks.inc(3426) : warning 235: public function lacks forward declaration (symbol "OnPlayerTakeDamage")
pawno\include\YSI\internal\y_dohooks.inc(3495) : warning 235: public function lacks forward declaration (symbol "OnPlayerGiveDamage"
Why it's warning me?


Re: A problem in OnPlayerDisconnect - Firo - 17.05.2012

Quote:
Originally Posted by Y_Less
View Post
You're not using the 0.3e includes. If you're not on 0.3e just ignore those warnings, it doesn't currently gracefully detect versions (which I admit it should).
Well i'm using 0.3e, what include should i upgrade? And can you give me the link?

Thanks mate.

EDIT :
I just test the /help command and it doesn't show the Playername..


Re: A problem in OnPlayerDisconnect - Firo - 17.05.2012

Any assistant please? Thanks.