Only between 0-36?
#1

Hellow, how to make that you can only change the map between 0-36?

Код:
CMD:nextmap(playerid,params[])
{
	if(pInfo[playerid][pLogged] == 1)
	{
		if(pInfo[playerid][pAdminLevel] >= 3)
		{
			new map,stringmap[256];
			if(sscanf(params,"i", map)) return SendClientMessage(playerid,-1,""chat" /nextmap [mapid]");

			format(stringmap,sizeof(stringmap),""chat""COL_LIGHTBLUE" Next Map ID has been setted to %i!",map);
			SendClientMessageToAll(-1,stringmap);
			mapid = map;
		}
	}
	return 1;
}
Reply
#2

pawn Код:
CMD:nextmap(playerid,params[])
{
    if(pInfo[playerid][pLogged] == 1)
    {
        if(pInfo[playerid][pAdminLevel] >= 3)
        {
            new map,stringmap[256];
            if(sscanf(params,"d", map)) return SendClientMessage(playerid,-1,""chat" /nextmap [mapid]");
            if(map < 0 || map > 36) return SendClientMessage(playerid, -1, "Map ID must be between 0 and 36");
            format(stringmap,sizeof(stringmap),""chat""COL_LIGHTBLUE" Next Map ID has been setted to %i!",map);
            SendClientMessageToAll(-1,stringmap);
            mapid = map;
        }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by ******
Посмотреть сообщение
Interesting function, thanks for sharing :O

But, it wouldn't be very useful in this case

Eg. someone uses

pawn Код:
/nextmap 37
While really he wanted to use
pawn Код:
/nextmap 3
It'll return
pawn Код:
/nextmap 36
It'd be better to actually tell the user to insert a proper value rather than round it off to the maximum value, it might cause problems, but that's a pretty amazing function (clamp)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)