Help with COnverting from DINI to YINI
#1

Hey I need help, I just converted my shit to DINI, but I don't know how to convert my admin commands to YINI, please help


pawn Код:
/*==============================================================================
    =============================ADMIN COMMANDS!====================================
    ================================================================================*/

   
    COMMAND:setadminlevel(playerid,params[])
    {
            new adminlevel,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),adminlevel = 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),"RealityC/Users/%s.txt",n);//formatting the file
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_GREY,"You are not an RCON admin!");//if the player is not rcon admin
            if(!strlen(params)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /setlevel <ID> <Level>");// if the string is empty
            if(!IsPlayerConnected(id))return SendClientMessage(playerid,COLOR_GREY,"You have entered an incorrect ID"); //if the id is not connected
            PInfo[id][ADMINLEVEL] = adminlevel;//sets the level of the player
            INI_WriteInt(file,"Admin Level",adminlevel);//saves the new level to the file
            format(str,sizeof(str),"You have set %s's level to %d",n,adminlevel);//creates the string
            SendClientMessage(playerid,COLOR_LIGHTBLUE,str);
            return 1;
    }
    COMMAND:setfaction(playerid,params[])
    {
            new faction,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),faction = 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),"RealityC/Users/%s.txt",n);//formatting the file
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_GREY,"You are not an RCON admin!");//if the player is not rcon admin
            if(!strlen(params)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /setfaction <ID> <Level>");// if the string is empty
            if(!IsPlayerConnected(id))return SendClientMessage(playerid,COLOR_GREY,"You have entered an incorrect ID"); //if the id is not connected
            PInfo[id][FACTION] = faction;//sets the level of the player
            INI_WriteInt(file,"Faction",faction);//saves the new level to the file
            format(str,sizeof(str),"You have set %s's faction to %d",n,faction);//creates the string
            SendClientMessage(playerid,COLOR_LIGHTBLUE,str);
            return 1;
    }
    COMMAND:kick(playerid,params[])
    {
            new id,n[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
            new tmp[256], Index, str[49];
            tmp = strtok(params,Index), id = strval(tmp);
            GetPlayerName(id,on,sizeof(on));
            GetPlayerName(playerid,n,sizeof(n));
            if(PInfo[playerid][LEVEL] < 3) return SendClientMessage(playerid,COLOR_ORANGE,"You need to be level 3 to use this command!");
            if(!strlen(params)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /kick <ID> ");
            if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_GREY,"Invalid ID");
            format(str,sizeof(str),"%s has kicked %s",n,on);
            SendClientMessageToAll(COLOR_LIGHTBLUE,str);
            Kick(id);
            return 1;
    }
    COMMAND:ban(playerid,params[])
    {
            new id, n[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
            new tmp[256], Index, str[49];
            tmp = strtok(params,Index), id = strval(tmp);
            GetPlayerName(id,on,sizeof(on));
            GetPlayerName(playerid,n,sizeof(n));
            if(PInfo[playerid][LEVEL] < 3) return SendClientMessage(playerid,COLOR_ORANGE,"You need to be level 3 to use this command!");
            if(!strlen(params)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /ban <ID> ");
            if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_GREY,"Invalid ID");
            format(str,sizeof(str),"%s has banned %s",n,on);
            SendClientMessageToAll(COLOR_ORANGE,str);
            Ban(id);
            return 1;
    }
Compile Error:
pawn Код:
C:\Documents and Settings\RockingCamman\Desktop\RealityC Roleplay\gamemodes\RealityC.pwn(399) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\RockingCamman\Desktop\RealityC Roleplay\gamemodes\RealityC.pwn(415) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.

I switched my login thing from DINI to YINI, and I needa convert this command so it works on YINI
Reply
#2

Do you mind telling us line 399 and 415?
Reply
#3

Quote:
Originally Posted by expertprogrammer
Посмотреть сообщение
Do you mind telling us line 399 and 415?
above is lines 399 - 415
Reply
#4

You didn't even opened the file. First you have to open the file, after that you can write your integer and then close it. See: "How to use y_ini". Or you can save the player "admin level" in a variable and write in to his file only when he disconnects rather than opening the file each time you execute the command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)