command question
#8

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
No, it is not. It does not make sense to store per-player array just for 1 second until they get kicked? What is the purpose?

Local variable "id" is just fine, it does what it has to do and that's all you need. There is one (main) thread so they cannot be executed at the same time. After the code execution is finished, it is deleted and when another player types the command, it creates a new variable again. No conflicts.
Thank you very much bro I was looking for an answer like this

Quote:
Originally Posted by Infin1ty
Посмотреть сообщение
Код:
CMD:kick(playerid, params[]) // params is a string.
{
       new id;

       // you missed an extra bracket after 'id'
       if(sscanf(params, "u", id))  return scm(playerid, COLOR_USAGE, "USAGE:/kick [id]");
       if(id == INVALID_PLAYER_ID) return scm(playerid, COLOR_ERROR, "invalid id");

       Kick(id);
       return 1;
}
The code you have just given us is perfectly fine. I've improved it where I've noticed a couple of issues.
lol yeah, thanks it's just an example
Reply


Messages In This Thread
command question - by GameOvr - 09.09.2018, 08:14
Re: command question - by Kane - 09.09.2018, 08:16
Re: command question - by GameOvr - 09.09.2018, 08:18
Re: command question - by Kane - 09.09.2018, 08:20
Re: command question - by DarknesS1988 - 09.09.2018, 08:20
Re: command question - by Calisthenics - 09.09.2018, 08:25
Re: command question - by Infin1ty - 09.09.2018, 09:27
Re: command question - by GameOvr - 09.09.2018, 11:32

Forum Jump:


Users browsing this thread: 1 Guest(s)