Raised This Month: $ Target: $400
 0% 

error parse file .ini


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
spirit
Senior Member
Join Date: Jul 2009
Location: Quimper
Old 05-19-2012 , 04:57   error parse file .ini
Reply With Quote #1

Hi all i trying to made a .ini file but i encurent an error

error 035: argument type mismatch (argument 1)

In my CARSPEED[MAX_CARS][26]

Can you help me ?

my ini file

Code:
;"model", "name", "speed"
"car1" "peugeot" "300.0"
"car2" "renault" "290.0"
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>

#define MAX_CARS 64

new CARNAME[MAX_CARS][26]
new 
CARMODEL[MAX_CARS][26]
new 
CARSPEED[MAX_CARS][26]

new 
modelchoose[33]
new 
TotalCars

new const carlistfile[] = "carlist.ini"

public plugin_init()
{
    
register_clcmd("say /select""test")
    
register_clcmd("say rand""random_car")
}

public 
test(id)
{
    if(
is_user_alive(id))
    {
        
set_user_maxspeed(idfloat(CARSPEED[modelchoose[id]]))
    }
}

public 
random_car(id
{
    new 
randID random_num (1TotalCars 1)
    
modelchoose[id] = randID
    client_print
(idprint_chat"random %s"CARNAME[randID])
}

public 
plugin_precache()
{
    new 
cfgdir[64]
    
get_localinfo("amxx_configsdir"cfgdircharsmax(cfgdir))
    
format(cfgdircharsmax(cfgdir), "%s/%s"cfgdircarlistfile)
    
    if (
file_exists(cfgdir))
    {
        
TotalCars 0
        
new tmpfile[101], sfLineData[128]
        
        new 
file fopen(cfgdir,"rt")
        
        while(
file && !feof(file)) 
        {
            
fgets(filesfLineDatacharsmax(sfLineData))
            
            if (
sfLineData[0] == ';' || strlen(sfLineData) < || (sfLineData[0] == '/' && sfLineData[1] == '/')) 
            continue;
                
            
parse(sfLineDataCARMODEL[TotalCars], 25CARNAME[TotalCars], 25CARSPEED[TotalCars], 25)
            
            
TotalCars++
            
            if(
TotalCars >= MAX_CARS
                break;    
        }
        if(
file
            
fclose(file);
            
        for (new 
0TotalCars; ++i
        {
            
format(tmpfilecharsmax(tmpfile), "models/player/%s/%s.mdl"CARMODEL[i], CARMODEL[i])
        
            if (
file_exists (tmpfile)) 
            {
                
precache_model(CARMODEL[i])
                
server_print("Precached %s"CARMODEL[i])
            } 
            else 
                
server_print("Failed to precache %s"tmpfile);
        }
    }


Last edited by spirit; 05-19-2012 at 12:45.
spirit is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode