Filterscript to GM
#1

ok so basically i found this filterscript

https://sampforum.blast.hk/showthread.php?tid=217076

and i wanna know how to basically put it all into the actual GM please help i dont want to run a filterscript
Reply
#2

Remove OnFilterscriptInit and OnFiltercriptExit and then copy paste all the code in your GM

This forum requires that you wait 120 seconds between posts. Please try again in 41 seconds.
This forum requires that you wait 120 seconds between posts. Please try again in 23 seconds.
Reply
#3

uhh quite confusing can you explain it in a bit better detail?
Reply
#4

He explained it very detailed....COPY everything BUT not the content of OnFilterScriptINIT/EXIT...
Reply
#5

but where do i post the enums and stocks and stuff?
Reply
#6

Suppose your GM is
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
Now, you wish to convert FS to GM, so we delete FS callbacks.
pawn Код:
//Delete them
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("Drop Gun FS by a fat guy.....Loaded!!!");
    print("--------------------------------------\n");
    return 1;
}
public OnFilterScriptExit()
{
    print("Drop Gun FS by a fat guy.....Unloaded :( ");
    return 1;
}

And in GM
public OnGameModeInit()
{
    print("\n--------------------------------------");
    print("Drop Gun FS by a fat guy.....Loaded!!!");
    print("--------------------------------------\n");
    return 1;
}
public OnGameModetExit()
{
    print("Drop Gun FS by a fat guy.....Unloaded :( ");
    return 1;
}
Now , final GameMode becomes
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

//=================//
#include <a_samp>// by SA-MP
#include <streamer>// by Incognito
#include <zcmd>// by Zeex
#include <foreach>// by ******
//=================//
#define MAX_DROP_ITEMS 1000//Change it to set the max weapons that can be dropped.
#define COLOR_ACTION 0xFFC0CBFF//Gay Pink Color
//=================//
new string[128], sendername[MAX_PLAYER_NAME], DropObject[MAX_DROP_ITEMS];
//=================//
enum dData
{
    DropGunAmmount[2],//ModelID & Bullets
    Float:DropGunPosX,
    Float:DropGunPosY,
    Float:DropGunPosZ,
    DropGunVWorld,
    DropGunInterior,
};
new DropInfo[MAX_DROP_ITEMS][dData];
//=================//
new GunObjectIDs[200] ={

   1575,  331, 333, 334, 335, 336, 337, 338, 339, 341, 321, 322, 323, 324, 325, 326, 342, 343, 344, -1,  -1 , -1 ,
   346, 347, 348, 349, 350, 351, 352, 353, 355, 356, 372, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367,
   368, 369, 1575
};
//=================//

stock GetGunObjectID(WeaponID)
{
    if (WeaponID < 0 || WeaponID > 64)
    {
        return 1575;
    }
    return GunObjectIDs[WeaponID];
}
//=================//
stock DropGun(playerid, GunID, GunAmmo, Float:X, Float:Y, Float:Z, world, interior)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if(GunID != 0 && GunAmmo != 0)
    {
        for(new i = 0; i < sizeof(DropInfo); i++)
        {
            if(DropInfo[i][DropGunPosX] == 0.0 && DropInfo[i][DropGunPosY] == 0.0 && DropInfo[i][DropGunPosZ] == 0.0)
            {
                DropInfo[i][DropGunAmmount][0] = GunID;
                DropInfo[i][DropGunAmmount][1] = GunAmmo;
                DropInfo[i][DropGunPosX] = X;
                DropInfo[i][DropGunPosY] = Y;
                DropInfo[i][DropGunPosZ] = Z;
                DropInfo[i][DropGunVWorld] = world;
                DropInfo[i][DropGunInterior] = interior;
                DropObject[i] = CreateDynamicObject(GetGunObjectID(GunID), X, Y, Z-1, 80.0, 0.0, 0.0, world);
                return 1;
            }
        }
        return 1;
    }
    return 1;
}
//=================//
stock RemovePlayerWeapon(playerid, weaponid)//Credits to Xalphox
{
    if(!IsPlayerConnected(playerid) || weaponid < 0 || weaponid > 50)
        return;
    new saveweapon[13], saveammo[13];
    for(new slot = 0; slot < 13; slot++)
        GetPlayerWeaponData(playerid, slot, saveweapon[slot], saveammo[slot]);
    ResetPlayerWeapons(playerid);
    for(new slot; slot < 13; slot++)
    {
        if(saveweapon[slot] == weaponid || saveammo[slot] == 0)
            continue;
        GivePlayerWeapon(playerid, saveweapon[slot], saveammo[slot]);
    }

    GivePlayerWeapon(playerid, 0, 1);

}

//=================//
public OnPlayerDeath(playerid, killerid, reason)
{
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    DropGun(playerid, GetPlayerWeapon(playerid),GetPlayerAmmo(playerid),X,Y,Z,GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
    return 1;
}
//=================//
command(dropgun, playerid, params[])
{
    new Float:X,Float:Y,Float:Z;
    new GunID = GetPlayerWeapon(playerid);
    new GunAmmo = GetPlayerAmmo(playerid);
    GetPlayerName(playerid, sendername, sizeof(sendername));
    GetPlayerPos(playerid, X, Y, Z);
    RemovePlayerWeapon(playerid, GunID);
    DropGun(playerid, GunID,GunAmmo,X,Y,Z,GetPlayerVirtualWorld(playerid),GetPlayerInterior(playerid));
    format(string, sizeof(string), "* %s drops his weapon to the pavement.", sendername);
    SendLocalMessage(playerid, string, 10.0, COLOR_ACTION, COLOR_ACTION);
    return 1;
}
//=================//
command(pickupgun, playerid, params[])
{
    for(new i = 0; i < sizeof(DropInfo); i++)
    {
        if (IsPlayerInRangeOfPoint(playerid, 2.0,DropInfo[i][DropGunPosX],DropInfo[i][DropGunPosY],DropInfo[i][DropGunPosZ]))
        {
            if(GetPlayerVirtualWorld(playerid) == DropInfo[i][DropGunVWorld] && GetPlayerInterior(playerid) == DropInfo[i][DropGunVWorld])
            {
                GetPlayerName(playerid, sendername, sizeof(sendername));
                DestroyDynamicObject(DropObject[i]);
                DropInfo[i][DropGunPosX] = 0.0;
                DropInfo[i][DropGunPosY] = 0.0;
                DropInfo[i][DropGunPosZ] = 0.0;
                DropInfo[i][DropGunAmmount][0] = 0;
                DropInfo[i][DropGunAmmount][1] = 0;
                GivePlayerWeapon(playerid,DropInfo[i][DropGunAmmount][0],DropInfo[i][DropGunAmmount][1]);
                format(string, sizeof(string), "* %s picks up a weapon from the pavement.", sendername);
                SendLocalMessage(playerid, string, 10.0, COLOR_ACTION, COLOR_ACTION);
                return 1;
            }
        }
    }
    return 1;
}
//=================//
stock SendLocalMessage(playerid, msg[], Float:MessageRange, Range1color, Range2color)
{
    new Float: PlayerX, Float: PlayerY, Float: PlayerZ;
    GetPlayerPos(playerid, PlayerX, PlayerY, PlayerZ);
    foreach (Player, i)
    {
        if(IsPlayerInRangeOfPoint(i, MessageRange, PlayerX, PlayerY,PlayerZ))
        {
            SendClientMessage(i, Range1color, msg);
        }
        else if(IsPlayerInRangeOfPoint(i, MessageRange/2.0, PlayerX, PlayerY,PlayerZ))
        {
            SendClientMessage(i, Range2color, msg);
        }
    }
}


public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    print("\n--------------------------------------");
    print("Drop Gun FS by a fat guy.....Loaded!!!");
    print("--------------------------------------\n");
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    print("Drop Gun FS by a fat guy.....Unloaded :( ");
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}


public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)