SA-MP Forums Archive
help little with string - 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)
+--- Thread: help little with string (/showthread.php?tid=312039)



help little with string - mineralo - 19.01.2012

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


Re: help little with string - Sinner - 19.01.2012

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!!


Re: help little with string - mineralo - 19.01.2012

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" ?


Re: help little with string - Konstantinos - 19.01.2012

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


Re: help little with string - milanosie - 19.01.2012

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


Re: help little with string - mineralo - 19.01.2012

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


Re: help little with string - mSp - 19.01.2012

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