SA-MP Forums Archive
Event system help - 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: Event system help (/showthread.php?tid=265796)



Event system help - kingchandio - 02.07.2011

Im not scripter but i know little bit copy pasting can someone merge this code and make it filter script?


pawn Код:
if(strcmp(cmd, "/startevent", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] >= 5 && (!EventStarted))
            {
                EventStarted = 1;
                EventLocked = 0;
                GetPlayerPos(playerid,ex,ey,ez);
                GetPlayerVirtualWorld(playerid);
                GetPlayerInterior(playerid);
                BroadCast(COLOR_LIGHTBLUE, "** Notice: An Event has started, use /joinevent.");
            }
            else if (PlayerInfo[playerid][pAdmin] >= 5 && (EventStarted))
            {
                EventStarted = 0;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
            }
        }
        return 1;
    }
    if(strcmp(cmd, "/joinevent", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(EventStarted == 0)
            {
                  SendClientMessage(playerid, COLOR_LIGHTBLUE, " ** An Event has not Started.");
                  return 1;
            }
            else if(EventLocked == 1)
            {
                  SendClientMessage(playerid, COLOR_RED, "** The event is locked.");
                  return 1;
            }
            new EJoin = strval(tmp);
            new vw = GetPlayerVirtualWorld(playerid);
            SetPlayerPos(playerid,ex,ey,ez);
            SetPlayerVirtualWorld(playerid,vw);
            SetPlayerInterior(playerid,EventInfo[EJoin][EInterior]);
            PlayerInfo[playerid][pInt] = EventInfo[EJoin][EInterior];
        }
        return 1;
    }
    if(strcmp(cmd, "/lockevent", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] >= 5)
            {
                EventLocked = 1;
                BroadCast(COLOR_YELLOW, "** Notice: The event has been locked by a Admin **");
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
            }
        }
        return 1;
    }






and



pawn Код:
new Events;
new Float:Event[3];

COMMAND:startevent(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 5)
    {
        BroadCast(COLOR_LIGHTBLUE, "** Notice: An Event has started, use /joinevent.");
        if(Events == 1) return SendClientMessage(playerid,-1,"There is already an event created");
        GetPlayerPos(playerid,Float:Event[0],Float:Event[1],Float:Event[2]);
        Events = 1;
    } else if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
    return 1;
}
COMMAND:joinevent(playerid, params[])
{
    if(Events == 0) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "An Event has not Started.");
    SetPlayerPos(playerid,Float:Event[0],Float:Event[1],Float:Event[2]);
    return 1;
}
COMMAND:lockevent(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 5)
    {
        BroadCast(COLOR_YELLOW, "** Notice: The event has been locked by a Admin **");
        if(Events == 0) return SendClientMessage(playerid, Red, "No event has been created");
        Events = 0;
    } else if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
    return 1;
}



Re: Event system help - Swiftz - 02.07.2011

What do u mean actually? Make it filterscript so it can merge with urs? Just make global variables in fs and change variable such as padmin to Isanadmin..


Re: Event system help - kingchandio - 02.07.2011

Yes i want to make it filter script sir can you make it filterscript i want event system i havent found anywhere just above codes kindly make filter script for me thanks...


Re: Event system help - kingchandio - 02.07.2011

i cant understnad coz im getting errors.


Re: Event system help - kingchandio - 02.07.2011

Not happening anything when /startevent help
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(" Events By Aftab");
    print("--------------------------------------\n");
    return 1;
}
new Events;
new Float:Event[3];

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmd, "/startevent", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] >= 5 && (!EventStarted))
            {
                EventStarted = 1;
                EventLocked = 0;
                GetPlayerPos(playerid,ex,ey,ez);
                GetPlayerVirtualWorld(playerid);
                GetPlayerInterior(playerid);
                BroadCast(COLOR_LIGHTBLUE, "** Notice: An Event has started, use /joinevent.");
            }
            else if (PlayerInfo[playerid][pAdmin] >= 5 && (EventStarted))
            {
                EventStarted = 0;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
            }
        }
        return 1;
    }
    if(strcmp(cmd, "/joinevent", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(EventStarted == 0)
            {
                  SendClientMessage(playerid, COLOR_LIGHTBLUE, " ** An Event has not Started.");
                  return 1;
            }
            else if(EventLocked == 1)
            {
                  SendClientMessage(playerid, COLOR_RED, "** The event is locked.");
                  return 1;
            }
            new EJoin = strval(tmp);
            new vw = GetPlayerVirtualWorld(playerid);
            SetPlayerPos(playerid,ex,ey,ez);
            SetPlayerVirtualWorld(playerid,vw);
            SetPlayerInterior(playerid,EventInfo[EJoin][EInterior]);
            PlayerInfo[playerid][pInt] = EventInfo[EJoin][EInterior];
        }
        return 1;
    }
    if(strcmp(cmd, "/lockevent", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] >= 5)
            {
                EventLocked = 1;
                BroadCast(COLOR_YELLOW, "** Notice: The event has been locked by a Admin **");
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
            }
        }
        return 1;
    }




COMMAND:startevent(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 5)
    {
        BroadCast(COLOR_LIGHTBLUE, "** Notice: An Event has started, use /joinevent.");
        if(Events == 1) return SendClientMessage(playerid,-1,"There is already an event created");
        GetPlayerPos(playerid,Float:Event[0],Float:Event[1],Float:Event[2]);
        Events = 1;
    } else if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
    return 1;
}
COMMAND:joinevent(playerid, params[])
{
    if(Events == 0) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "An Event has not Started.");
    SetPlayerPos(playerid,Float:Event[0],Float:Event[1],Float:Event[2]);
    return 1;
}
COMMAND:lockevent(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 5)
    {
        BroadCast(COLOR_YELLOW, "** Notice: The event has been locked by a Admin **");
        if(Events == 0) return SendClientMessage(playerid, Red, "No event has been created");
        Events = 0;
    } else if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
    return 1;
}
#endif