SA-MP Forums Archive
Help join and dissconect - 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: Help join and dissconect (/showthread.php?tid=532248)



Help join and dissconect - Gogeta101 - 17.08.2014

PHP код:
public OnPlayerDisconnect(playerid)
{
    new
    
string[64],
    
name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    switch(
reason)
    {
    case 
0format(string,sizeof string,"%s partiу del server. (Crash)",name);
    case 
1format(string,sizeof string,"%s partiу del server. (Salio)",name);
    case 
2format(string,sizeof string,"%s partiу del server. (Kick/Ban)",name);
    }
    
SendClientMessageToAll(0xFFFFFFAA,string);
    
SavePlayer(playerid);
    return 
1;

Error Undtified Symbol "Reason"

And i want to add join message here but i dont know where ?

PHP код:
public OnPlayerConnect(playerid)
{
    
GameTextForPlayer(playerid,"~g~Welcome to Test",5000,4);
    
SendClientMessage(playerid,0xFFFFFFFF,"{FF0000}Welcome {FFFFFF}to Russia vs Ukraine!\n{FFFFFF}Type {FF0000}/help {FFFFFF}for help :)");
    
SendClientMessage(playeridCOLOR_YELLOW"Click Spawn to spawn to your previous team and class");
    new 
playername[MAX_PLAYER_NAME];
    new 
string[128];
    
GetPlayerName(playerid,playername,sizeof(playername));
    
format(string,sizeof(string),"players/%s.ini"playername);
    if(
fexist(string))
     {
        
PAccount[playerid] = 1;
    }
    else
    {
        
PAccount[playerid] = 0;
    }
    if(
PAccount[playerid] == 1)
    {
        
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"{FF0000}Login","{FFFFFF}Hello!\nYour account registred in server\nPlease,type your password below:","OK","Exit");
    }
    else
    {
        
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"{00FF00}Register","{FFFFFF}Hello!\nYour account not registred!\nType password below:","OK","Exit");
    }
    return 
1
I want to add this

PHP код:
public OnPlayerConnect(playerid)
{
    new 
string[64], pName[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    
format(string,sizeof string,"%s has joined the server. Welcome!",pName);
    
SendClientMessageToAll(0xFFFFFFAA,string);
    return 
1;




Re: Help join and dissconect - GShock - 17.08.2014

1st. Replace
pawn Код:
public OnPlayerDisconnect(playerid)
with
pawn Код:
public OnPlayerDisconnect(playerid, reason)
2nd.

pawn Код:
public OnPlayerConnect(playerid)
{
    GameTextForPlayer(playerid,"~g~Welcome to Test",5000,4);
    SendClientMessage(playerid,0xFFFFFFFF,"{FF0000}Welcome {FFFFFF}to Russia vs Ukraine!\n{FFFFFF}Type {FF0000}/help {FFFFFF}for help :)");
    SendClientMessage(playerid, COLOR_YELLOW, "Click Spawn to spawn to your previous team and class");
    new playername[MAX_PLAYER_NAME];
    new string[128];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof string,"%s has joined the server. Welcome!",playername);
    SendClientMessageToAll(0xFFFFFFAA,string);
    format(string,sizeof(string),"players/%s.ini", playername);
    if(fexist(string))
     {
        PAccount[playerid] = 1;
    }
    else
    {
        PAccount[playerid] = 0;
    }
    if(PAccount[playerid] == 1)
    {
        ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"{FF0000}Login","{FFFFFF}Hello!\nYour account registred in server\nPlease,type your password below:","OK","Exit");
    }
    else
    {
        ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"{00FF00}Register","{FFFFFF}Hello!\nYour account not registred!\nType password below:","OK","Exit");
    }
return 1;



Re: Help join and dissconect - Gogeta101 - 17.08.2014

Error is here at switch(Reason)
(250) : error 017: undefined symbol "Reason"

PHP код:
public OnPlayerDisconnect(playerid)
{
    new
    
string[64],
    
name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    switch(
Reason)
    {
    case 
0format(string,sizeof string,"%s partiу del server. (Crash)",name);
    case 
1format(string,sizeof string,"%s partiу del server. (Salio)",name);
    case 
2format(string,sizeof string,"%s partiу del server. (Kick/Ban)",name);
    }
    
SendClientMessageToAll(0xFFFFFFAA,string);
    
SavePlayer(playerid);
    return 
1;




Re: Help join and dissconect - Hanger - 17.08.2014

I just love when ****** tries to teach something to newbies. Every post is worth it.


Re: Help join and dissconect - Gogeta101 - 17.08.2014

I didint script them just copied them from wiki


Re: Help join and dissconect - Gogeta101 - 17.08.2014

Fixed both of them now i need to test them thanks.


Re: Help join and dissconect - MicroD - 17.08.2014

By the way you're using some outdated OnPlayerDisconect callback?!
It should have parameter "reason".
Код:
public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}



Re: Help join and dissconect - GShock - 17.08.2014

Jesus.. why is it so hard for you to understand? >.>