Help join and dissconect
#1

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;

Reply
#2

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;
Reply
#3

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;

Reply
#4

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

I didint script them just copied them from wiki
Reply
#6

Fixed both of them now i need to test them thanks.
Reply
#7

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

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


Forum Jump:


Users browsing this thread: 3 Guest(s)