Commands problem..
#1

Hello when i add this command "/event" and when i write any command of my server it's give me /event options command.. How to fix it?

Код:
    if(!strcmp(rCmd, "/event", true))
    {
        new r_r[0x24], eArma, eOption;
        r_r = strtok(cmdtext, idx);
        if(!strlen(r_r))
        {
            SendClientMessage(playerid, eCor, "Use: /event [option]'");
			SendClientMessage(playerid, -1, "enter, \"/ecredits\"");
			if (PlayerInfo[playerid][pAdmin] >= 2)
			{
                SendClientMessage(playerid, -1, "[Admin]: gun[1-8], useskin, eventskin, life, armour");
			    SendClientMessage(playerid, -1, "[Admin]: maxplayers, open, close, kick, createcar, destroycars");
            }
            return 0x01;
		}
        if(strcmp(r_r,"destroycars",true) == 0)
		{
            for(new i = 0; i < MAX_VEHICLES; ++i) {
                if(eventoCarro[i] == 1)
                    DestroyVehicle(i);
            }
            format(eString, sizeof(eString), "Admin %s destroyed all the event cars !", eNome(playerid));
            SendClientMessageToAll(eCor, eString);
            return 1;
        }
        if(strcmp(r_r,"createcar",true) == 0)
		{
            new contador = 0;
            for(new i = 0; i < MAX_VEHICLES; ++i) {
                if(eventoCarro[i] == 1)
                    ++contador;
            }
            if(contador > EventoInfo[eQuantidadeVagas]) return SendClientMessage(playerid, -1, "[ERROR]: The cars are at the maximum event players !");
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            new carroid, cor1, cor2, idcarro;

            tmp = strtok(cmdtext, idx); //Carro ID
			if(!strlen(tmp)) return SendClientMessage(playerid, -1, "<!> /evento criarcarro [carid] [cor1] [cor2]");
			carroid = strval(tmp);
            if(carroid < 400 || carroid > 611) return SendClientMessage(playerid, -1, "[AD:Event] Ops, vehicle ID isn't allowed!");

            tmp = strtok(cmdtext, idx); //Cor 1
			if(!strlen(tmp)) return SendClientMessage(playerid, -1, "<!> /evento criarcarro [carid] [cor1] [cor2]");
			cor1 = strval(tmp);
			if(cor1 < -1 || cor1 > 126) return SendClientMessage(playerid, -1, "[AD:Event]: Use  0 to 126 colors");

            tmp = strtok(cmdtext, idx); //Cor 2
			if(!strlen(tmp)) return SendClientMessage(playerid, -1, "<!> /event createcar [carid] [color1] [color2]");
			cor2 = strval(tmp);
            if(cor2 < -1 || cor2 > 126) return SendClientMessage(playerid, -1, "[AD:Event]: Use  0 to 126 colors");

            new Float:Pos[3]; GetPlayerPos(playerid, Pos[0],Pos[1],Pos[2]);
			idcarro = CreateVehicle(carroid, Pos[0],Pos[1],Pos[2], 0.0, cor1, cor2, 60000);
			eventoCarro[idcarro] = 1;
			LinkVehicleToInterior(idcarro, GetPlayerInterior(playerid));
			SetVehicleVirtualWorld(idcarro, GetPlayerVirtualWorld(playerid));
			format(eString, sizeof(eString), "<!> Event car of ID [%d] created! [Model: %i color1: %1, color2: %i, PosX: %f,Y:%f,Z:%f].", idcarro, carroid, cor1, cor2, Pos[0],Pos[1],Pos[2]);
			SendClientMessage(playerid, eCor, eString);
			format(eString, sizeof(eString), "<!> Admin %s criou o carro [%d] para um evento. [Model: %i color1: %1, color2: %i, PosX: %f,Y:%f,Z:%f].", idcarro, carroid, cor1, cor2, Pos[0],Pos[1],Pos[2]);
			for(new i = 0; i < GetMaxPlayers(); ++i) if(IsPlayerAdmin(i)) SendClientMessage(i, -1, eString);
			return 0x01;
        }
        if(strcmp(r_r,"kick",true) == 0)
		{
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use /evento kick [ID] [reason]");
            new id = strval(tmp);
            new length = strlen(cmdtext), offset = idx, result[128]
			while ((idx < length) && (cmdtext[idx] <= ' ')) idx++;
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; }
            result[idx - offset] = EOS;
			if(!strlen(result)) return SendClientMessage(playerid, eCor, "<!> Use /event kick [ID] [reason]");
            if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID || eEntrou[id] == false) return SendClientMessage(playerid, -1, "Invalid playerid / Offline playerid / The player isn't at the event.");
            if(strlen(result) == 0) { format(eString, sizeof(eString), "[AD:Event]: Administrator %s kickou %s do evento, motivo: Not informed", eNome(playerid), eNome(id)); }
            else { format(eString, sizeof(eString), "[AD:Event]: Administrator %s kicked %s from the event, reason: %s", eNome(playerid), eNome(id),(result)); }
            SendClientMessageToAll(eCor, eString);
            Kick(id);
            return 0x01;
        }
        if(strcmp(r_r,"close",true) == 0)
		{
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            new length = strlen(cmdtext), offset = idx, result[128]
			while ((idx < length) && (cmdtext[idx] <= ' ')) idx++;
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; }
            result[idx - offset] = EOS;
			if(!strlen(result)) return SendClientMessage(playerid, eCor, "<!> /event close [reason]");
            EventoInfo[eStatus] = false;
            if(strlen(result) == 0) { format(eString, sizeof(eString), "[AD:Event]: Administrator %s closes the event, reason: Not informed", eNome(playerid)); }
            else { format(eString, sizeof(eString), "[AD:Event]: Administrator %s closes the event, reason: %s", eNome(playerid), (result)); }
            SendClientMessageToAll(eCor, eString);
            resetarEvento();
            return 0x01;
        }
        if(strcmp(r_r,"open",true) == 0)
		{
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            EventoInfo[eStatus] = true;
            format(eString, sizeof(eString), "[AD:Event]: Administrator %s open an event! use \"/event enter\" to enter! MaxPlayers: %i", eNome(playerid), EventoInfo[eQuantidadeVagas]);
            SendClientMessageToAll(eCor, eString);
            return 0x01;
        }
        if(strcmp(r_r,"maxplayers",true) == 0)
		{
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /event maxplayers [how many?]");
            eOption = strval(tmp);
            EventoInfo[eColete] = eOption;
            format(eString, sizeof(eString), "[AD:Event]: Maximum event people seted to %i", eOption);
            SendClientMessage(playerid, eCor, eString);
            return 0x01;
        }
        if(strcmp(r_r,"armour",true) == 0)
		{
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /event armour [how many?]");
            new Float:eOption2 = floatstr(tmp);
            EventoInfo[eColete] = eOption2;
            format(eString, sizeof(eString), "[AD:Event]: Event armour seted to %f", eOption2);
            SendClientMessage(playerid, eCor, eString);
            return 0x01;
        }
        if(strcmp(r_r,"health",true) == 0)
		{
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /event life [how many?]");
            new Float:eOption2 = floatstr(tmp);
            EventoInfo[eVida] = eOption2;
            format(eString, sizeof(eString), "[AD:Event]: Event life seted to %f", eOption2);
            SendClientMessage(playerid, eCor, eString);
            return 0x01;
        }
        if(strcmp(r_r,"eventskin",true) == 0)
		{
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            if(EventoInfo[eUseSkin] == false) return SendClientMessage(playerid, eCor, "[AD:Event]: Use \"/event useskin 1\" to active the event skin.");
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /event eventskin [skinid]");
            eOption = strval(tmp);
            if(eOption < 0 || eOption > 299) return SendClientMessage(playerid, eCor, "[AD:Event]: Use 1 to 299 skins.");
            EventoInfo[eSkin] = eOption;
            return 0x01;
        }
        if(strcmp(r_r,"useskin",true) == 0)
		{
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /event useskin [option]");
            eOption = strval(tmp);
            if(eOption < 0 || eOption > 1) return SendClientMessage(playerid, eCor, "[AD:Event]: Use (1 - active) | (0 - unactive).");
            if(eOption == 1) (EventoInfo[eUseSkin] = true); else (EventoInfo[eUseSkin] = false);
            return 0x01;
        }
        if(strcmp(r_r,"enter",true) == 0)
		{
            if(EventoInfo[eStatus] == 0) return SendClientMessage(playerid, eCor, "[AD:Event]: Evento fechado!");
            eEntrou[playerid] = true;
            entrarEvento(playerid);
        }
        if(strcmp(r_r,"gun1",true) == 0)
		{
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /event gun1 [gunID]");
            eArma = strval(tmp);
            if(eArma < 1 || eArma > 49) return SendClientMessage(playerid, eCor, "[AD:Event]: invalid weapon id.");
            EventoInfo[eArmas][0] = eArma;
            return 0x01;
        }
        if(strcmp(r_r,"gun2",true) == 0)
		{
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /event gun2 [gunID]");
            eArma = strval(tmp);
            if(eArma < 1 || eArma > 49) return SendClientMessage(playerid, eCor, "[AD:Event]: invalid weapon id.");
            EventoInfo[eArmas][1] = eArma;
            return 0x01;
        }
        if(strcmp(r_r,"gun3",true) == 0)
		{
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /event gun3 [gunID]");
            eArma = strval(tmp);
            if(eArma < 1 || eArma > 49) return SendClientMessage(playerid, eCor, "[AD:Event]: invalid weapon id.");
            EventoInfo[eArmas][2] = eArma;
            return 0x01;
        }
        if(strcmp(r_r,"gun4",true) == 0)
		{
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /event gun4 [gunID]");
            eArma = strval(tmp);
            if(eArma < 1 || eArma > 49) return SendClientMessage(playerid, eCor, "[AD:Event]: invalid weapon id.");
            EventoInfo[eArmas][3] = eArma;
            return 0x01;
        }
        if(strcmp(r_r,"gun5",true) == 0)
		{
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /event gun5 [gunID]");
            eArma = strval(tmp);
            if(eArma < 1 || eArma > 49) return SendClientMessage(playerid, eCor, "[AD:Event]: invalid weapon id.");
            EventoInfo[eArmas][4] = eArma;
            return 0x01;
        }
        if(strcmp(r_r,"gun6",true) == 0)
		{
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /event gun6 [gunID]");
            eArma = strval(tmp);
            if(eArma < 1 || eArma > 49) return SendClientMessage(playerid, eCor, "[AD:Event]: invalid weapon id.");
            EventoInfo[eArmas][5] = eArma;
            return 0x01;
        }
        if(strcmp(r_r,"gun7",true) == 0)
		{
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /event gun7 [gunID]");
            eArma = strval(tmp);
            if(eArma < 1 || eArma > 49) return SendClientMessage(playerid, eCor, "[AD:Event]: invalid weapon id.");
            EventoInfo[eArmas][6] = eArma;
            return 0x01;
        }
        if(strcmp(r_r,"gun8",true) == 0)
		{
            if(!Admin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Event]: You're not an Administrator.");
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /event gun8 [gunID]");
            eArma = strval(tmp);
            if(eArma < 1 || eArma > 49) return SendClientMessage(playerid, eCor, "[AD:Event]: invalid weapon id.");
            EventoInfo[eArmas][7] = eArma;
            return 1;
        }
        return 1;
    }
Reply
#2

Help please?
Reply
#3

Help?
Reply
#4

Do you use OnPlayerCommandText?
Reply
#5

do you use sscanf2, and zcmd?
Reply
#6

Yes i use OnPlayerCommandText and i dont use zcmd.
Reply
#7

Help?
Reply
#8

explain more
Reply
#9

What?
Reply
#10

Please help me to fix this problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)