File Problem (stock)
#1

Function:
pawn Код:
stock LoadAttachment(playerid)
{
    new str[50];
    GetPlayerName(playerid,str,50);
    format(str,50,"attachment/%s.ini",str);
    new File:f =fopen(str,io_read);
    new string[256+1];
    fread(string,256);
    new tmp[12][128];
    split(string, tmp, ',');
    new index, modelid, boneid,
       Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ,
       Float:fRotX, Float:fRotY, Float:fRotZ,
       Float:fScaleX, Float:fScaleY, Float:fScaleZ;
    index = strval(tmp[0]);
    modelid = strval(tmp[1]);
    boneid = strval(tmp[2]);

    fOffsetX = floatstr(tmp[3]);
    fOffsetY = floatstr(tmp[4]);
    fOffsetZ = floatstr(tmp[5]);

    fRotX = floatstr(tmp[6]);
    fRotY = floatstr(tmp[7]);
    fRotZ = floatstr(tmp[8]);

    fScaleX = floatstr(tmp[9]);
    fScaleY = floatstr(tmp[10]);
    fScaleZ = floatstr(tmp[11]);

    SetPlayerAttachedObject(playerid,index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
    SendClientMessage(playerid, 0xFFFFFFFF, "Your Saved Attachement Loaded!");
    return 1;
}
Errors:
pawn Код:
D:\Lucru\1.3 samp 0.3e\gamemodes\MAPA PALAMINO.pwn(397) : error 035: argument type mismatch (argument 1)
D:\Lucru\1.3 samp 0.3e\gamemodes\MAPA PALAMINO.pwn(395) : warning 204: symbol is assigned a value that is never used: "f"
Lines:
pawn Код:
397:    fread(string,256);
395:    new File:f =fopen(str,io_read);
Reply
#2

You are not making use of fread correctly, please see the documentation on it for an example on how to use it correctly.

https://sampwiki.blast.hk/wiki/Fread
Reply
#3

IDk how to repair it,someone?
Reply
#4

Quote:
Originally Posted by calin1996
Посмотреть сообщение
IDk how to repair it,someone?
It expects the file handle as the first argument and the string to store the result in as the second argument, in your case:

pawn Код:
fread(f, string);
Hope that helps!
Reply
#5

pawn Код:
D:\Lucru\1.3 samp 0.3e\gamemodes\MAPA PALAMINO.pwn(397) : error 035: argument type mismatch (argument 2)
pawn Код:
397:    fread(f,256);
Reply
#6

How to make it? i've tried with:
fread(f,256);
and
fread(string,256);
But nothing
Reply
#7

why are you using 256 as the second parameter when you were told to use a string variable?
Reply
#8

Quote:
Originally Posted by cessil
Посмотреть сообщение
why are you using 256 as the second parameter when you were told to use a string variable?
THANK YOU
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)