Posts: 145
Threads: 14
Joined: Aug 2012
08.04.2013, 13:56
(
Last edited by Yiin; 10/04/2013 at 05:05 AM.
)
Quote:
Originally Posted by Dystans
Hi. I don't know it's an bug or maybe I'm doing something wrong. Further - I've this code:
pawn Code:
extern "C" { bool __stdcall OnPlayerConnect(int playerid) { int giveplayerid; char join[144]; SendClientMessage(playerid, COLOR_GREEN, "Hello."); sprintf(join, "%s joined to us. IP: %s", giveplayerid, ReturnIP(giveplayerid)); SendPlayerMessageToAll(giveplayerid, join); return true; } }
If I'm try to connect, I see this message, but the server immediately shuts down, but only, if I have "sprintf..." in code. I tried change SendPlayerMessageToAll to SendClientMessageToAll - the same problem, server immediately shutting down.
How to fix it?
|
pawn Code:
extern "C"
{
bool __stdcall OnPlayerConnect(int playerid)
{
char join[144], name[24];
GetPlayerName(playerid, name, 24);
SendClientMessage(playerid, COLOR_GREEN, "Hello.");
sprintf(join, "%s joined to us. IP: %s", name, ReturnIP(playerid));
SendClientMessageToAll(COLOR_GREEN, join);
return true;
}
}