reading from file
#1

hey guys I tried to make something like this:
PHP код:
stock checkprice(vehicleid)
{
    new 
string[256];
    
format(stringsizeof(string),"%d"dini_Get("vprices.cfg",vehicleid));
    return 
string;

PHP код:
            else if(!strcmp(x_v"setprice",true))
            {
                if(
IsPlayerConnected(playerid))
                {
                    if(
PlayerInfo[playerid][pAdmi] >= 5000)
                    {
                        if (
PlayerToPoint(50playerid,SBizzInfo[12][sbEntranceX],SBizzInfo[12][sbEntranceY],SBizzInfo[12][sbEntranceZ]))
                        {
                            
tmp strtok(cmdtextidx);
                              if(!
strlen(tmp))
                              {
                                
SendClientMessage(playerid,COLOR_WHITE,"[USAGE]: /setprice [vehiclemodel] [price]");
                                return 
1;
                            }
                            new 
car;
                            new 
price;
                            
car strval(tmp);
                            
price strval(tmp);
                            
dini_IntSet("vprices.cfg",car,price);
                            
format(stringsizeof(string), "You have set %s's price to $%d "VehicleNames[car-400],price);
                            
SendClientMessage(giveplayeridCOLOR_WHITEstring);
                        }
                        else
                        {
                            
SendClientMessage(playeridCOLOR_LIGHTRED"You are not at a dealership !");
                            return 
1;
                        }
                    }
                }
                return 
1;
            }
            else if(!
strcmp(x_v"sellcar",true))
            {
                if(
IsPlayerConnected(playerid))
                {
                    if(
PlayerInfo[playerid][pAdmi] >= 5000)
                    {
                        if (
PlayerToPoint(50playerid,SBizzInfo[12][sbEntranceX],SBizzInfo[12][sbEntranceY],SBizzInfo[12][sbEntranceZ]))
                        {
                            
tmp strtok(cmdtextidx);
                              if(!
strlen(tmp))
                              {
                                
SendClientMessage(playerid,COLOR_WHITE,"[USAGE]: /sellcar [vehiclemodel] [Player's id]");
                                return 
1;
                            }
                            new 
car strval(tmp);
                            new 
price[MAX_STRING];
                            if(
car 400 || car 611) { SendClientMessage(playeridCOLOR_GREY"    Vehicle Number can't be below 400 or above 611!"); return 1; }
                            
tmp strtok(cmdtextidx);
                            
giveplayerid ReturnUser(tmp);
                            if(
IsPlayerConnected(giveplayerid))
                            {
                                if(
giveplayerid != INVALID_PLAYER_ID)
                                {
                                    if(
CarsPrices[car-400] == 0)
                                    {
                                        
SendClientMessage(playeridCOLOR_GREY"    You are not able to sell this vehicle!");
                                        return 
1;
                                    }
                                    
/*if(HMoney[playerid] < CarsPrices[car-400])
                                    {
                                        SendClientMessage(playerid, COLOR_YELLOW2, "    You haven't enough money !");
                                        return 1;
                                    }*/
                                    //new file[256];
                                    //format(file, sizeof(file), "Vehicles/vprice.cfg");
                                    
price checkprice(car);
                                    
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                                     
GetPlayerName(playeridsendernamesizeof(sendername));
                                    if(!
CheckCarF(playerid,car))
                                    {
                                        if(
price != 0)
                                        {
                                            
pCar[giveplayerid] = car;
                                            
pCarPrice[giveplayerid] = price;
                                            
pColorS[giveplayerid] = 1;
                                            
pColor2S[giveplayerid] = 1;
                                            
format(stringsizeof(string), "%s offers to %s %s for $%d"sendername,giveplayer,VehicleNames[car-400],checkprice(car));
                                            
ProxDetector(20.0playeridstringCOLOR_NICEBLUE,COLOR_NICEBLUE,COLOR_NICEBLUE,COLOR_NICEBLUE,COLOR_NICEBLUE);
                                            
format(stringsizeof(string), "%s offered you %s for $%d"sendername,VehicleNames[car-400],checkprice(car));
                                            
SendClientMessage(giveplayeridCOLOR_WHITEstring);
                                            
SendClientMessage(giveplayeridCOLOR_WHITE"type /acceptcar if you want to buy or /cancelcar if you dont want to but it");
                                             
//BuyingVeh(playerid);
                                        
}
                                        else
                                        {
                                            
SendClientMessage(playerid,COLOR_WHITE,"The leader didn't ordered this vehicle!");
                                        }
                                    }
                                    else
                                    {
                                        
SendClientMessage(playerid,COLOR_WHITE,"That player already has this vehicle!");
                                    }
                                }
                            }
                            else
                            {
                                
format(stringsizeof(string), "   %d is not an active player."giveplayerid);
                                
SendClientMessage(playeridCOLOR_GRAD1string);
                            }
                        }
                        else
                        {
                            
SendClientMessage(playeridCOLOR_LIGHTRED"You are not at a dealership !");
                            return 
1;
                        }
                    }
                }
                return 
1;
            } 
the errors is this:
PHP код:
cuments and Settings\Vlad\щемзп дтбегд\LS-Mode2.pwn(45527) : error 035argument type mismatch (argument 2)
C:\Documents and Settings\Vlad\щемзп дтбегд\LS-Mode2.pwn(45575) : error 047: array sizes do not match, or destination array is too small
C
:\Documents and Settings\Vlad\щемзп дтбегд\LS-Mode2.pwn(45580) : error 033: array must be indexed (variable "price")
C:\Documents and Settings\Vlad\щемзп дтбегд\LS-Mode2.pwn(45583) : error 006must be assigned to an array
C:\Documents and Settings\Vlad\щемзп дтбегд\LS-Mode2.pwn(45753) : error 006must be assigned to an array
C:\Documents and Settings\Vlad\щемзп дтбегд\LS-Mode2.pwn(55968) : error 035argument type mismatch (argument 2)
C:\Documents and Settings\Vlad\щемзп дтбегд\LS-Mode2.pwn(55950) : warning 203symbol is never used"vehicleid"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
6 Errors

error 1:
PHP код:
dini_IntSet("vprices.cfg",car,price); 
error 2:
PHP код:
price checkprice(car); 
error 3:
PHP код:
if(price != 0
error 4:
PHP код:
pCarPrice[giveplayerid] = price
error 5:
PHP код:
plaprice file
error 6:
format(string, sizeof(string),"%d", dini_Get("vprices.cfg",vehicleid));
error:7
canno't read the vehicle id

the file is like this:
http://pastebin.com/U8KZm4Av
help me please
Reply


Messages In This Thread
reading from file - by vladi866 - 30.05.2011, 09:06
Re: reading from file - by Lorenc_ - 30.05.2011, 09:10
Re: reading from file - by yanir3 - 30.05.2011, 09:17
Re: reading from file - by vladi866 - 30.05.2011, 09:28
Re: reading from file - by yanir3 - 30.05.2011, 09:48
Re: reading from file - by vladi866 - 30.05.2011, 09:55
Re: reading from file - by yanir3 - 30.05.2011, 09:55
Re: reading from file - by vladi866 - 30.05.2011, 10:09
Re: reading from file - by yanir3 - 30.05.2011, 10:17
Re: reading from file - by vladi866 - 30.05.2011, 10:37

Forum Jump:


Users browsing this thread: 1 Guest(s)