[HELP] Event System
#8

Quote:
Originally Posted by PotH3Ad
Посмотреть сообщение
Try this

pawn Код:
CMD:setevent(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(EventInfo[eStarted]) return SendClientMessage(playerid, COLOR_GRAD1, "You have already started the event.");
        new eventrelated[24];
        new slot[4];
        new gunid;
        new message[32];
        if(sscanf(params, "s", eventrelated)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setevent [position - weapons]");
        if(!strcmp(eventrelated, "position", true, 8))
        {
            EventInfo[eInt] = GetPlayerInterior(playerid);
            GetPlayerPos(playerid, EventInfo[eX], EventInfo[eY], EventInfo[eZ]);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have set the event's starting position.");
        }
        else if(!strcmp(eventrelated, "weapons", true, 7))
        {
            if(sscanf(params, "sii", eventrelated, gunid, slot)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setevent weapons [gun id] [slot(1-3)]");
            if(!strcmp(slot, "1", true, 1))
            {
                EventInfo[eSlot1] = gunid;
                format(message, sizeof(message), "You have set the event's slot 1 gun to %s", gunid);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, message);
            }
            else if(!strcmp(slot, "2", true, 1))
            {
                EventInfo[eSlot2] = gunid;
                format(message, sizeof(message), "You have set the event's slot 2 gun to %s", gunid);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, message);
            }
            else if(!strcmp(slot, "3", true, 1))
            {
                EventInfo[eSlot3] = gunid;
                format(message, sizeof(message), "You have set the event's slot 3 gun to %s", gunid);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, message);
            }
        }
    }
    return 1;
}
I can enter the gunid now, but nothing happens when I enter the slot
Edit: I removed the ! and it sent the message, lemme test if this works.
2x Edit: Yup works, <3
3x Edit: Well it only adds weapons to slot 1 when the !'s are removed, here's my code.

pawn Код:
CMD:setevent(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(EventInfo[eStarted]) return SendClientMessage(playerid, COLOR_GRAD1, "You have already started the event.");
        new eventrelated[24];
        new slot[4];
        new gunid;
        new message[128];
        if(sscanf(params, "s", eventrelated)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setevent [position - weapons]");
        if(!strcmp(eventrelated, "position", true, 8))
        {
            EventInfo[eInt] = GetPlayerInterior(playerid);
            GetPlayerPos(playerid, EventInfo[eX], EventInfo[eY], EventInfo[eZ]);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have set the event's starting position.");
        }
        else if(!strcmp(eventrelated, "weapons", true, 7))
        {
            if(sscanf(params, "sii", eventrelated, gunid, slot)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setevent weapons [gun id] [slot(1-3)]");
            if(!strcmp(slot, "1", true, 1))
            {
                EventInfo[eSlot1] = gunid;
                format(message, sizeof(message), "You have set the event's slot 1 gun to %s", gunid);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, message);
            }
            else if(!strcmp(slot, "2", true, 1))
            {
                EventInfo[eSlot2] = gunid;
                format(message, sizeof(message), "You have set the event's slot 2 gun to %s", gunid);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, message);
            }
            else if(!strcmp(slot, "3", true, 1))
            {
                EventInfo[eSlot3] = gunid;
                format(message, sizeof(message), "You have set the event's slot 3 gun to %s", gunid);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, message);
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
[HELP] Event System - by Dudits - 01.08.2010, 02:04
Re: [HELP] Event System - by Dudits - 01.08.2010, 05:00
Re: [HELP] Event System - by Dudits - 01.08.2010, 12:11
Re: [HELP] Event System - by Vince - 01.08.2010, 13:24
Re: [HELP] Event System - by Daren_Jacobson - 01.08.2010, 14:53
Re: [HELP] Event System - by Dudits - 02.08.2010, 00:55
Re: [HELP] Event System - by PotH3Ad - 02.08.2010, 01:04
Re: [HELP] Event System - by Dudits - 02.08.2010, 01:09
Re: [HELP] Event System - by Dudits - 02.08.2010, 02:44
Re: [HELP] Event System - by Dudits - 02.08.2010, 05:59

Forum Jump:


Users browsing this thread: 1 Guest(s)