Scripting Functions Old

From SA-MP Wiki

(Redirected from Function:fwrite)
Jump to: navigation, search

Contents

File functions (file.inc)

You may refer also on File tutorial for a tutorial on this.

fmatch

Description:

This function checks whether a part of the given file matched the string specified.
Parameters:
(name[],const pattern[],index=0,size=sizeof name)
name[]The filename to check.
const pattern[]The pattern that should be matched.
index=0The offset to start searching.
size=sizeof nameThe amount of characters to search in.
fmatch("searchFile.txt", "Peter", 0);


fputchar

Description:

This function writes one character to the file.
Parameters:
(handle,value,utf8=true)
handleThe File handle to use, earlier opened by fopen().
valueThe character you want to write.
utf8=trueShould the character be written as UTF8?
fputchar(gFile, 'e', false);


ftemp

Description:

This function opens a file in the "tmp" or "temp" directory for reading and writing. The file is deleted after you close it with fclose().
Image:32px-Circle-style-warning.png

Important
Note

This function can crash your game when the right directory isn't created.
Parameters:
(No Parameters)

Return Values:

The File handle
new File:gFile = ftemp();


Float functions (float.inc)

floatabs

Description:

Returns the absolute value of a float.
Parameters:
(value)
valueThe float you want to check

Return Values:

The absolute value of the float.
new Float:fAbs = floatabs(-123.54);


floatcos

Description:

Calculate the right cosine of a float, with a specific anglemode.
Parameters:
(value,anglemode=radian)
valueThe float you want to know the cosine of.
anglemode=radianThe Anglemode.

Return Values:

The cosine of the given float.
new Float:fCos = floatcos(87.343, radian);


floatfract

Description:

Calculate and return the fractional part of a float.
Parameters:
(value)
valueThe float you want to know that fractional path of.

Return Values:

The fractional part of the float.
new Float:fFract = floatfract(3249.34);


floatlog

Description:

Use this function if you want to know the logarithm of a float.
Parameters:
(value,base=10.0)
valueThe float you want to know the log. of.
base=10.0The base value to use.

Return Values:

The logarithm value of the float.
new Float:fLog = floatlog(128.0);


floatpower

Description:

Raises the float to the power of the exponent float.
Parameters:
(value,exponent)
valueThe float you want to raise.
exponentThe exponent you want, as a float.

Return Values:

The float raised by the power of the exponent.
new Float:fPower = floatpower(5.0, 2); // 25


floatsin

Description:

Calculate the sinus of the given float, with the anglemode in radian, degrees or grads
Parameters:
(value,anglemode:mode=radian)
valueThe float you want to know the sinus of.
mode=radianThe Anglemode.

Return Values:

The sinus of the given float.
new Float:fSin = floatsin(82.4);


floatsqroot

Description:

Calculate the square root of the given float.
Parameters:
(value)
valueThe float you want to know the square root of.

Return Values:

The square root of the float.
new Float:fSqroot = floatsqroot(743.34);


floattan

Description:

Calculate the tangent of the given float in the first argument, using it on a radian, grads or degree basis.
Parameters:
(value,mode=radian)
valueThe float you want to know the tangent of.
mode=radianThe you Anglemode wish to use.

Return Values:

The tangent value of the float.
new Float:fTan = floattan(87.4);


String functions (string.inc)

ispacked

Description:

Check if the given string is packed, and return the result.
Parameters:
(const string[])
const string[]The string you want to check.

Return Values:

1 if the string is packed, 0 if it's unpacked.
if(ispacked(string)){


strunpack

Description:

This function unpacks a packed string, into the destination.
Parameters:
(dest[],const source[],maxlength=sizeof dest)
dest[]The destination for the unpacked string.
const source[]The current packed string to unpack.
maxlength=sizeof destThe length of the destination string.
strunpack(string, packedString);


uudecode

Description:

This function enables you to decode an UU-encoded stream.
Parameters:
(dest[],const source[],maxlength=sizeof dest)
dest[]The destination for the decoded string array.
const source[]The UU-encoded source string.
maxlength=sizeof destThe maximum length of dest that can be used.
uudecode(decodedString, encodedString);


uuencode

Description:

The string you can decode with uudecode, must be encoded with this function.
Parameters:
(dest[],const source[],numbytes,maxlength=sizeof dest)
dest[]The destination string for the encoded stream.
const source[]The source, non-encoded string.
numbytesThe number of bytes to encode, this should not exceed 45.
maxlength=sizeof destThe maximum length of the dest[] array.
uudecode(encodedString, normalString, 45);
Personal tools
Navigation
Toolbox
In other languages