[Help]Reading from a remote file ?
#1

Hello there,

In order to create an update system for a shared GM i have to read fro:m a remote file.

I mean, my file is hosted on simple web host (my perssonal website) and i want to acces to this file in my Pawn Script but without having to use the script on the same server.

I've tried this:

pawn Код:
#define BASE_GM_VER "0.1.1"
#define UPDATE_SERVER "http://jujuv.rd-h.fr/upload/base_gm/Check.version"


    if(!AreStringsEquals(BASE_GM_VER, dini_Get(UPDATE_SERVER, "Latest_Version")))
    {
        printf("Vous utilisez la version %s du GM de base.Une version plus rйcente est disponible en tйlйchargement (%s)! Rendez-vous а l'adresse suivante pour tйlйcharger la dйrniйre version:\n %s", BASE_GM_VER, dini_Get(UPDATE_SERVER, "Latest_Version"), dini_Get(UPDATE_SERVER, "DL.Link"));
    }

My func AreStringsEquals(string1, string2):
pawn Код:
public AreStringsEquals(string1[], string2[])
{

    /*
    NB: strcmp also return 0.
    */

    if(!strcmp(string1, string2) && strlen(string1) != 0 && strlen(string2) != 0)
    {
        return true;
    }
    else { return false;}
}
With this solution, i just get an empty string.

I wouldn't like to use an heavily solution such as MySQL DB!

I hope you can help me

Sorry for my bad english.


BTW, i'll give rep+ only if you realy helped me and are nice.


EDIT:I think it can help:

Quote:
Originally Posted by SA:MP Server Logs
SA-MP Dedicated Server
----------------------
v0.3e-RC7, ©2005-2012 SA-MP Team

[22:21:03] filterscripts = "" (string)
[22:21:03]
[22:21:03] Server Plugins
[22:21:03] --------------
[22:21:03] Loaded 0 plugins.

[22:21:03]
[22:21:03] Filterscripts
[22:21:03] ---------------
[22:21:03] Loaded 0 filterscripts.

[22:21:03] Vous utilisez la version 0.1.1 du GM de base.Une version plus rйcente est disponible en tйlйchargement ()! Rendez-vous а l'adresse suivante pour tйlйcharger la dйrniйre version:

[22:21:03]
--------------------------------------
[22:21:03] (^o^) Simple base-mode by Jujuv (^o^)
[22:21:03] --------------------------------------

[22:21:03] Number of vehicle models: 0

----------
Loaded log file: "server_log.txt".
----------
Reply
#2

SA-MP's file functions can only read and write files inside the scriptfiles directory. They cannot access files anywhere else.
https://sampwiki.blast.hk/wiki/HTTP
Reply
#3

Thank you very much.
I didn't know this func.
And i will try to work with that

You realy earned your rep+.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)