Raised This Month: $ Target: $400
 0% 

write origin to file problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
fxfighter
Veteran Member
Join Date: Feb 2007
Location: Trollhättan
Old 06-26-2007 , 11:12   write origin to file problem
Reply With Quote #1

I am making an plugin the req to save on orgin location on every map in a doc.
gonna use it to move players to it later.
the problem is to save/load the origin heer is my code so far.
i know its a floot but i still dont get it.
plz only post back if you can help me!

PHP Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN ".."
#define VERSION "0.1"
#define AUTHOR "..."
new filename[256]
new 
origin[3]
public 
plugin_init() {
 
 
register_plugin("..""0.1""...")  
 
get_configsdir(filename,255)
 
format(filename,255,"%s/filehandle.txt",filename)
 
register_clcmd"say /spawnpoint","setspawn")
}
public 
setspawn(id)
{
 
client_print(id,print_chat,"loaction saved",origin)
 
get_user_origin(idorigin0)
 new 
writedata[128]
 new 
map[32],origin[3]
 
get_mapname(map,31)
 new 
filepointer fopen(filename,"a+")
 
 if(
filepointer)
 {
 
  
fprintf(filepointer,"%s %f^n",map,Float:origin[3])
 
  
fclose(filepointer)
 }
}
public 
client_connect(id)
{
 new 
filepointer fopen(filename,"r")
 if(
filepointer)
 {
  new 
readdata[128],map[32],Float:origin[3]
  new 
parsedmap[32],parsedorigin[8]
 
  while(
fgets(filepointer,readdata,127))
  {   
   
parse(readdata,parsedmap,31,parsedorigin,7)
 
   
get_mapname(map,31)
 
   if(
equal(map,parsedmap))
   {
    
origin[3] = str_to_float(parsedorigin)
    break
    
//...
   
}
  }
  
fclose(filepointer)
 }

__________________
If one of my plugins become broken, contact me by mail. [email protected]

Last edited by fxfighter; 06-26-2007 at 11:12. Reason: Removed the bloody smiles
fxfighter is offline
Send a message via MSN to fxfighter
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode