need help with "has joined the game".
#1

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);
Reply
#2

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

Код:
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;
}
Reply
#4

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;
}
Reply
#5

Gh0sT_ is says somethign about wrong argument(argument 2)
Reply
#6

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);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)