SA-MP Forums Archive
[HELP] Event System Detecting - 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: [HELP] Event System Detecting (/showthread.php?tid=165352)



[HELP] Event System Detecting - Dudits - 04.08.2010

Well I need a way to detect if the player is in the event or not, so when I type the "/endevent" command it would remove weapons of everybody in the event and set their "PlayerInfo[playerid][pInEvent]" to 0.

Here's my /endevent command, tell me if you needed anything else.

pawn Код:
CMD:endevent(playerid, params[])
{
    if(!PlayerInfo[playerid][pLogged]) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You need to be logged in to excute a command.");
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are not an admin.");
    if(IsPlayerConnected(playerid))
    {
        if(!EventInfo[eStarted]) return SendClientMessage(playerid, COLOR_GRAD1, "The event hasn't started yet.");
        EventInfo[eStarted] = 0;
        EventInfo[eLocked] = 0;
        EventInfo[eSlot1] = 0;
        EventInfo[eSlot2] = 0;
        EventInfo[eSlot3] = 0;
        EventInfo[eText] = 0;
        EventInfo[eX] = 0;
        EventInfo[eY] = 0;
        EventInfo[eZ] = 0;
        ResetPlayerWeapons(playerid); // This is supposed to reset everybody's weapons
        PlayerInfo[playerid][pInEvent] = 0; // This is supposed to be set to 0 for everybody in the event
        SendClientMessageToAll(COLOR_LIGHTBLUE, "The event has been finished.");
    }
    return 1;
}



Re: [HELP] Event System Detecting - Joe_ - 04.08.2010

pawn Код:
for(new a = 0, b = GetMaxPlayers(); a < b; a++)
{
    if(PlayerInfo[a][pInEvent])
    {
        PlayerInfo[a][pInEvent] = 0;
        ResetPlayerWeapons(a);
    }
}



Re: [HELP] Event System Detecting - Dudits - 04.08.2010

Works, thank you.