HelpMe #9 [+REP]
#1

Hey guys, i know that i must be annoying while making these things everytime i need help, but i need some big help now..
When i want to store something, then how to do it?
Do i need some includes, or how?
Ill be very glad if you help me! (Give a example of the script)

Thanks in advance, cruteX.
Reply
#2

Store what Exactly ? Can you be More Specific Please ?
Reply
#3

by store you mean write in a file?

if yes you actually dont need a include but the original pawn file editor is very old and slow.

if you're starting now i would indicate you SII cuz is very easy to learn and is almost as fast as Y_ini.
Reply
#4

Store for example if people got thing or not, what i want to make is something like:

Computer: (If the player got a computer or not)
Phone: (If the player got a phone or not)

Things like that

EDIT: Yes i mean store things in file. But can you show it without SII? :P
Reply
#5

pawn Код:
native File:fopen(const name[], filemode: mode = io_readwrite);
native bool:fclose(File: handle);
native File:ftemp();
native bool:fremove(const name[]);

native fwrite(File: handle, const string[]);
native fread(File: handle, string[], size = sizeof string, bool: pack = false);
native bool:fputchar(File: handle, value, bool: utf8 = true);
native fgetchar(File: handle, value, bool: utf8 = true);
native fblockwrite(File: handle, const buffer[], size = sizeof buffer);
native fblockread(File: handle, buffer[], size = sizeof buffer);

native fseek(File: handle, position = 0, seek_whence: whence = seek_start);
native flength(File: handle);
native fexist(const pattern[]);
native bool:fmatch(name[], const pattern[], index = 0, size = sizeof name);
//you can find what each function does in Samp-Wiki.


//writting
new Name[28];
GetPlayerName(playerid, Name, 24);
format(Name, sizeof(Name), "%s.ini", Name);
new File:newfile = fopen(Name, io_write);
if(Computer[playerid] == true)
    fwrite(newfile, "Computer=Yes");
if(Phone[playerid] == true)
    fwrite(newfile, "Phone=Yes");
fclose(newfile);

//reading
new Name[28];
GetPlayerName(playerid, Name, 24);
format(Name, sizeof(Name), "%s.ini", Name);
if(!fexist(Name)) return 1;
new File:newfile = fopen(Name, io_read);
new string[128];
fread(newfile, string);
if(strfind(string, "Computer=Yes") != -1)
    Computer[playerid] = true;
if(strfind(string, "Phone=Yes") != -1)
    Phone[playerid] = true;
fclose(newfile);
Reply
#6

Pharrel, i thought about enums..
Reply
#7

Quote:
Originally Posted by cruteX_modshop
Посмотреть сообщение
Store for example if people got thing or not, what i want to make is something like:

Computer: (If the player got a computer or not)
Phone: (If the player got a phone or not)

Things like that
Use variables.

Quote:
Originally Posted by cruteX_modshop
EDIT: Yes i mean store things in file. But can you show it without SII? :P
Take a look at https://sampwiki.blast.hk/wiki/File_Functions.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)