Random map
#5

For ex:

map1.inc
map2.inc
map3.inc

Array:

pawn Код:
static maps[][] = {"map1.inc", "map2.inc", "map3.inc"};
CMD:

pawn Код:
cmd:map(playerid, params[])
{
    if(sscanf(params, "d", params[0])) return SendClientMessage(playerid, -1, "/map [mapid]");
    for(new i; i < MAX_OBJECTS; i++) DestroyObject(i);
    new string[14];
    format(string, sizeof(string), "../%s", maps[params[0]]);
    #include string
    return 1;
}
Or without array:

pawn Код:
cmd:map(playerid, params[])
{
    if(sscanf(params, "d", params[0])) return SendClientMessage(playerid, -1, "/map [mapid]");
    for(new i; i < MAX_OBJECTS; i++) DestroyObject(i);
    new string[14];
    format(string, sizeof(string), "../map%d.inc", params[0]);
    #include string
    return 1;
}
Reply


Messages In This Thread
Random map - by NoteND - 26.12.2018, 14:47
Re: Random map - by OKStyle - 26.12.2018, 15:01
Re: Random map - by Logic_ - 26.12.2018, 15:03
Re: Random map - by NoteND - 26.12.2018, 15:03
Re: Random map - by OKStyle - 27.12.2018, 06:50
Re: Random map - by NaS - 27.12.2018, 07:53
Re: Random map - by OKStyle - 27.12.2018, 10:39
Re: Random map - by Calisthenics - 27.12.2018, 13:20

Forum Jump:


Users browsing this thread: 1 Guest(s)