SA-MP Forums Archive
How do i make a filterscript? - 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: How do i make a filterscript? (/showthread.php?tid=573047)



How do i make a filterscript? - sharmarke - 04.05.2015

So i have this code from a script i really like it and want to make it into a filterscript so i can run it on my server soooo i wana know how to do it


Heres the code




//----------------------------------------[New MoneyBags system]--------------------//
if(strcmp(cmd, "/makemoneybag", true) == 0 || strcmp(cmd, "/moneybag", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 1337)
{
return SendClientMessage(playerid, GREY, " You are not authorized to use this command.");
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SyntaxMessage(playerid, "/makemoneybag [amount]");
new amount = strval(tmp);
if(amount < 1) return SendClientMessage(playerid, WHITE, "cannot go below 1.");
new Float:X,Float:Y,Float:Z;
new location[MAX_ZONE_NAME];
GetPlayerPos(playerid,X,Y,Z);
CreateMoney(X, Y, Z, amount);
if(!IsPlayerInAnyVehicle(playerid))
{
SetPlayerPosEx(playerid, X, Y-2, Z);
}
SendClientMessage(playerid, GREY1,"* Money bag created.");
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
format(string, sizeof(string), "WARNING: %s has created a money bag worth $%d in %s (%0.2f, %0.2f, %0.2f).", sendername, amount, location, X, Y, Z);
ABroadCast(RED, string, 1);
format(string, sizeof(string), "{FF6347}%s has hidden a money bag in %s worth $%d!", sendername, location, amount);
SendClientMessageToAll(LIGHTRED, string);
return 1;
}
}
if(strcmp(cmd, "/deletebag", true) == 0 || strcmp(cmd, "/deletemoneybag", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] <= 3)
{
return SendClientMessage(playerid, GREY, " You are not authorized to use this command.");
}
DeleteClosestBag(playerid);
return 1;
}
}
if(strcmp(cmd, "/deletebags", true) == 0 || strcmp(cmd, "/deletemoneybags", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] <= 99999)
{
return SendClientMessage(playerid, GREY, " You are not authorized to use this command.");
}
DeleteAllBags();
SendClientMessage(playerid, GREY2, "* Money bags destroyed.");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "WARNING: %s has destroyed all money bags.", sendername);
ABroadCast(RED, string, 1);
return 1;


Please help or teach and explain to me how to do it or just do it for me because im a complete noob xD


Re: How do i make a filterscript? - justice96 - 04.05.2015

Pls use code inside of it


Re: How do i make a filterscript? - Redirect Left - 04.05.2015

Open up Pawno.exe and click on new.

Do the same as you would for a normal script, but use OnFilterScriptInit & OnFilterScriptExit instead of OnGameMode*. Uncomment the top line to define it as a filterscript.