help little with string
#1

pawn Код:
public OnPlayerConnect(playerid)
{
    new ip[16],join[256];
    GetPlayerIp(playerid,ip,sizeof(ip));
    format(join,sizeof(join),"( ! ) %s(IP: %d) has logged in",PlayerName(playerid),ip);
    MessageToAdmins(COLOR_GREY,join);
return 1;
}

well, should show player's ip but show that shit
Reply
#2

Show us your MessageToAdmins() function, also NEVER use 256 bytes for a message string, it's a waste of memory since the max length is 128!!
Reply
#3

Quote:
Originally Posted by Sinner
Посмотреть сообщение
Show us your MessageToAdmins() function, also NEVER use 256 bytes for a message string, it's a waste of memory since the max length is 128!!
it's very simple message to admins
pawn Код:
forward MessageToAdmins(color,const string[]);
public MessageToAdmins(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) == 1) if (GetPlayerAdminz(i) >= 1) SendClientMessage(i, color, string);
    }
    return 1;
}
and what is deference between "%s" "%d" and "%i" ?
Reply
#4

pawn Код:
public OnPlayerConnect( playerid )
{
    new
        ip[ 16 ], join[ 128 ];
       
    format( join, sizeof( join ), "( ! ) %s(IP: %s) has logged in", PlayerName( playerid ), GetPlayerIp(playerid, Ip, sizeof( Ip ) ) );
    MessageToAdmins( COLOR_GREY, join );
    return 1;
}
%s = string
%i & %d = integer
Reply
#5

Quote:
Originally Posted by mineralo
Посмотреть сообщение
it's very simple message to admins
pawn Код:
forward MessageToAdmins(color,const string[]);
public MessageToAdmins(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) == 1) if (GetPlayerAdminz(i) >= 1) SendClientMessage(i, color, string);
    }
    return 1;
}
and what is deference between "%s" "%d" and "%i" ?
I and D are for numbers
S is for any line of text. ****** sscanf samp and find it
Reply
#6

and secondary question, where from I can get the plugi where I can get player's country?
Reply
#7

You can try GeoIP plugin:

https://sampforum.blast.hk/showthread.php?tid=32509

Or plugin-free version

https://sampforum.blast.hk/showthread.php?tid=190699
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)