|
Author
|
Message
|
|
Senior Member
|

05-14-2009
, 00:23
[HELP] Some questions to ask :D
|
#1
|
to yamikaito : sorry about the pervious post xD
you rock :O
______________
well i wan to ask somethings
1) What is the usefull of static?
ANSWER:
fysiks
Quote:
|
Use static for variables when the function is called a lot (like PreThink).
|
Bugsy
Quote:
Using static variables- The function is being called very frequently.
- If the variable requires a lot of memory allocation. Commonly used for large strings\arrays.
- If you wish the data to remain static [stored in memory between function calls].
|
arkshine
Quote:
|
static acts like a global var but the variable is local to the function. 'new' initializes the var each time where 'static' is created one time and is kept in the memory. In a forward called very often static should be used. Actually it's useful for large array because initializing a big array means write a zero for every byte and in a callback called often the performance could be decreased drastically.
|
2) when i put g_ to a code does it changes it to global or just labelling and same to sz does it make it string? or just labelling.
ANSWER:
fysiks
Quote:
|
It's only a label. (You can look up Hungarian Notation)
|
Bugsy
Quote:
Pawn does not have different data types so keep that in mind; the language uses only a 4-byte data type called a cell for everything. You can tag a variable with 'Float:' or 'bool:' which tells Pawn how to handle the data stored in the cell but regardless of tagging, it is still a 4-byte cell. There is no string type; a string is only an array of cells, each cell holding a character.
Using g_ to prefix a variable is just to remind the scripter [or others looking at your code] that the variable is declared as global [is accessible throughout the script]. This will also prevent accidental use of the incorrect variable if you use the same name for a variable that is declared global and within a function. sz does not do any type of variable declaration either, it is just to signify what kind of data is stored in the variable. You may also see people tag other variables such as iValue [signifying integer] or fValue [signifying float] or bValue [signifying bool [true\false]]
|
3) how to make an entity move?
ANSWER
arkshine
Quote:
|
Playing with entity's velocity. There are a lot of examples on this forum.
|
Bugsy
Hunter-Digital
Quote:
3. you can set the velocity if you want it to move with a certain speed... or set the origin to just teleport it there... ex:
PHP Code:
new Float:fVelocity[3] fVelocity[2] = 100.0 // moves up entity_set_vector(entity, EV_VEC_velocity, fVelocity)
|
4)if can move how to make it move from A to B by flying?
ANSWER
Hunter-Digital
Quote:
all newly created entities fly by default, you must set movetype ( entity_set_int(ent, EV_INT_movetype, MOVETYPE_*) ) or add gravity, collisions, etc (see the values in hlsdk_const.inc), I wrote above how you can move an entity... but how to move it to a specified location... well, that'll require some calculations, I don't quite know how because I never done something like this but there are examples you can get from plugins that do such things... this for "From point A to point B" thing.... but if you want to spawn an ent at your location and
move it where you aim, see velocity_by_aim()
|
arkshine
Quote:
|
If you know both origin, you could calculated the direction ( origin2 - origin1 ), then you could use some velocity in this direction. ( direction * velocity wanted )
|
Bugsy
5) how to make a player got FLASH red instead of glowing like nemesis zombie that is glowing red and flashing red.
arkshine
EDITED VERSION:
ok now u know flash light? of course u would 
ok now i wan to put some kind of flash light around the player .
as u can c in the zombie plauge nemesis ( the nemesis is glowing red and got red flash light around him)
6) how to make an ambient sound at only some places?
like a radio at somewhere?
arkshine <<can give me an example?
Quote:
|
Using emit_sound(). Actually if you want to place in a know origin, use EngFunc_EmitAmbientSound from fakemeta and passing 0 as entity.
|
7) how to make an npc moves?
arkshine
8 ) can give the hlsdk section where got the weaponbox thinking?
arkshine
Quote:
|
A weaponbox entity doesn't think. ( only touch ). If you do think a weaponbox entity, it will disappear. ( If I'm remember well )
|
arkshine
Quote:
ouh, yes when an weapon box entity thinks it disapear but i just want to know where is the part of hlsdk explains that weapons.
Quote:
|
weapons.cpp, line 1246 ; I doubt you understand something.
|
|
9) where can i download all FULL NATIVES?
fysiks
Quote:
|
If you get AMX Mod X you have them all. Look in /addons/amxmodx/scripting/includes/
|
arkshine
Quote:
|
See all the includes ( *.inc files ) in scripting/includes/ folder.
|
10) what is usefull of stock and uses? (please explain fully and i can understand it)
Hunter-Digital
Quote:
stocks are short versions of multiple functions working together to do something... ex (from engine_stocks.inc):
PHP Code:
/* Set rendering of an entity */ stock set_rendering(index, fx=kRenderFxNone, r=255, g=255, b=255, render=kRenderNormal, amount=16) { entity_set_int(index,EV_INT_renderfx,fx); new Float:RenderColor[3]; RenderColor[0] = float(r); RenderColor[1] = float(g); RenderColor[2] = float(b); entity_set_vector(index,EV_VEC_rendercolor,RenderColor); entity_set_int(index,EV_INT_rendermode,render); entity_set_float(index,EV_FL_renderamt,float(amount)); return 1; }
|
arkshine
Quote:
|
A function with the label 'stock' means that this function will not be included in the compilation if not used. You can get a good description for the usage of public/stock.
|
EDIT:
11) if i wan to take a whole list of player in my server what should i do?
thank you xD
+k if u help
__________________
wooT now is asking season 
will ask you plenty of things for learning
Last edited by --kml--; 05-16-2009 at 01:35.
|
|
|
|