22.05.2012, 21:22
Hi,
When I Convert My Admin FS Command From DCMD To ZCMD (Register,Login And SetAdmin) Not Work It Just Say "Unknown Command"
But The Other Commands Is Working
+Rep For Any One Help Me
Thanks
When I Convert My Admin FS Command From DCMD To ZCMD (Register,Login And SetAdmin) Not Work It Just Say "Unknown Command"
But The Other Commands Is Working
pawn Код:
COMMAND:Register(playerid, params[])
{
new file[256],n[MAX_PLAYER_NAME];
GetPlayerName(playerid,n,MAX_PLAYER_NAME);
format(file,sizeof(file),"MAdmin/Players/%s.txt",n);
if(dini_Exists(file)) return SendClientMessage(playerid,YELLOW,"You are already registered!");
if(PInfo[playerid][Regged] == 1) return SendClientMessage(playerid,LIGHTBLUE,"You are already registered!");
if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,ORANGE,"You are already registered, and logged in!");
if(strlen(params))
{
if(!dini_Exists(file))
{
dini_Create(file);
dini_Set(file,"Password",params);
dini_IntSet(file,"Regged",1);
dini_IntSet(file,"Logged",0);
dini_IntSet(file,"Level",0);
SendClientMessage(playerid,LIGHTBLUE,"Congratulations, you have just registered, please /login");
PInfo[playerid][Regged] = 1;
return 1;
}
}
else
{
SendClientMessage(playerid,GREY,"USAGE: /register <Password>");
return 1;
}
return 1;
}
//===========================>>> LOGIN <<<======================================
COMMAND:Login(playerid, params[])
{
new file[256],n[MAX_PLAYER_NAME];
GetPlayerName(playerid,n,MAX_PLAYER_NAME);
format(file,sizeof(file),"MAdmin/Players/%s.txt",n);
if(!dini_Exists(file)) return SendClientMessage(playerid,YELLOW,"You are not registered! Please /register");
if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,LIGHTBLUE,"You are already logged in!");
if(PInfo[playerid][Regged] == 0) return SendClientMessage(playerid,ORANGE,"You are not registered! Please /register");
if(strlen(params))
{
new pass[256];
pass = dini_Get(file,"Password");
if(dini_Exists(file))
{
if(strcmp(params,pass,false) != 0)
{
SendClientMessage(playerid,YELLOW,"Wrong Password!");
}
else
{
dini_IntSet(file,"Logged",1);
PInfo[playerid][Logged] = 1;
PInfo[playerid][Level] = dini_Int(file,"Level");
SendClientMessage(playerid,YELLOW,"You have now logged in!");
return 1;
}
}
}
else
{
SendClientMessage(playerid,GREY,"USAGE: /login <Password>");
return 1;
}
return 1;
}
/*==============================================================================
=============================ADMIN COMMANDS!====================================
================================================================================*/
COMMAND:SetAdmin(playerid, params[])
{
new level,id,file[256],n[MAX_PLAYER_NAME];//creating the new variabls
new tmp[256], tmp2[256], Index,str[50];// creating the new variables
tmp = strtok(params,Index), tmp2 = strtok(params,Index),id = strval(tmp),level = strval(tmp2);// setting them to strtok so we can use them as parameters of our command
GetPlayerName(id,n,MAX_PLAYER_NAME);//getting the players name
format(file,sizeof(file),"MAdmin/Players/%s.txt",n);//formatting the file
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,GREY,"You are not an RCON admin!");//if the player is not rcon admin
if(!strlen(params)) return SendClientMessage(playerid,GREY,"USAGE: /setlevel <ID> <Level>");// if the string is empty
if(!IsPlayerConnected(id))return SendClientMessage(playerid,GREY,"You have entered an incorrect ID"); //if the id is not connected
PInfo[id][Level] = level;//sets the level of the player
dini_IntSet(file,"Level",level);//saves the new level to the file
format(str,sizeof(str),"You have set %s's level to %d",n,level);//creates the string
SendClientMessage(playerid,LIGHTBLUE,str);
return 1;
}
+Rep For Any One Help Me
Thanks