Quote:
Originally Posted by 0x00
first of, whats wrong with the following check:
PHP Code:
public function(id)
if(cs_get_user_team(id) < 2)
// something
That's a tag mismatch error.
the syntax of such native is pretty simple, i really can't see any mistake.
|
Either change 2 to CS_TEAM_CT, or untag the function.
Quote:
Originally Posted by 0x00
anyway, in sourcepawn you could do the following:
PHP Code:
new temp[1024]
public function()
switch(something)
{
case 1: temp = "my text"
case 2: temp = "my text 2"
// and so on
}
but you can't do the following on amxx, so please, tell me whats wrong.
|
You should use the
copy() function.
PHP Code:
copy(temp, 1023, "my text")
Quote:
Originally Posted by 0x00
and the last question, whats wrong with:
PHP Code:
get_randplayer()
{
/*
using get_players() because i really don't
need to do any check, like teams, etc. so get_maxplayers()
isnt really needed.
*/
new players[get_players() + 1], num
for(new x = 1; x <= get_maxplayers(); x++)
if(cs_get_user_team(x) > 1)
players[num++] = x
return (num == 0) ? - 1 : players[random_num(0, num - 1)]
}
it kept saying that it must be a constant, which does not happen on sourcepawn. ty.
|
You can't create an array of a dynamic size like that.
The size has to be a constant number at compile time.
Therefore, use 32 because it will always be big enough for all players.
__________________