SA-MP Forums Archive
get file in "new" - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: get file in "new" (/showthread.php?tid=258744)



get file in "new" - vladi866 - 01.06.2011

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?


Re: get file in "new" - vladi866 - 01.06.2011

help me?


Re: get file in "new" - Lorenc_ - 01.06.2011

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


Re: get file in "new" - vladi866 - 01.06.2011

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


Re: get file in "new" - Ash. - 01.06.2011

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?


Re: get file in "new" - vladi866 - 01.06.2011

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?


Re: get file in "new" - Ash. - 01.06.2011

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.


Re: get file in "new" - vladi866 - 01.06.2011

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


Re: get file in "new" - Ash. - 01.06.2011

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'
.


Re: get file in "new" - vladi866 - 01.06.2011

ok and thanks for helping