SA-MP Forums Archive
Whats Wrong With This Simple Script? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Whats Wrong With This Simple Script? (/showthread.php?tid=175414)



Whats Wrong With This Simple Script? - xXxMarcuSxXx - 09.09.2010

I'm a N00B don't tell me I suck, I already know.
Код:
#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Connect and Disconnect MSGS");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print("Made By Marcus_Von");
	print("----------------------------------\n");
}

public OnPlayerConnect(playerid)
{
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string," Welcome To Our Server!",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    new
        string[64],
        name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    switch(reason)
    {
        case 0: format(string,sizeof string,"%s left the server. (Disconnected)",name);
        case 1: format(string,sizeof string,"%s left the server. (Closed SA-MP)",name);
        case 2: format(string,sizeof string,"%s left the server. (Used Cheats)",name);
    }
    SendClientMessageToAll(0xFFFFFFAA,string);
    return 1;
}



Re: Whats Wrong With This Simple Script? - TouR - 09.09.2010

Well do you have errors or something dont work properly?


Re: Whats Wrong With This Simple Script? - Hiddos - 09.09.2010

And what doesn't work :P


Re: Whats Wrong With This Simple Script? - xXxMarcuSxXx - 09.09.2010

Theres no errors, It just doesn't show up... It's a Onplayerconnect and disconnect script.

Rofl, enless I put it in the wrong place...


Re: Whats Wrong With This Simple Script? - TouR - 09.09.2010

Are you sure you added the FS to your server.cfg?


Re: Whats Wrong With This Simple Script? - Hiddos - 09.09.2010

pawn Код:
#include <a_samp>

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Connect and Disconnect MSGS");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string," Welcome To Our Server, %s!",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    new
        string[64],
        name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    switch(reason)
    {
        case 0: format(string,sizeof string,"%s left the server. (Disconnected)",name);
        case 1: format(string,sizeof string,"%s left the server. (Closed SA-MP)",name);
        case 2: format(string,sizeof string,"%s left the server. (Used Cheats)",name);
    }
    SendClientMessageToAll(0xFFFFFFAA,string);
    return 1;
}
Explanation: You had "#if defined filterscript". This code is actually useless, and can be ignored. However, in a new script there is "//#define filterscript //De-comment this line if you want to write an FS". This line, as well, is rubbish. But because "#define filterscript" was commented, it wasn't defined. So that brings us to "#if defined filterscript", but it was not defined. The problem started at "#else", which gets executed when it was not defined (Which it wasn't). You probably had "#endif" at the end of the script, telling the script to execute that code when the script WAS NOT DEFINED AS AN FS (IMPORTANT). Therefor, the script didn't do anything at all because you loaded it as an FS.


Re: Whats Wrong With This Simple Script? - xXxMarcuSxXx - 09.09.2010

Sorry please translate FS into noob language


Re: Whats Wrong With This Simple Script? - TouR - 09.09.2010

Filterscript mate...


Re: Whats Wrong With This Simple Script? - xXxMarcuSxXx - 09.09.2010

Oh, I knew that.. Yeah I forgot, I just did it know.. Hodl on lemme play with some stuff


Re: Whats Wrong With This Simple Script? - xXxMarcuSxXx - 09.09.2010

And if theres no errors does that mean I just didn't load it right?