Jump to content

Question

Posted

Cine imi face si mie o comanda prin care un player poate sa scrie ceva iar mie in scriptfiles/comm  sa imi apara un fisier get comm.txt cu ce a spus el acolo

Exemplu "un jucator scrie /savecomm Salutare [Romania], iar mie acest comm adica Salutare Romania sa imi apara in  scriptfiles/comm cu numele lui si comm ce a spus

...

Cine imi face un model...  Ii urez lui si familiei sale Respect +1

3 answers to this question

Recommended Posts

Posted

[pawn]

#include < zcmd >

#include < sscanf >

// #define USE_DIR // Daca vrei sa se salveze fisierele intr-un anumit folder sterge "//"

#if defined USE_DIR

#define _Dir(%0)    "/Folder/%0" // "Folder" = numele folderului in care vrei sa se salveze

#endif

CMD:savecomm( playerid, params[ ] )

{

new

    szCom[ 100 ],

    szF[ MAX_PLAYER_NAME +5 ],

    szName[ MAX_PLAYER_NAME +1 ]

;

GetPlayerName( playerid, szName, sizeof( szName ) );

if( sscanf( params, "s[100]", szCom ) ) return SendClientMessage( playerid, -1, "Syntax: /test <text>");

{

format( szF, MAX_PLAYER_NAME +5, "%s.txt", szName );

#if defined USE_DIR

format( szF, MAX_PLAYER_NAME +10, "_Dir(%s.txt)", szName );

#endif

    if( !fexist( szF ) )

    {

        new

File:iFile = fopen( szF, io_write );

            fwrite( iFile, szCom );

    fclose( iFile );

}

else return SendClientMessage( playerid, -1, "Exista deja.");

}

return 1;

}

[/pawn]

Vroiai mai mult de atat?

EDIT:

Ti-am pus si la alegere daca vrei sa se salveze de exemplu fisierul lui Rock(Rock.txt) intr-un folder anume, vezi tu acolo.

Just Rock

Posted

[pawn]

#include < zcmd >

#include < sscanf >

// #define USE_DIR // Daca vrei sa se salveze fisierele intr-un anumit folder sterge "//"

#if defined USE_DIR

#define _Dir(%0)    "/Folder/%0" // "Folder" = numele folderului in care vrei sa se salveze

#endif

CMD:savecomm( playerid, params[ ] )

{

new

    szCom[ 100 ],

    szF[ MAX_PLAYER_NAME +5 ],

    szName[ MAX_PLAYER_NAME +1 ]

;

GetPlayerName( playerid, szName, sizeof( szName ) );

if( sscanf( params, "s[100]", szCom ) ) return SendClientMessage( playerid, -1, "Syntax: /test <text>");

{

format( szF, MAX_PLAYER_NAME +5, "%s.txt", szName );

#if defined USE_DIR

format( szF, MAX_PLAYER_NAME +10, "_Dir(%s.txt)", szName );

#endif

    if( !fexist( szF ) )

    {

        new

File:iFile = fopen( szF, io_write );

            fwrite( iFile, szCom );

    fclose( iFile );

}

else return SendClientMessage( playerid, -1, "Exista deja.");

}

return 1;

}

[/pawn]

Vroiai mai mult de atat?

EDIT:

Ti-am pus si la alegere daca vrei sa se salveze de exemplu fisierul lui Rock(Rock.txt) intr-un folder anume, vezi tu acolo.

Da ,dar nu imi salveaza si ce scriu in joc adica daca scriu /savecomm [Hai la somn!] imi salveaza numele(%s.txt) dar nu imi apare si ce scriu in joc...

Si daca scriu asa if( sscanf( params, "s[100]" cu s[100] imi apare mereu in joc  Syntax: /test <text>

Posted

Buna ziua !

Incearca acum :

[pawn]#include < zcmd >

#include < sscanf >

#define USE_DIR

#if defined USE_DIR

#define _Dir(%0)    "/comm/%0"

#endif

CMD:savecomm( playerid, params[ ] )

{

new

    szCom[ 100 ],

    szF[ MAX_PLAYER_NAME +5 ],

    szName[ MAX_PLAYER_NAME +1 ]

;

GetPlayerName( playerid, szName, sizeof( szName ) );

if( sscanf( params, "s[100]", szCom ) ) return SendClientMessage( playerid, -1, "Syntax: /test <text>");

{

format( szF, MAX_PLAYER_NAME +5, "%s.txt", szName, szCom );

#if defined USE_DIR

format( szF, MAX_PLAYER_NAME +10, "_Dir(%s.txt)", szName,szCOM );

#endif

    if( !fexist( szF ) )

    {

        new

File:iFile = fopen( szF, io_write );

            fwrite( iFile, szCom );

    fclose( iFile );

}

else return SendClientMessage( playerid, -1, "Exista deja.");

}

return 1;

}[/pawn]

Sper ca ti-am fost de folos,

[Pawn]

Pentru suport nu ezitati sa ma contactati printr-un mesaj privat sau un mesaj pe Y/M.(Scripting sa:mp/cs,ScripturiWEB,phpbb,mysql,ipb,photoshop,html)

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.