SA-MP Forums Archive
rep + please help - 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)
+--- Thread: rep + please help (/showthread.php?tid=339512)



rep + please help - oscar7610 - 03.05.2012

I made a simple rate system so simple but I want to create a txt so when people /rate it will put the name of the one who rated the server like.

Mark_Smith /rate *****

dini?


Re: rep + please help - FalconX - 03.05.2012

Quote:
Originally Posted by oscar7610
Посмотреть сообщение
I made a simple rate system so simple but I want to create a txt so when people /rate it will put the name of the one who rated the server like.

Mark_Smith /rate *****

dini?
I would use MySQL as my whole server is MySQL, anyway if you've already made the command and are thinking to save the player names with their rate number is to use the file base saving system like Dini, Yini, etc and if database system it could be MySQL, SQLite etc

-FalconX


Re: rep + please help - oscar7610 - 03.05.2012

Quote:
Originally Posted by FalconX
Посмотреть сообщение
I would use MySQL as my whole server is MySQL, anyway if you've already made the command and are thinking to save the player names with their rate number is to use the file base saving system like Dini, Yini, etc and if database system it could be MySQL, SQLite etc

-FalconX
I dont know how to use Mysql Im new into scripting dude.


Re: rep + please help - FalconX - 03.05.2012

Quote:
Originally Posted by oscar7610
Посмотреть сообщение
I dont know how to use Mysql Im new into scripting dude.
Then you could use other saving systems like dini, yini etc

Here is a tutorial for saving system using DINI:-
https://sampforum.blast.hk/showthread.php?tid=270787

-FalconX


Re: rep + please help - ReneG - 03.05.2012

Assuming you just want to write to a file, you don't need MySQL for something so simple.
pawn Код:
CMD:rate(playerid, params[])
{
    new
        rate, // The amount they will rate
        name[24], // The player's name
        string[128] // The string we will format
    ;
    if(sscanf(params, "d", rate)) // if they didn't type a number
    {
        // Then tell the player how to use the command
        return SendClientMessage(playerid, -1, "USAGE: /rate [amount]");
    }
    if(rate > 5 || rate < 0)
    {
        // If the number they typed was less than 0 or more than 5
        // then it sends a message saying so.
        return SendClientMessage(playerid, -1, "Don't go below 0 or 5");
    }
    else // If they typed a number in between zero and five.
    {
        new File:rating = fopen("ratings.txt", io_append); // Open the file for writing.
        GetPlayerName(playerid, name, 24); // Get the name and store it into 'name'
        format(string, 127, "User %s rated the server %d stars.", name, rate); // format the string
        fwrite(rating, string); // Write the string above.
        fclose(rating); // close the file
    }
    return 1;
}



Re: rep + please help - oscar7610 - 03.05.2012

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
Assuming you just want to write to a file, you don't need MySQL for something so simple.
pawn Код:
CMD:rate(playerid, params[])
{
    new
        rate, // The amount they will rate
        name[24], // The player's name
        string[128] // The string we will format
    ;
    if(sscanf(params, "d", rate)) // if they didn't type a number
    {
        // Then tell the player how to use the command
        return SendClientMessage(playerid, -1, "USAGE: /rate [amount]");
    }
    if(rate > 5 || rate < 0)
    {
        // If the number they typed was less than 0 or more than 5
        // then it sends a message saying so.
        return SendClientMessage(playerid, -1, "Don't go below 0 or 5");
    }
    else // If they typed a number in between zero and five.
    {
        new File:rating = fopen("ratings.txt", io_append); // Open the file for writing.
        GetPlayerName(playerid, name, 24); // Get the name and store it into 'name'
        format(string, 127, "User %s rated the server %d stars.", name, rate); // format the string
        fwrite(rating, string); // Write the string above.
        fclose(rating); // close the file
    }
    return 1;
}
I rep you still I dont use dcmd or zcmd


Re: rep + please help - oscar7610 - 03.05.2012

I cant make this txt well can you help me at this then?

I made a script that if the player isnt spawned he cant type commands BUT! he still can talk by pressing the "T"

How can I disable that?