HelpMe #8 [+REP]
#1

Hey guys, i want to make a unique filterscript but i need yo help..

How can i for example define a computer?
Like, when a player types a command then it checks if he have a computer or not. If he do, then let the command process, if not then tell a error.

Psst, yeap im a newbie scripter, but thats why those forums are here.
Reply
#2

You could make this really easy by just using a variable:
pawn Код:
new PlayerHasComputer[MAX_PLAYERS]; //At the top of your script
//OnPlayerConnect:
PlayerHasComputer[playerid] = 0; //Nobody has a computer when they join the server.
//Your command:
if(!PlayerHasComputer[playerid]) return SendClientMessage(playerid,-1,"You dont have a computer so you can't use this command");
//Where you want people to get a computer from add:
PlayerHasComputer[playerid] = 1;
Note: This was writen right in the forums just as an example.
Reply
#3

Quote:
Originally Posted by cruteX_modshop
Посмотреть сообщение
Hey guys, i want to make a unique filterscript but i need yo help..

How can i for example define a computer?
Like, when a player types a command then it checks if he have a computer or not. If he do, then let the command process, if not then tell a error.

Psst, yeap im a newbie scripter, but thats why those forums are here.
Boolean data types contains values of either true or false expressions. Initialize the array as MAX_PLAYERS.

pawn Код:
new
    bool:var[MAX_PLAYERS],
    counter
;

stock loop()
{
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
        if(var[i] == true)
        {
            counter++;
        }
        else
            return 0;
    }
    printf("%d people have computers.",counter);
}
Reply
#4

Umm the first post was more simply. Thx.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)