PDA

View Full Version : /loadmap problem


DRIFT_HUNTER
22/06/2010, 03:10 AM
Hi today i try to mod Medit /loadmap [name] to /loadmap [name] [password] and i rely fail
(i fixed bug that if map do not exist then server crash)
Problem is that you can load map without password (my map name is TEST and i added Password 123456 in map file)

so i try /loadmap TEST - and map loads and if i try /loadmap TEST 123456 its says Map dont exist
(i have no idea how to make something with DCMD and 2 parameters)sorry but im sux scripter and my ENGLISH is sux to :D
and i know that you will ask yourself HOW THE FUCK THESE CODE IS WORKING?

Oh and if you know how to fix it and optimize (without ZCMD and other new systems)pls make explanation step by step
THX



dcmd_loadmap(playerid, cmdtext[] = "")
{
new map_name[32], map_pass[32];
new templine[128];
new tempobject[object_info];
if(strlen(cmdtext) == 0 || strlen(cmdtext) >= 20)
{
SendClientMessage(playerid, TEXTCOLOR, "pls use /loadmap [name] [password]");
return 1;
}
else
format(map_name, 32, "%s.medit",cmdtext);
if(!fexist(map_name)) return SendClientMessage(playerid, TEXTCOLOR, "Map dont exist");


new File:f,i,j;
f = fopen(map_name,io_read);

while(fread(f,templine,sizeof(templine),false))
{
if( strcmp( map_pass , "Password" , true ) == 0 )
{
new index;
tempobject[object_id] = INVALID_OBJECT_ID;
tempobject[modelid] = strval(strtok(templine,index));
tempobject[ox] = floatstr(strtok(templine,index));
tempobject[oy] = floatstr(strtok(templine,index));
tempobject[oz] = floatstr(strtok(templine,index));
tempobject[rx] = floatstr(strtok(templine,index));
tempobject[ry] = floatstr(strtok(templine,index));
tempobject[rz] = floatstr(strtok(templine,index));
for(i = j; i < MAX_OBJECTS; i++) {
j++;
if(objects[i][object_id] == INVALID_OBJECT_ID || !IsValidObject(objects[i][object_id]))
{
tempobject[object_id] = CreateObject(tempobject[modelid],tempobject[ox],tempobject[oy],tempobject[oz],tempobject[rx],tempobject[ry],tempobject[rz]);
objects[i] = tempobject;
break;
}
}
}
}
fclose(f);
SendClientMessage(playerid, TEXTCOLOR, "The map has been loaded...");
return 1;
}

DRIFT_HUNTER
22/06/2010, 09:53 PM
Bump

PLS can anyone help?

Godfather[TR]
24/12/2011, 05:29 PM
The loadmap often happens when you got alot ofm edit or if you did alot /savemap and /loadmap, this will cause to re overwrite it, and by doing this will cause to get damaged on your objects, if you remove your objects from in game mode or in medit which you saved, try remove it. it'll work! ;)