PDA

View Full Version : Change map


Watt
04-11-2008, 09:50
#include <amxmodx>
#include <cstrike>

public plugin_init() {
register_plugin( "No surf ski", "0.1", "sb" );
}
public client_putinserver(id)
{
set_task(60.0, "map",id)
}
public map(id)
{
new map[32];
get_mapname(map, charsmax(map));
if(map, "surf_ski")
{
switch(random_num( 0, 4 ))
{
case 0:
{
server_cmd("changelevel surf_ski_2")
}
case 1:
{
server_cmd("changelevel surf_green3")
}
case 2:
{
server_cmd("changelevel surf_town")
}
case 3:
{
server_cmd("changelevel surf_megawave")
}
case 4:
{
server_cmd("changelevel surf_ski3_summer")
}


}
}


}
It should change map if the serwer have surf_ski map and it doesn't work why? :(

Arkshine
04-11-2008, 09:51
if(map, "surf_ski")

=>

if( equal( map, "surf_ski") )

rudle
04-11-2008, 10:24
switch(random_num( 0, 4 ))should be
switch(random_num( 0, 5 ))

Watt
04-11-2008, 10:30
Why there are 0-4 cases

rudle
04-11-2008, 10:32
Because 0,5 all ways counts as 4 like new name[32] get_user_name(id, name, 31)
it would be a number high 5 means 4 / 4 means 3

i did it on my script.

Exolent[jNr]
04-11-2008, 10:39
No, random_num(0, 4) is correct.

Arkshine
04-11-2008, 10:39
What are you talking about, rudle ?

random_num( 0, 4 ) is fine in its example.

alien
04-11-2008, 10:56
Because 0,5 all ways counts as 4 like new name[32] get_user_name(id, name, 31)
it would be a number high 5 means 4 / 4 means 3

i did it on my script.

random_num(0, 4) returns values from 0 and 4 inclusively.
0, 1, 2, 3, 4 stands for 5 values.