Jump to content
  • 0

Problema comanda


Andrey.bca

Question

Problema intalnita (descriere): Este un sistem de event , nu da nici o eroare , dar cand intru pe server nu merge comenzile respective..
Ero(area / rile) / warning-(ul / urile): Nu sunt
Liniile de cod / sursa / script-ul(obligatoriu):

#include <a_samp>

    stock
CMD:stopevent(playerid, params[])
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 9)
            {
                 EventStarted = 0;
                 GetPlayerName(playerid, sendername, sizeof(sendername));
                 format(string, sizeof(string), " [Event]Admin %s A Oprit Eventul .", sendername);
                OOCNews(COLOR_RED,string);
             }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
            }
         }
         return 1;
    }
    stock
CMD:startevent(playerid, params[])
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] >= 9 && (!EventStarted))
            {
                EventStarted = 1;
                EventLocked = 0;
                GetPlayerPos(playerid,ex,ey,ez);
                GetPlayerName(playerid, sendername, sizeof(sendername));
                 format(string, sizeof(string), "[Event]Admin %s A Pornit Un event, pentru a face parte din event /joinevent .", sendername);
                OOCNews(COLOR_LIGHTRED,string);
            }
            else if (PlayerInfo[playerid][pAdmin] >= 9 && (EventStarted))
            {
                EventStarted = 0;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
            }
        }
        return 1;
    }
    stock
CMD:joinevent(playerid, params[])
    {
        if(IsPlayerConnected(playerid))
        {
            if(EventStarted == 0)
              {
                  SendClientMessage(playerid, COLOR_LIGHTBLUE, "[Event] Eventul nu a fost pornit .");
                  return 1;
            }
            else if(EventLocked == 1)
              {
                  SendClientMessage(playerid, COLOR_RED, "[Event] Eventul A Fost Blocat");
                  return 1;
            }
            SetPlayerPos(playerid,ex,ey,ez);
            SetPlayerInterior(playerid,0);
            SetPlayerVirtualWorld(playerid,0);
            PlayerInfo[playerid][pInt] = 0;
        }
        return 1;
    }
    stock
CMD:lockevent(playerid, params[])
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] >= 9)
            {
                EventLocked = 1;
                GetPlayerPos(playerid,ex,ey,ez);
                GetPlayerName(playerid, sendername, sizeof(sendername));
                 format(string, sizeof(string), "[Event] Admin %s A Blocat Eventul .", sendername);
                 OOCNews(COLOR_LIGHTBLUE,string);
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
            }
        }
        return 1;
    }

 
Imagini / Video (optional): http://imgur.com/a/MMbpq
Ati incercat sa rezolvati singur?: Da

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

1. Scoate stock-urile din fata comenzilor, iti creezi erori singur.

2. Nu mai pune conditie pentru "IsPlayerConnected", pentru ca, e clar ca, un player nu poate folosi comanda daca nu e pe server, si e pe WC de exemplu. Acea conditie se pune doar la loop-ul for in care incadrezi toti playerii intr-o variabila. Foreach are nativ acea conditie pusa, n-ai tu nevoie s-o mai pui inca odata.

3. Invata-te sa faci functii si sa lucrezi cu ele. Tu ai prea multe linii, invata optimizare, reducerea liniilor ajuta la inlaturarea sanselor de a avea lag.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.