SA-MP Forums Archive
Help with unknown error - 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 with unknown error (/showthread.php?tid=362797)



Help with unknown error - Champ - 25.07.2012

pawn Код:
public OnPlayerConnect(playerid)
{
    static name[25];
    GetPlayerName(playerid,name,25);
    if(!strcmp(name,"Champ",true) || !strcmp(name,"Super_Champ",true) )
    {
        static str4[128]; // max size of a mensage is 128 cell it means you can type 128 caracters, so it's not neeeded put more than the max, you would be wasting memory.
        format(str4,sizeof(str4),"[24/7] Freeraom Server Owner {B8FFFF}Champ {2AFF00}Has Connected To Server !");
        SendClientMessageToAll(COLOR_SEAGREEN,str4);
    }
    return 1;
}
It's supposed to show message if i connect to server with nick "Champ" or "Super_Champ"... but it's not working for name "Super_Champ".. If i switch the names i.e; shift name "Champ" to 2nd position and "Super_Champ" to first then i see error with Champ........ Why isn't second name position working??


Re: Help with unknown error - maramizo - 25.07.2012

Change your current if statement to:
pawn Код:
if(strcmp(name,"Champ",true) == 0 && strcmp(name,"Super_Champ",true) == 0)
    {



Re: Help with unknown error - Champ - 25.07.2012

Thaaaaaaaaank you.... It worked like hell

There was just 1 mistake "&&" in code provided.. but thank you for the idea.

Reputed