connect messages
#1

Ok i have been working on this but i cant find a solution,it either works one way or not at all,so i decided to ask for help on this.
Code:
    //=====================this works =======================================================================
       if(ServerInfo[ConnectMessages] == 1){
        new Country[128];
        new pAKA[256];
        pAKA = dini_Get("ladmin/Config/aka.txt",tmp3);
        GetPlayerCountry(playerid,Country);
        new mess[128],IP[128];
        GetPlayerIp(playerid,IP,sizeof(IP));
        format(mess,sizeof(mess),"%s has joined the server.  [ Country: %s | IP Address: %s | Ping: %i ]",PlayerName,Country,IP,GetPlayerPing(playerid));
        printf(mess);
        format(mess,sizeof(mess),"%s Also Known As: %s ", PlayerName, pAKA);
        printf(mess);
        
        format(string, sizeof(string), "^^^ %s [Id:%d] has joined the server.(%s) ^^^", PlayerName, playerid, Country);
        SendClientMessageToAll(COLOR_GREY, string);}
So this works ok and shows on the server log,but i wanted it to show to admins in game,so i have sort of come up with this

Code:
    if(ServerInfo[ConnectMessages] == 1){
        new Country[128];
        new pAKA[256];
        new str[128];
        pAKA = dini_Get("ladmin/Config/aka.txt",tmp3);
        GetPlayerCountry(playerid,Country);
        new mess[128],IP[128];
        GetPlayerIp(playerid,IP,sizeof(IP));
        format(mess,sizeof(mess),"%s [Id:%d] has joined the server.  [ Country: %s | IP Address: %s | Ping: %i ]", PlayerName, playerid, Country, IP, GetPlayerPing(playerid));
        printf(mess);
        format(mess,sizeof(mess),"%s Also Known As: %s ", PlayerName, pAKA);
        printf(mess);

         for(new i = 0; i < MAX_PLAYERS; i++)
        if(IsPlayerConnected(i) && playerid != i){
        if(PlayerInfo[playerid][Level] >2)
        format(string,sizeof(string),"%s [Id:%d] has joined the server.  [ Country: %s | IP Address: %s | Ping: %i ]", PlayerName, playerid, Country, IP, GetPlayerPing(playerid));
        SendClientMessage(i,grey,string);
        format(string,sizeof(string),"%s Also Known As: %s ", PlayerName, pAKA);
        SendClientMessage(i,grey,string);
        else {
        format(string, sizeof(string), "^^^ %s [Id:%d] has joined the server.(%s) ^^^", PlayerName, playerid, Country);
        SendClientMessageToAll(COLOR_GREY, string);}}}
But it doesnt show anything at all in game to anyone,so does anyone have any idea's

fubar
Reply
#2

Code:
    if(ServerInfo[ConnectMessages] == 1){
        new Country[128];
        new pAKA[256];
        new str[128];
        pAKA = dini_Get("ladmin/Config/aka.txt",tmp3);
        GetPlayerCountry(playerid,Country);
        new mess[128],IP[128];
        GetPlayerIp(playerid,IP,sizeof(IP));
        format(mess,sizeof(mess),"%s [Id:%d] has joined the server.  [ Country: %s | IP Address: %s | Ping: %i ]", PlayerName, playerid, Country, IP, GetPlayerPing(playerid));
        printf(mess);
        format(mess,sizeof(mess),"%s Also Known As: %s ", PlayerName, pAKA);
        printf(mess);

         for(new i = 0; i < MAX_PLAYERS; i++)
        if(IsPlayerConnected(i) {
        if(PlayerInfo[i][Level] >2)
        format(string,sizeof(string),"%s [Id:%d] has joined the server.  [ Country: %s | IP Address: %s | Ping: %i ]", PlayerName, playerid, Country, IP, GetPlayerPing(playerid));
        SendClientMessage(i,grey,string);
        format(string,sizeof(string),"%s Also Known As: %s ", PlayerName, pAKA);
        SendClientMessage(i,grey,string);
        else {
        format(string, sizeof(string), "^^^ %s [Id:%d] has joined the server.(%s) ^^^", PlayerName, playerid, Country);
        SendClientMessageToAll(COLOR_GREY, string);}}}
try this.
Reply
#3

Thanks mike but i have seem to have screwed it up so i will find out what i have done wrong first and then i will try again lol
Reply
#4

kk, what actually :P
Reply
#5

ok i have sorted that problem out and im just testing it now,so i will get back to you when i see whats it is doing.

but cheers for your help mike anyways
Reply
#6

ok its all running fine now but i still cant get it to show what i want,so here goes again
Code:
    if(ServerInfo[ConnectMessages] == 1){
        new Country[128], pAKA[256], str[128], IP[128], mess[128];
        pAKA = dini_Get("ladmin/Config/aka.txt",tmp3);
        GetPlayerCountry(playerid,Country);
        GetPlayerIp(playerid,IP,sizeof(IP));
        format(mess,sizeof(mess),"%s [Id:%d] has joined the server.  [ Country: %s | IP Address: %s | Ping: %i ]", PlayerName, playerid, Country, IP, GetPlayerPing(playerid));
        printf(mess);
        format(mess,sizeof(mess),"%s Also Known As: %s ", PlayerName, pAKA);
        printf(mess);
        if (strlen(pAKA) < 3)
        format(str,sizeof(str),"* Player %s (Id:%d) has joined the server", PlayerName,playerid);
        else if (!strcmp(pAKA,PlayerName,true))
        format(str,sizeof(str),"* Player %s (Id:%d) has joined the server", PlayerName,playerid);
//        else format(str,sizeof(str),"Player %s (Id:%d) has joined the server (Aka: %s)",PlayerName,playerid,pAKA);
        else format(str,sizeof(str),"%s [Id:%d] has joined the server.  [ Country: %s | IP Address: %s | Ping: %i ]", PlayerName, playerid, Country, IP, GetPlayerPing(playerid));

        for(new i = 0; i < MAX_PLAYERS; i++)
        if(IsPlayerConnected(i)){
        if(PlayerInfo[playerid][Level] >2)
        SendClientMessage(i,grey,str);
        else {
        format(string, sizeof(string), "^^^ %s [Id:%d] has joined the server.(%s) ^^^", PlayerName, playerid, Country);
         SendClientMessage(i,grey,string);}}}
but trouble all i am getting is this part showing in game
Code:
format(string, sizeof(string), "^^^ %s [Id:%d] has joined the server.(%s) ^^^", PlayerName, playerid, Country);
and but im not getting this showing for admin in game
Code:
        else format(str,sizeof(str),"%s [Id:%d] has joined the server.  [ Country: %s | IP Address: %s | Ping: %i ]", PlayerName, playerid, Country, IP, GetPlayerPing(playerid));
So i got a bit closer thanks to mike,but still cant get what im looking for .
Reply
#7

thats not my code... i edited something and once more you edited and did it wrong again.. at the bottom, u got this looping trough all players then u check if connected ( players ) and then u check if the connecting player is admin? here is probably a working code
Code:
    if(ServerInfo[ConnectMessages] == 1){
        new Country[128], pAKA[256], str[128], IP[128], mess[128];
        pAKA = dini_Get("ladmin/Config/aka.txt",tmp3);
        GetPlayerCountry(playerid,Country);
        GetPlayerIp(playerid,IP,sizeof(IP));
        format(mess,sizeof(mess),"%s [Id:%d] has joined the server.  [ Country: %s | IP Address: %s | Ping: %i ]", PlayerName, playerid, Country, IP, GetPlayerPing(playerid));
        printf(mess);
        format(mess,sizeof(mess),"%s Also Known As: %s ", PlayerName, pAKA);
        printf(mess);
        if (strlen(pAKA) < 3)
        format(str,sizeof(str),"* Player %s (Id:%d) has joined the server", PlayerName,playerid);
        else if (!strcmp(pAKA,PlayerName,true))
        format(str,sizeof(str),"* Player %s (Id:%d) has joined the server", PlayerName,playerid);
//        else format(str,sizeof(str),"Player %s (Id:%d) has joined the server (Aka: %s)",PlayerName,playerid,pAKA);
        else format(str,sizeof(str),"%s [Id:%d] has joined the server.  [ Country: %s | IP Address: %s | Ping: %i ]", PlayerName, playerid, Country, IP, GetPlayerPing(playerid));

        for(new i = 0; i < MAX_PLAYERS; i++)
        if(IsPlayerConnected(i)){
        if(PlayerInfo[i][Level] >2)
        SendClientMessage(i,grey,str);
        else {
        format(string, sizeof(string), "^^^ %s [Id:%d] has joined the server.(%s) ^^^", PlayerName, playerid, Country);
         SendClientMessage(i,grey,string);}}}
Reply
#8

Ok cheers mike again,yer i know i did say i screwed it up in the first place,so i started again,but im am going to test it again and will let you know how i get on
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)