SA-MP Forums Archive
I have a little problem in my event system - 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: I have a little problem in my event system (/showthread.php?tid=591506)



I have a little problem in my event system - Mikkel_RE - 12.10.2015

Hello, i have an event system, Works like many others /startevent [event name] and i have been trying to make it into a timer that it will show to everyone every 5 minutes "An event is running (event name)" but it wont show the event name that i typed when i started the event

Startevent code:
pawn Код:
if(strcmp(cmd, "/startevent", true) == 0)
    {
        new offset = idx;
        new result[128];
        // if player is not authorized, return error
        if(!(PlayerInfo[playerid][pAdmin] & ADMIN_TELEPORT))
            return SendClientMessage(playerid, GREY, AdminOnly);
        // if event is already running, return error
        if(gEventActive)
            return SendClientMessage(playerid, COLOR_GRAD1, " An event is already running. Use /endevent to end it.");
        // get position and store in array
        GetPlayerPos(playerid, aEventCoords[event_x],aEventCoords[event_y],aEventCoords[event_z]);
        // get appropriate facing angle and store in array
        if(IsPlayerInAnyVehicle(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid),aEventCoords[event_a]);
        else GetPlayerFacingAngle(playerid,aEventCoords[event_a]);
        // get interiorid and worldid and store in array
        aEventCoords[event_interior] = GetPlayerInterior(playerid);
        aEventCoords[event_world] = GetPlayerVirtualWorld(playerid);
        aEventCoords[event_name] = result[playerid];
        format(string, sizeof(string),"%s",(result));
        // notify admins and players that event is starting
        format(string, sizeof(string), " [AdmCmd]: %s started an event.",Name(playerid));
        ABroadCast(COLOR_YELLOW,string,1);
        HackLog(string);
        result[idx - offset] = EOS;
        strmid(result,cmdtext,idx,strlen(cmdtext));
        if(strlen(result))
        {
            format(string,sizeof(string),"Notice: An event has been started, to join it type /joinevent (%s )",result);
        }
        else
        {
            format(string,sizeof(string),"Notice: An event has been started, to join it type /joinevent");
        }
        OOCNews(COLOR_RCON,string);
        // start event
        gEventActive = 1;
        return 1;
    }

Timer code:
pawn Код:
public Production()
{
    new idx;
    new result[128];
    new offset = idx;
    result[idx - offset] = EOS;
    if(gEventActive)
    {
        if(aEventCoords[event_name])
        {
            format(result,sizeof(result),"Notice: An event is running, to join it type /joinevent (%s)",aEventCoords[event_name]);
        }
        else
        {
            format(result,sizeof(result),"Notice: An event is running, to join it type /joinevent");
        }
    }
}



Re: I have a little problem in my event system - Isolated - 12.10.2015

what is EOS defined as?


Re: I have a little problem in my event system - Mikkel_RE - 12.10.2015

Result


Re: I have a little problem in my event system - Mikkel_RE - 13.10.2015

Anyone?