Read file help
#1

Hi ! I want to make a write/read system. First I make this
PHP код:
    if(strcmp(cmd"/carpark"true) == 0)
    {
        new 
name[MAX_PLAYER_NAME];
        
GetPlayerName(playerid,name,sizeof(name));
        if(
strcmp(name,"Petru_Chemp",false) == 0)
        {
            new 
Float:vehxFloat:vehyFloat:vehz;
              
GetVehiclePos(petrucarvehxvehyvehz);
            new 
Float:z_rot
            GetVehicleZAngle
(petrucarz_rot);
            
            new 
File:pos=fopen("petrucar.pos"io_write);
            
format(string256"CreateVehicle(541, %f, %f, %f, %f, 1,2,0);"vehxvehyvehzz_rot);
            
fwrite(posstring);
            
fclose(pos);
        }
    } 
And now I want to read this file and take from it x,y,z,rot coords . I try this but I don't know to continue

PHP код:
readpetrucar()
{
    new 
File:pos=fopen("petrucar.pos"io_read);
    new 
Float:vehxFloat:vehyFloat:vehz;
    
GetVehiclePos(petrucarvehxvehyvehz);
    new 
Float:z_rot
    
new string[256]
    
GetVehicleZAngle(petrucarz_rot);
    
format(string256"CreateVehicle(541, %f, %f, %f, %f, 1,2,0);"vehxvehyvehzz_rot);
    while(
fread(posstring))
    {
        
CreateVehicle(541x,y,z,rot,2,1,0);
    }

PHP код:
    if(strcmp(cmd"/mpon"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] == 7)
        {
            
readpetrucar();
        }
    } 
Please help me.
Reply


Messages In This Thread
[HELP] Fread - by Petru_Me - 23.07.2011, 10:01
Re: Read file help - by Petru_Me - 23.07.2011, 11:04
Re: Read file help - by Petru_Me - 24.07.2011, 18:36
Re: Read file help - by MadeMan - 24.07.2011, 19:11

Forum Jump:


Users browsing this thread: 1 Guest(s)