lesnosanfrancisco.blogg.se

Call of duty 4 intro
Call of duty 4 intro











call of duty 4 intro

The variables recieved are "menu" (the name of the menu activated) and "response" (what option was chosen from the menu). The game waits until a menu has been activated. The first part of the code is where the variable is defined. Self waittill("menuresponse", menu, response) So, here we have a for loop to do such a thing: Inside "players" is every player on the server, and now all we need to do is use the array to thread a function to each player. So, our array has been defined as "players", or more accurately, "players". Players = getEntArray("player", "classname") To start with we must get our array of players, and instead of using the above method of defining an array and adding custom data, we can use a builtin function.

call of duty 4 intro

This can be done by using an array with a FOR loop. This means that by using array(array.size) = "blah", we can add new items to it because of the offset of 1.Ī common use for an array is to call a function on all of the players in the game. The first item in an array is listed as 0, the second as 1, and so on. Going back to the example above, we could retrieve the data by using array. To retrieve an items from an array, you can use array for the first object/var stored in it, and then array and so on for successive items. So if an array contains 1 piece of data, the array.size is 1. size does not mean it's dimensions, but the amount of items in the array. There are several operators that can be used in maths. VarAnswer will be equal to the value of var1 plus the value of var2. Maths is used throughout scripting to get many different values, be it the distance between two objects or to calculate an equation.įor example, a variable can be given data from an equation.Īlthough the above example is pretty pointless, as it adds one constant to another to make a constant, and you can just calculate it yourself and use the answer i.e.īut variables can be calculated using other variables, for example. Or they can be assigned to entities individuallyįor things like player.health (integer, already built-in, but can be modified) and level.teamBased (boolean). Variables can be global (which can be used in all threads without needing to be called) by using the This variable can be used in the current function and any function that passes it as an argument, or is called on it (so it'd be used as 'self'). Variables come in different forms: integers, floats, entities, strings, arrays and booleans, there are also several different ways variables can be stored.Ī simple variable is simply declared using Variables can be used in several ways, but in all cases they are used to store some data for the duration of the game.













Call of duty 4 intro