SA-MP Forums Archive
How to do.... - 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: How to do.... (/showthread.php?tid=91873)



How to do.... - nuriel8833 - 17.08.2009

Can someone help me to make a code that if:

player X kills player Y with a Z

X = killer
Y = deather(?) --> I know im an idiot
Z = weapon name

I need it will save in a file "kills.txt"
how to do that
give me an example
tanks


Re: How to do.... - XtremeChio - 17.08.2009

Well it automaticly saves into your server_log, I don't know any other ways.
In server_log you'd get something like this

[16:59:42] [kill] [JB]sicko killed Chio M4


Re: How to do.... - MenaceX^ - 17.08.2009

pawn Код:
//OnPlayerDeath.
new
  iArray[32];
GetWeaponName(reason,iArray,sizeof(iArray));
format(string,sizeof(string),"%s killed %s using %s.",killeridname,playeridname,iArray);
SendClientMessageToAll(color,string);



Re: How to do.... - saiberfun - 17.08.2009

Quote:
Originally Posted by MenaceX^
pawn Код:
//OnPlayerDeath.
new
  iArray[32];
GetWeaponName(reason,iArray,sizeof(iArray));
format(string,sizeof(string),"%s killed %s using %s.",killeridname,playeridname,iArray);
SendClientMessageToAll(color,string);
he wants it to be saved in a file tho..


Re: How to do.... - nuriel8833 - 18.08.2009

Quote:
Originally Posted by MenaceX^
pawn Код:
//OnPlayerDeath.
new
  iArray[32];
GetWeaponName(reason,iArray,sizeof(iArray));
format(string,sizeof(string),"%s killed %s using %s.",killeridname,playeridname,iArray);
SendClientMessageToAll(color,string);
It wont save in a file
and i dont want server log I need extra file
maybe to use dini?


Re: How to do.... - nuriel8833 - 18.08.2009

Bump
i know its not 12 hours but its 4th page
please help


Re: How to do.... - MenaceX^ - 18.08.2009

pawn Код:
new
  str[64];
format(str,str(str),"%s\r\n",string);
new File:hFile;
hFile=fopen("log.log",io_append);
fwrite(hFile,str);
fclose(str);



Re: How to do.... - nuriel8833 - 18.08.2009

Quote:
Originally Posted by MenaceX^
pawn Код:
new
  str[64];
format(str,str(str),"%s\r\n",string);
new File:hFile;
hFile=fopen("log.log",io_append);
fwrite(hFile,str);
fclose(str);
where to add that?


Re: How to do.... - saiberfun - 18.08.2009

Quote:
Originally Posted by nuriel8833
where to add that?
read his first post


public OnPlayerDeath


Re: How to do.... - nuriel8833 - 18.08.2009

So to connect the both codes together?

pawn Код:
new
  str[64];
new
  iArray[32];
GetWeaponName(reason,iArray,sizeof(iArray));
format(string,sizeof(string),"%s killed %s using %s.",killeridname,playeridname,iArray);
SendClientMessageToAll(color,string);

format(str,str(str),"%s\r\n",string);
new File:hFile;
hFile=fopen("log.log",io_append);
fwrite(hFile,str);
fclose(str);