Only between 0-36? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Only between 0-36? (
/showthread.php?tid=438899)
Only between 0-36? -
Blackazur - 22.05.2013
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;
}
Re: Only between 0-36? -
CreativityLacker - 22.05.2013
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;
}
Re: Only between 0-36? -
CreativityLacker - 22.05.2013
Quote:
Originally Posted by ******
|
Interesting function, thanks for sharing :O
But, it wouldn't be very useful in this case
Eg. someone uses
While really he wanted to use
It'll return
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)