Nubbish Coding Question
#1

Where would I put commands such at a strcmp command? what line e.g.: OnPlayerConnect()
Reply
#2

for strcmp commands
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}
Reply
#3

Thanks mate! can i put more then one here?(lol)
Reply
#4

...of course you can,have you seen any server with only ONE command?
Reply
#5

I would recommend using dcmd or zcmd, as it makes commands easier to add/manage.
Reply
#6

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
...of course you can,have you seen any server with only ONE command?
I've seen a server with no commands... A mini-missions server which made good use of the OnPlayerKeyStateChange callback and the OnPlayerEnterCheckpoint callback.
Reply
#7

Quote:
Originally Posted by Sniper Kitty
Посмотреть сообщение
I've seen a server with no commands... A mini-missions server which made good use of the OnPlayerKeyStateChange callback and the OnPlayerEnterCheckpoint callback.
Now that you mention it,I DO remeber :O(not fooling you),the controls were Numbers 2,4,6,8,that's cool,indeed.
Anyways,on-topic,indeed strcmp is unefficient and you should learn ZCMD/YCMD(they are both very good,just that YCMD is better for a server with more then 100,or 100 players,but for a server with30-50-70 players,ZCMD will do well,it's all about the proccessing time) and to make your commands more efficient use togheter with one of these system,sscanf wich is the best proccessor for commands that have the format: /command ID,rather then strtock. .And ZCMD/YCMD commands MUST not be added on OnPlayerCommandText,add them separatly at the bottom of your script .
Reply
#8

Is there any way to convert Lux Admin system/VIp etc into my gamemode.pwn? Thanks in advance
Reply
#9

For more commands:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do another thing here
        return 1;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)