Raised This Month: $ Target: $400
 0% 

Help about Reading from file strings.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 01-27-2016 , 03:44   Help about Reading from file strings.
Reply With Quote #1

The problem: is reading only the first line, sorry, i'm noob at reading files, thank's for help:

Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

new const PLUGIN[]	= "Block Pick UP by MODEL",
	 VERSION[]	= "0.1",
	  AUTHOR[]	= "Craxor";

new filename[256];
new g_Model[60];
new buffer[60];

public plugin_init( )
{
	register_plugin
	(
		.plugin_name = PLUGIN, 
		.version     = VERSION, 
		.author      = AUTHOR
	)

	register_forward( FM_Touch, "WeaponBk" );
}

public plugin_cfg( )
{
	get_configsdir(filename,255)
	format(filename,255,"%s/blockpuw.ini",filename)

 
	new filepointer = fopen(filename,"r")

	if(filepointer)
	{
		new readdata[128];

		while(fgets(filepointer,readdata,charsmax( readdata)))
		{
			parse(readdata,g_Model, charsmax( g_Model ))
			formatex( buffer, charsmax( buffer ), "models/w_%s.mdl", g_Model);
			break;
		}
     
		fclose(filepointer)
	}
}
 
public WeaponBk( Entity, Id )
{
	if (!pev_valid(Entity) || !pev_valid(Id) || !is_user_alive(Id))
		return FMRES_IGNORED;

        new Model[32];
        pev(Entity, pev_model, Model, charsmax( Model ) );

	if( equali ( Model, buffer ) )
		return FMRES_SUPERCEDE;	

	return FMRES_IGNORED;
}
__________________
Project: Among Us

Last edited by Craxor; 01-27-2016 at 05:06.
Craxor is offline
Send a message via ICQ to Craxor
 



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 09:21.


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