SA-MP Forums Archive
need help with "has joined the game". - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: need help with "has joined the game". (/showthread.php?tid=228724)



need help with "has joined the game". - Randomai - 20.02.2011

Can someone make me "command" when someone join server it says like:

Simeon has joined Zombie Panic!


my code didnt work:


Код:
new string[256], playername[MAX_PLAYER_NAME], file[255];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(file, sizeof(file), "%s.Zombie Panic!", playername);
    format(string, sizeof(string), "%s has joined Zombie Panic!", playername);



Re: need help with "has joined the game". - xRyder - 20.02.2011

You don't need to use new array for a file, 'cause you really don't need one.
Also don't use strings with size more than 128, because the max output size is 128 so you are wasting memory for nothing.

Put this under OnPlayerConnect() callback:
pawn Код:
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof(name));
format(str, 128, "%s has joined Zombie Panic!", name);



Re: need help with "has joined the game". - Defrinex - 20.02.2011

Код:
public OnPlayerConnect(playerid)
{
    new string[128], playername[30];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(string, sizeof(string), "%s has joined Zombie Panic!", playername);
    SendClientMessageToAll(0xFFFFFFFF,string);
    return 1;
}



Re: need help with "has joined the game". - Gh0sT_ - 20.02.2011

pawn Код:
public OnPlayerConnect( playerid )
{
    new
        String[ 52 ],
        Name[ 24 ]
    ;
    GetPlayerName( playerid, Name, 24 );
    format( String, 52, "%s has joined Zombie Panic!", Name );
    SendClientMessageToAll( -1, YOUR COLOR, String );
    return true;
}



Re: need help with "has joined the game". - Randomai - 20.02.2011

Gh0sT_ is says somethign about wrong argument(argument 2)


Re: need help with "has joined the game". - xRyder - 20.02.2011

Quote:
Originally Posted by Randomai
Посмотреть сообщение
Gh0sT_ is says somethign about wrong argument(argument 2)
Why not using the code that Defrinex gave you??

And in Gh0sT_'s code where it says:
pawn Код:
SendClientMessageToAll( -1, YOUR COLOR, String );
Just change it to:
pawn Код:
SendClientMessageToAll(YOUR COLOR, String);