question
#1

What is the correct way to order this?

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    new 
discstring[128];
    switch(
reason)
    {
        case 
0format(discstringsizeof(discstring), "* %s has left the server. [ Timeout ]"GetName(playerid));
        case 
1format(discstringsizeof(discstring), "* %s has left the server. [ Leaving ]"GetName(playerid));
        case 
2format(discstringsizeof(discstring), "* %s has left the server. [ Kicked ]"GetName(playerid));
    }
    
ProxDetector(30.0playeriddiscstringCOLOR_YELLOWCOLOR_YELLOWCOLOR_YELLOWCOLOR_YELLOWCOLOR_YELLOW);
    
SaveAccountInfo(playerid);
    return 
1;
    
    {
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File,"data");
    
INI_WriteInt(File,"Faction",PlayerInfo[playerid][pFaction]);//saves the players faction id on disconnect
    
INI_WriteInt(File,"Facrank",PlayerInfo[playerid][pFacrank]);//saves the players faction rank on disconnect
    
INI_WriteInt(File,"Facleader",PlayerInfo[playerid][pFacleader]);//saves the players faction leadership status on disconnect
    
INI_Close(File);
    return 
1;
}

Код HTML:
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(992) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:           7532 bytes
Code size:           188628 bytes
Data size:         21053960 bytes
Stack/heap size:      16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements:21266504 bytes

1 Warning.
cuz when i try to compile it closes the pawno sometimes or give this warning
Reply
#2

I guess:

Код:
public OnPlayerDisconnect(playerid, reason)
{
    new discstring[128];
    switch(reason)
    {
        case 0: format(discstring, sizeof(discstring), "* %s has left the server. [ Timeout ]", GetName(playerid));
        case 1: format(discstring, sizeof(discstring), "* %s has left the server. [ Leaving ]", GetName(playerid));
        case 2: format(discstring, sizeof(discstring), "* %s has left the server. [ Kicked ]", GetName(playerid));
    }
    ProxDetector(30.0, playerid, discstring, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW);
    SaveAccountInfo(playerid);
    return 1;
}

SaveAccountInfo(playerid)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");

    INI_WriteInt(File,"Faction",PlayerInfo[playerid][pFaction]);//saves the players faction id on disconnect
    INI_WriteInt(File,"Facrank",PlayerInfo[playerid][pFacrank]);//saves the players faction rank on disconnect
    INI_WriteInt(File,"Facleader",PlayerInfo[playerid][pFacleader]);//saves the players faction leadership status on disconnect
    INI_Close(File);
}
Reply
#3

IT SHOW ME THIS:

Код HTML:
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(994) : error 021: symbol already defined: "SaveAccountInfo"
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1002) : warning 209: function "SaveAccountInfo" should return a value
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
LINE 994 TO 1002

PHP код:
{
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File,"data");
    
INI_WriteInt(File,"Faction",PlayerInfo[playerid][pFaction]);//saves the players faction id on disconnect
    
INI_WriteInt(File,"Facrank",PlayerInfo[playerid][pFacrank]);//saves the players faction rank on disconnect
    
INI_WriteInt(File,"Facleader",PlayerInfo[playerid][pFacleader]);//saves the players faction leadership status on disconnect
    
INI_Close(File);

Reply
#4

Don't create a new stock, just add
PHP код:

new INI:File INI_Open(UserPath(playerid)); 
    
INI_SetTag(File,"data"); 
    
INI_WriteInt(File,"Faction",PlayerInfo[playerid][pFaction]);//saves the players faction id on disconnect 
    
INI_WriteInt(File,"Facrank",PlayerInfo[playerid][pFacrank]);//saves the players faction rank on disconnect 
    
INI_WriteInt(File,"Facleader",PlayerInfo[playerid][pFacleader]);//saves the players faction leadership status on disconnect 
    
INI_Close(File); 
too the stock already created OR just do this

PHP код:

public OnPlayerDisconnect(playeridreason

    new 
discstring[128]; 
    switch(
reason
    { 
        case 
0format(discstringsizeof(discstring), "* %s has left the server. [ Timeout ]"GetName(playerid)); 
        case 
1format(discstringsizeof(discstring), "* %s has left the server. [ Leaving ]"GetName(playerid)); 
        case 
2format(discstringsizeof(discstring), "* %s has left the server. [ Kicked ]"GetName(playerid)); 
    } 
    
ProxDetector(30.0playeriddiscstringCOLOR_YELLOWCOLOR_YELLOWCOLOR_YELLOWCOLOR_YELLOWCOLOR_YELLOW);
    new 
INI:File INI_Open(UserPath(playerid)); 
    
INI_SetTag(File,"data"); 
    
INI_WriteInt(File,"Faction",PlayerInfo[playerid][pFaction]);//saves the players faction id on disconnect 
    
INI_WriteInt(File,"Facrank",PlayerInfo[playerid][pFacrank]);//saves the players faction rank on disconnect 
    
INI_WriteInt(File,"Facleader",PlayerInfo[playerid][pFacleader]);//saves the players faction leadership status on disconnect 
    
INI_Close(File);
    
SaveAccountInfo(playerid); 
    return 
1

Reply
#5

Quote:
Originally Posted by ItsRobinson
Посмотреть сообщение
Don't create a new stock, just add
PHP код:

new INI:File INI_Open(UserPath(playerid)); 
    
INI_SetTag(File,"data"); 
    
INI_WriteInt(File,"Faction",PlayerInfo[playerid][pFaction]);//saves the players faction id on disconnect 
    
INI_WriteInt(File,"Facrank",PlayerInfo[playerid][pFacrank]);//saves the players faction rank on disconnect 
    
INI_WriteInt(File,"Facleader",PlayerInfo[playerid][pFacleader]);//saves the players faction leadership status on disconnect 
    
INI_Close(File); 
too the stock already created OR just do this

PHP код:

public OnPlayerDisconnect(playeridreason

    new 
discstring[128]; 
    switch(
reason
    { 
        case 
0format(discstringsizeof(discstring), "* %s has left the server. [ Timeout ]"GetName(playerid)); 
        case 
1format(discstringsizeof(discstring), "* %s has left the server. [ Leaving ]"GetName(playerid)); 
        case 
2format(discstringsizeof(discstring), "* %s has left the server. [ Kicked ]"GetName(playerid)); 
    } 
    
ProxDetector(30.0playeriddiscstringCOLOR_YELLOWCOLOR_YELLOWCOLOR_YELLOWCOLOR_YELLOWCOLOR_YELLOW);
    new 
INI:File INI_Open(UserPath(playerid)); 
    
INI_SetTag(File,"data"); 
    
INI_WriteInt(File,"Faction",PlayerInfo[playerid][pFaction]);//saves the players faction id on disconnect 
    
INI_WriteInt(File,"Facrank",PlayerInfo[playerid][pFacrank]);//saves the players faction rank on disconnect 
    
INI_WriteInt(File,"Facleader",PlayerInfo[playerid][pFacleader]);//saves the players faction leadership status on disconnect 
    
INI_Close(File);
    
SaveAccountInfo(playerid); 
    return 
1

alright, thanks pal!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)