get file in "new"
#1

hey I need help with this thing:
PHP код:
stock checkprice(playerid,vehicleid)
{
    new 
string[256];
    new 
FileUserFile fopen("vprices.ini"io_read);
    if (
UserFile)
    {
        new 
key[256] , val256 ];
        new 
Data[256];
        while (
fread(UserFile,Datasizeof(Data)))
        {
            
key ini_GetKeyData );
            
format(string,sizeof(string),"%s",vehicleid);
            if(
strcmp(key,string,true)==0) { val ini_GetValue(Data); pCarPrice[playerid] = strval(val); }
        }
        
fclose(UserFile);
    }
    
//pCarPrice[plaid] = dini_Int("vprices.cfg", id);
    
return 1;

I need to get the var of vehicle number that I will use by new vehicleid = strval(tmp);
in command and by the playerid that I will use like the new vehicleid
and the problem is that it gives me price 0 when in the file it's 500
can someone help me fix this stock?
Reply
#2

help me?
Reply
#3

You must wait 48 hours before making a bump. (Approx 1 day)
Reply
#4

you don't know anything to help me beside saying stupid things?
Reply
#5

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
You must wait 48 hours before making a bump. (Approx 1 day)
I hope you meant 2 days

Quote:
Originally Posted by vladi866
Посмотреть сообщение
you don't know anything to help me beside saying stupid things?
With attitude like that; noone will help you. Explain your problem a little better; I understand what you're trying to, and the problem you face but what is the overall issue? Have you checked the data in the file?
Reply
#6

I want to do like this
PHP код:
            else if(!strcmp(x_v"getprice",true))
            {
                if(
IsPlayerConnected(playerid))
                {
                    if(
PlayerInfo[playerid][pAdmi] >= 5000)
                    {
                        
tmp strtok(cmdtextidx);
                          if(!
strlen(tmp))
                          {
                            
SendClientMessage(playerid,COLOR_WHITE,"[USAGE]: /getprice [vehiclemodel]");
                            return 
1;
                        }
                        new 
vehicleid strval(tmp);
                        
checkprice(playerid,vehicleid);
                        
format(stringsizeof(string), "%s's price is $%d "VehicleNames[vehicleid-400],pCarPrice[playerid]);
                        
SendClientMessage(playeridCOLOR_WHITEstring);
                        
pCarPrice[playerid] = 0;
                        return 
1;
                    }
                }
                return 
1;
            } 
and when I will do for example /v getprice 560
it will give me the price by the pCarPrice[playerid] understand?
Reply
#7

Well for a start, in your first post you attempt to format a string with an integer, however you use a string tag (%s) - vehicleid's are integers so you should of used (%i). Seems off the point, but small things like that can affect it all.
Reply
#8

I have tried with %i and it still doesn't work!
Reply
#9

Okay when I get back on my laptop i'll take a proper look at whats going on, i'm currently using my phone at the moment'
.
Reply
#10

ok and thanks for helping
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)