22.06.2010, 03:10
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
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
(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
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; }