Scripting Functions Old
From SA-MP Wiki
(Redirected from Function:clrscr)
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=0 | The offset to start searching. |
size=sizeof name | The 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)
handle | The File handle to use, earlier opened by fopen(). |
value | The character you want to write. |
utf8=true | Should 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().
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)
value | The 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)
value | The float you want to know the cosine of. |
anglemode=radian | The 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)
value | The 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)
value | The float you want to know the log. of. |
base=10.0 | The 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)
value | The float you want to raise. |
exponent | The 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)
value | The float you want to know the sinus of. |
mode=radian | The 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)
value | The 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)
value | The float you want to know the tangent of. |
mode=radian | The 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 dest | The 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 dest | The 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. |
numbytes | The number of bytes to encode, this should not exceed 45. |
maxlength=sizeof dest | The maximum length of the dest[] array. |
uudecode(encodedString, normalString, 45);