GetRandomMapID - 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: GetRandomMapID (
/showthread.php?tid=449099)
GetRandomMapID -
Blackazur - 07.07.2013
Hello, how can i make that even if i use /nextmap that it change to the next map id and not still to a random map id:
Код:
stock GetRandomMap()
{
new file[64];
new i = 0, count = 0, Maps[MAX_MAP_FILES], Mapid;
for( ; i != MAX_MAP_FILES; ++i)
{
if(LastMapStarted == i) continue;
format(file, sizeof(file), "/Maps/%d.ini", i);
if(fexist(file))
{
Maps[count] = i;
count++;
}
}
if(count == 0)
{
return NoMapCheck();
}
Mapid = Maps[random(count)];
format(file, sizeof(file), "/Maps/%d.ini", Mapid);
if(fexist(file))
{
LastMapStarted = Mapid;
return Mapid;
}
else return printf("[NOTICE] File Bugged.");
}
Код:
CMD:nextmap(playerid,params[])
{
if(pInfo[playerid][pLogged] == 1)
{
if(pInfo[playerid][pAdminLevel] >= 4)
{
new map,stringmap[256];
if(sscanf(params,"i", map)) return SendClientMessage(playerid,-1,""chat" /nextmap [mapid]");
format(stringmap,sizeof(stringmap),""chat""COL_LIGHTBLUE" %s %s has set next Map ID to %i.",GetAdminName(playerid),PlayerName(playerid),map);
SendClientMessageToAll(-1,stringmap);
mapid = map;
}
}
else {
SendClientMessage(playerid,-1,""chat" You are not logged in!");
Kick(playerid);
}
return 1;
}