SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 18/03/2019, 12:07 PM   #4001
B3x7K
Big Clucker
 
B3x7K's Avatar
 
Join Date: Aug 2017
Location: 惑星黒トカゲ
Posts: 68
Reputation: 3
Default Re: Useful Functions

MessageKick(playerid, message[], (mixed));
Based on SendClientMessageEx function:
https://forum.sa-mp.com/showpost.php...postcount=4529

Usage:
PHP Code:
public OnPlayerConnect(playerid)
{
        
MessageKick(playerid"You're not worth to join %s server"SERVER_NAME);
        return 
1;

Code:
PHP Code:
stock MessageKick(playerid, const message[], {Float_}:...)
{
    static
        
args,
        
str[144];

    
/*
     *  Custom function that uses #emit to format variables into a string.
     *  This code is very fragile; touching any code here will cause crashing!
    */
    
if ((args numargs()) == 2)
    {
        
SendClientMessage(playerid0xFFFFFFAAmessage);
        
SetTimerEx("Kick"200false"i"playerid);

    }
    else
    {
        while (--
args >= 2)
        {
            
#emit LCTRL 5
            #emit LOAD.alt args
            #emit SHL.C.alt 2
            #emit ADD.C 12
            #emit ADD
            #emit LOAD.I
            #emit PUSH.pri
        
}
        
#emit PUSH.S message
        #emit PUSH.C 144
        #emit PUSH.C str
        #emit LOAD.S.pri 8
        #emit ADD.C 4
        #emit PUSH.pri
        #emit SYSREQ.C format
        #emit LCTRL 5
        #emit SCTRL 4

        
SendClientMessage(playerid0xFFFFFFAAstr);
        
SetTimerEx("Kick"200false"i"playerid);

        
#emit RETN
    
}
    return 
1;

You can change the amount ms to 500 or 10000000 if Kick with 200ms still won't show a message.

----
GenerateVoucher(output[])
This function can create a voucher like:
VOC-2FE3-JB2E-EK56-AB2T-R32F

Usage:
PHP Code:
CMD:createvoucher(playeridparams[])
{  
    new 
str[64];
  
    
GenerateVoucher(str);
    
format(strsizeof(str), "Successfully created a voucher (%s)"str);
    
SendClientMessage(playeridstr);
    return 
1;

Code:
PHP Code:
stock GenerateVoucher(output[])
{    
    new 
emee[25], total;
    for(new 
sa 0sa sizeof(emee); sa++) 
    {
        
total sa 5;
        
emee[sa] = random(2) ? (random(26) + 'A') : (random(10) + '0');
        if(
total == && emee[sa] != EOS) {
            
emee[sa] = '-';
        }
       }
    
format(outputsizeof(emee)+4"VOC%s"emee);
    return 
1;

__________________

HOW TO ENGLISH?!
AAAAAAAAAAAAAAAA

B3x7K is offline   Reply With Quote
Old 26/04/2019, 02:06 PM   #4002
RoboN1X
Huge Clucker
 
RoboN1X's Avatar
 
Join Date: Feb 2011
Location: Indonesia
Posts: 352
Reputation: 69
Default Re: Useful Functions IsValidSound

IsValidSound(soundid)
  • soundid The id of the sound
Returns
  • 0 Sound ID is invalid
  • 1 Sound ID is valid
Check if a sound id or game audio id is valid (known), code is at the bottom of this post

Based on modified method of IsValidObject by y-!more and bits builder by Slice's on this topic:
https://forum.sa-mp.com/showthread.php?t=352279
The sound id data source: http://pastebin.com/A1PbQZPd by Austin and LaZ (as seen in https://wiki.sa-mp.com/wiki/Sound_IDs) MERGED with the AudioEvents.txt list in GTA:SA data folder.

The differences i could see is that sound id 1190 is missing from AudioEvents while an ambient sound id 22600 is not in the pastebin. Some of audio events from 1000 to 1800 are also abstain from the pastebin because it's used in single player only (i.e. in minigames, arcades, or cutscenes), but i assume these id are safe anyway.

Note as of R2 client update, sound id ranging from 0 to 1000 are also included (they are not listed in the current pastebin and AudioEvents).

Even though i know that sa-mp client will not crash when passing invalid sound id between the range 0 to 45400 already (only silent), this may be still useful for people who'd like to keep this in the script/server data.
So, you do not really need this.

At first i did it so rough like this:
Code:
// DO NOT USE, THIS IS JUST EXAMPLE OF BAD IMPLEMENTATION
IsValidSoundSlow(soundid)
{
	if (0 <= soundid <= 1190) return 1;
	if (1800 <= soundid <= 1829) return 1;
	if (2000 <= soundid <= 2163) return 1;
	if (2200 <= soundid <= 2214) return 1;
	if (2400 <= soundid <= 2404) return 1;
	if (2600 <= soundid <= 2608) return 1;
	if (2800 <= soundid <= 2813) return 1;
	if (3000 <= soundid <= 3057) return 1;
	if (3200 <= soundid <= 3201) return 1;
	if (3400 <= soundid <= 3401) return 1;
	if (soundid == 3600) return 1;
	if (soundid == 3800) return 1;
	if (4000 <= soundid <= 4001) return 1;
	if (4200 <= soundid <= 4203) return 1;
	if (soundid == 4400) return 1;
	if (4600 <= soundid <= 4604) return 1;
	if (4800 <= soundid <= 4807) return 1;
	if (5000 <= soundid <= 5014) return 1;
	if (5200 <= soundid <= 5206) return 1;
	if (5400 <= soundid <= 5464) return 1;
	if (5600 <= soundid <= 5602) return 1;
	if (5800 <= soundid <= 5856) return 1;
	if (6000 <= soundid <= 6003) return 1;
	if (6200 <= soundid <= 6205) return 1;
	if (6400 <= soundid <= 6402) return 1;
	if (6600 <= soundid <= 6603) return 1;
	if (6800 <= soundid <= 6802) return 1;
	if (7000 <= soundid <= 7066) return 1;
	if (7200 <= soundid <= 7239) return 1;
	if (7400 <= soundid <= 7421) return 1;
	if (7600 <= soundid <= 7612) return 1;
	if (7800 <= soundid <= 7902) return 1;
	if (8000 <= soundid <= 8017) return 1;
	if (8200 <= soundid <= 8278) return 1;
	if (8400 <= soundid <= 8412) return 1;
	if (8600 <= soundid <= 8738) return 1;
	if (8800 <= soundid <= 8840) return 1;
	if (9000 <= soundid <= 9031) return 1;
	if (9200 <= soundid <= 9201) return 1;
	if (9400 <= soundid <= 9451) return 1;
	if (9600 <= soundid <= 9676) return 1;
	if (9800 <= soundid <= 9914) return 1;
	if (10000 <= soundid <= 10015) return 1;
	if (10200 <= soundid <= 10214) return 1;
	if (10400 <= soundid <= 10409) return 1;
	if (10600 <= soundid <= 10663) return 1;
	if (10800 <= soundid <= 10832) return 1;
	if (11000 <= soundid <= 11010) return 1;
	if (soundid == 11200) return 1;
	if (11400 <= soundid <= 11455) return 1;
	if (11600 <= soundid <= 11655) return 1;
	if (11800 <= soundid <= 11855) return 1;
	if (12000 <= soundid <= 12055) return 1;
	if (12200 <= soundid <= 12201) return 1;
	if (12400 <= soundid <= 12411) return 1;
	if (12600 <= soundid <= 12605) return 1;
	if (12800 <= soundid <= 12832) return 1;
	if (13000 <= soundid <= 13038) return 1;
	if (13200 <= soundid <= 13216) return 1;
	if (13400 <= soundid <= 13419) return 1;
	if (13600 <= soundid <= 13646) return 1;
	if (13800 <= soundid <= 13803) return 1;
	if (14000 <= soundid <= 14041) return 1;
	if (soundid == 14200) return 1;
	if (14400 <= soundid <= 14410) return 1;
	if (soundid == 14600) return 1;
	if (soundid == 14800) return 1;
	if (15000 <= soundid <= 15028) return 1;
	if (15200 <= soundid <= 15258) return 1;
	if (15400 <= soundid <= 15408) return 1;
	if (15600 <= soundid <= 15603) return 1;
	if (15800 <= soundid <= 15950) return 1;
	if (16000 <= soundid <= 16018) return 1;
	if (soundid == 16200) return 1;
	if (16400 <= soundid <= 16504) return 1;
	if (16600 <= soundid <= 16614) return 1;
	if (16800 <= soundid <= 16803) return 1;
	if (17000 <= soundid <= 17006) return 1;
	if (soundid == 17200) return 1;
	if (17400 <= soundid <= 17455) return 1;
	if (17600 <= soundid <= 17622) return 1;
	if (17800 <= soundid <= 17807) return 1;
	if (18000 <= soundid <= 18025) return 1;
	if (18200 <= soundid <= 18216) return 1;
	if (18400 <= soundid <= 18434) return 1;
	if (18600 <= soundid <= 18616) return 1;
	if (18800 <= soundid <= 18807) return 1;
	if (19000 <= soundid <= 19135) return 1;
	if (19200 <= soundid <= 19219) return 1;
	if (19400 <= soundid <= 19403) return 1;
	if (19600 <= soundid <= 19604) return 1;
	if (soundid == 19800) return 1;
	if (20000 <= soundid <= 20072) return 1;
	if (20200 <= soundid <= 20248) return 1;
	if (20400 <= soundid <= 20424) return 1;
	if (soundid == 20600) return 1;
	if (20800 <= soundid <= 20804) return 1;
	if (21000 <= soundid <= 21002) return 1;
	if (21200 <= soundid <= 21207) return 1;
	if (21400 <= soundid <= 21456) return 1;
	if (21600 <= soundid <= 21666) return 1;
	if (21800 <= soundid <= 21808) return 1;
	if (22000 <= soundid <= 22039) return 1;
	if (22200 <= soundid <= 22217) return 1;
	if (22400 <= soundid <= 22406) return 1;
	if (soundid == 22600) return 1;
	if (22800 <= soundid <= 22839) return 1;
	if (soundid == 23000) return 1;
	if (23200 <= soundid <= 23209) return 1;
	if (soundid == 23400) return 1;
	if (soundid == 23600) return 1;
	if (23800 <= soundid <= 23835) return 1;
	if (24000 <= soundid <= 24063) return 1;
	if (24200 <= soundid <= 24219) return 1;
	if (24400 <= soundid <= 24433) return 1;
	if (soundid == 24600) return 1;
	if (24800 <= soundid <= 24829) return 1;
	if (25000 <= soundid <= 25047) return 1;
	if (25200 <= soundid <= 25319) return 1;
	if (25400 <= soundid <= 25423) return 1;
	if (25600 <= soundid <= 25604) return 1;
	if (25800 <= soundid <= 25801) return 1;
	if (26000 <= soundid <= 26009) return 1;
	if (26200 <= soundid <= 26223) return 1;
	if (26400 <= soundid <= 26412) return 1;
	if (26600 <= soundid <= 26633) return 1;
	if (26800 <= soundid <= 26811) return 1;
	if (27000 <= soundid <= 27018) return 1;
	if (27200 <= soundid <= 27205) return 1;
	if (27400 <= soundid <= 27422) return 1;
	if (27600 <= soundid <= 27621) return 1;
	if (27800 <= soundid <= 27833) return 1;
	if (soundid == 28000) return 1;
	if (28200 <= soundid <= 28204) return 1;
	if (28400 <= soundid <= 28427) return 1;
	if (28600 <= soundid <= 28622) return 1;
	if (28800 <= soundid <= 28811) return 1;
	if (29000 <= soundid <= 29155) return 1;
	if (29200 <= soundid <= 29217) return 1;
	if (29400 <= soundid <= 29413) return 1;
	if (29600 <= soundid <= 29665) return 1;
	if (29800 <= soundid <= 29825) return 1;
	if (30000 <= soundid <= 30082) return 1;
	if (30200 <= soundid <= 30221) return 1;
	if (30400 <= soundid <= 30416) return 1;
	if (soundid == 30600) return 1;
	if (30800 <= soundid <= 30803) return 1;
	if (31000 <= soundid <= 31001) return 1;
	if (31200 <= soundid <= 31205) return 1;
	if (soundid == 31400) return 1;
	if (31600 <= soundid <= 31605) return 1;
	if (31800 <= soundid <= 31810) return 1;
	if (soundid == 32000) return 1;
	if (32200 <= soundid <= 32201) return 1;
	if (32400 <= soundid <= 32402) return 1;
	if (soundid == 32600) return 1;
	if (32800 <= soundid <= 32847) return 1;
	if (33000 <= soundid <= 33088) return 1;
	if (33200 <= soundid <= 33304) return 1;
	if (33400 <= soundid <= 33403) return 1;
	if (33600 <= soundid <= 33676) return 1;
	if (33800 <= soundid <= 33889) return 1;
	if (34000 <= soundid <= 34067) return 1;
	if (34200 <= soundid <= 34273) return 1;
	if (34400 <= soundid <= 34415) return 1;
	if (34600 <= soundid <= 34606) return 1;
	if (34800 <= soundid <= 34831) return 1;
	if (35000 <= soundid <= 35075) return 1;
	if (35200 <= soundid <= 35240) return 1;
	if (35400 <= soundid <= 35488) return 1;
	if (35600 <= soundid <= 35733) return 1;
	if (35800 <= soundid <= 35883) return 1;
	if (soundid == 36000) return 1;
	if (36200 <= soundid <= 36205) return 1;
	if (36400 <= soundid <= 36401) return 1;
	if (36600 <= soundid <= 36604) return 1;
	if (36800 <= soundid <= 36860) return 1;
	if (37000 <= soundid <= 37035) return 1;
	if (37200 <= soundid <= 37245) return 1;
	if (37400 <= soundid <= 37494) return 1;
	if (37600 <= soundid <= 37681) return 1;
	if (37800 <= soundid <= 37873) return 1;
	if (38000 <= soundid <= 38060) return 1;
	if (38200 <= soundid <= 38238) return 1;
	if (38400 <= soundid <= 38471) return 1;
	if (38600 <= soundid <= 38644) return 1;
	if (38800 <= soundid <= 38854) return 1;
	if (39000 <= soundid <= 39078) return 1;
	if (39200 <= soundid <= 39223) return 1;
	if (39400 <= soundid <= 39413) return 1;
	if (39600 <= soundid <= 39667) return 1;
	if (39800 <= soundid <= 39815) return 1;
	if (soundid == 40000) return 1;
	if (40200 <= soundid <= 40238) return 1;
	if (40400 <= soundid <= 40408) return 1;
	if (soundid == 40600) return 1;
	if (40800 <= soundid <= 40820) return 1;
	if (41000 <= soundid <= 41042) return 1;
	if (41200 <= soundid <= 41272) return 1;
	if (41400 <= soundid <= 41432) return 1;
	if (41600 <= soundid <= 41604) return 1;
	if (soundid == 41800) return 1;
	if (42000 <= soundid <= 42011) return 1;
	if (42200 <= soundid <= 42208) return 1;
	if (42400 <= soundid <= 42424) return 1;
	if (42600 <= soundid <= 42601) return 1;
	if (42800 <= soundid <= 42803) return 1;
	if (43000 <= soundid <= 43001) return 1;
	if (43200 <= soundid <= 43206) return 1;
	if (43400 <= soundid <= 43407) return 1;
	if (43600 <= soundid <= 43664) return 1;
	if (43800 <= soundid <= 43905) return 1;
	if (44000 <= soundid <= 44107) return 1;
	if (44200 <= soundid <= 44247) return 1;
	if (44400 <= soundid <= 44444) return 1;
	if (44600 <= soundid <= 44631) return 1;
	if (44800 <= soundid <= 44820) return 1;
	if (45000 <= soundid <= 45011) return 1;
	if (45200 <= soundid <= 45255) return 1;
	if (soundid == 45400) return 1;
	return 0;
}
I know some of you guys would suggest using || and single return, but that gave me compilation error of staging buffer (102).

But then i decide to use Slice implementation, converted it as list, printing each id as binary, and converted it to decimal, there are 8072 ids so it turns out like this (1419 cells):
Code:
// USE THIS ONE, it is optimized
stock IsValidSound(soundid)
{
	static const audiodat[] =
	{
		-1, -1, -1, -1, -1, -1, -1, -1, -1,
		-1, -1, -1, -1, -1, -1, -1, -1, -1,
		-1, -1, -1, -1, -1, -1, -1, -1, -1,
		-1, -1, -1, -1, -1, -1, -1, -1, -1,
		-1, 127, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, -256, 63, 0, 0, 0, 0, -65536,
		-1, -1, -1, -1, 1048575, -16777216, 127, 0, 0,
		0, 0, 0, 31, 0, 0, 0, 0, 0,
		130816, 0, 0, 0, 0, 0, 1073676288, 0, 0,
		0, 0, 0, -16777216, -1, 262143, 0, 0, 0,
		0, 3, 0, 0, 0, 0, 0, 768, 0,
		0, 0, 0, 0, 65536, 0, 0, 0, 0,
		0, 16777216, 0, 0, 0, 0, 0, 0, 3,
		0, 0, 0, 0, 0, 3840, 0, 0, 0,
		0, 0, 65536, 0, 0, 0, 0, 0, 520093696,
		0, 0, 0, 0, 0, 0, 255, 0, 0,
		0, 0, 0, 8388352, 0, 0, 0, 0, 0,
		8323072, 0, 0, 0, 0, 0, -16777216, -1, 33554431,
		0, 0, 0, 0, 7, 0, 0, 0, 0,
		0, -256, -1, 1, 0, 0, 0, 983040, 0,
		0, 0, 0, 0, 1056964608, 0, 0, 0, 0,
		0, 0, 7, 0, 0, 0, 0, 0, 3840,
		0, 0, 0, 0, 0, 458752, 0, 0, 0,
		0, 0, -16777216, -1, 134217727, 0, 0, 0, 0,
		-1, 255, 0, 0, 0, 0, 1073741568, 0, 0,
		0, 0, 0, 536805376, 0, 0, 0, 0, 0,
		-16777216, -1, -1, cellmax, 0, 0, 0, 262143, 0,
		0, 0, 0, 0, -256, -1, 8388607, 0, 0,
		0, 536805376, 0, 0, 0, 0, 0, -16777216, -1,
		-1, -1, -1, 7, 0, -1, 511, 0, 0,
		0, 0, -256, 255, 0, 0, 0, 0, 196608,
		0, 0, 0, 0, 0, -16777216, -1, 4095, 0,
		0, 0, 0, -1, -1, 8191, 0, 0, 0,
		-256, -1, -1, 134217727, 0, 0, -65536, 0, 0,
		0, 0, 0, -16777216, 127, 0, 0, 0, 0,
		0, 1023, 0, 0, 0, 0, 0, -256, -1,
		255, 0, 0, 0, -65536, 131071, 0, 0, 0,
		0, -16777216, 7, 0, 0, 0, 0, 0, 1,
		0, 0, 0, 0, 0, -256, -1, 0, 0,
		0, 0, -65536, -1, 255, 0, 0, 0, -16777216,
		-1, 65535, 0, 0, 0, 0, -1, 16777215, 0,
		0, 0, 0, 768, 0, 0, 0, 0, 0,
		268369920, 0, 0, 0, 0, 0, 1056964608, 0, 0,
		0, 0, 0, 0, -1, 1, 0, 0, 0,
		0, -256, 32767, 0, 0, 0, 0, -65536, 1,
		0, 0, 0, 0, -16777216, 4095, 0, 0, 0,
		0, 0, -1, 32767, 0, 0, 0, 0, 3840,
		0, 0, 0, 0, 0, -65536, 67108863, 0, 0,
		0, 0, 16777216, 0, 0, 0, 0, 0, 0,
		2047, 0, 0, 0, 0, 0, 256, 0, 0,
		0, 0, 0, 65536, 0, 0, 0, 0, 0,
		-16777216, 2097151, 0, 0, 0, 0, 0, -1, 134217727,
		0, 0, 0, 0, 130816, 0, 0, 0, 0,
		0, 983040, 0, 0, 0, 0, 0, -16777216, -1,
		-1, -1, -1, 32767, 0, 524287, 0, 0, 0,
		0, 0, 256, 0, 0, 0, 0, 0, -65536,
		-1, -1, 33554431, 0, 0, -16777216, 127, 0, 0,
		0, 0, 0, 15, 0, 0, 0, 0, 0,
		32512, 0, 0, 0, 0, 0, 65536, 0, 0,
		0, 0, 0, -16777216, -1, 65535, 0, 0, 0,
		0, 8388607, 0, 0, 0, 0, 0, 65280, 0,
		0, 0, 0, 0, -65536, 1023, 0, 0, 0,
		0, -16777216, 511, 0, 0, 0, 0, 0, -1,
		7, 0, 0, 0, 0, 33554176, 0, 0, 0,
		0, 0, 16711680, 0, 0, 0, 0, 0, -16777216,
		-1, -1, -1, -1, 0, 0, 1048575, 0, 0,
		0, 0, 0, 3840, 0, 0, 0, 0, 0,
		2031616, 0, 0, 0, 0, 0, 16777216, 0, 0,
		0, 0, 0, 0, -1, -1, 511, 0, 0,
		0, -256, 33554431, 0, 0, 0, 0, -65536, 511,
		0, 0, 0, 0, 16777216, 0, 0, 0, 0,
		0, 0, 31, 0, 0, 0, 0, 0, 1792,
		0, 0, 0, 0, 0, 16711680, 0, 0, 0,
		0, 0, -16777216, -1, 131071, 0, 0, 0, 0,
		-1, -1, 7, 0, 0, 0, 130816, 0, 0,
		0, 0, 0, -65536, 16777215, 0, 0, 0, 0,
		-16777216, 1023, 0, 0, 0, 0, 0, 127, 0,
		0, 0, 0, 0, 256, 0, 0, 0, 0,
		0, -65536, 16777215, 0, 0, 0, 0, 16777216, 0,
		0, 0, 0, 0, 0, 1023, 0, 0, 0,
		0, 0, 256, 0, 0, 0, 0, 0, 65536,
		0, 0, 0, 0, 0, -16777216, 268435455, 0, 0,
		0, 0, 0, -1, -1, 0, 0, 0, 0,
		268435200, 0, 0, 0, 0, 0, -65536, 262143, 0,
		0, 0, 0, 16777216, 0, 0, 0, 0, 0,
		0, 1073741823, 0, 0, 0, 0, 0, -256, 16777215,
		0, 0, 0, 0, -65536, -1, -1, -1, 255,
		0, -16777216, 65535, 0, 0, 0, 0, 0, 31,
		0, 0, 0, 0, 0, 768, 0, 0, 0,
		0, 0, 67043328, 0, 0, 0, 0, 0, -16777216,
		65535, 0, 0, 0, 0, 0, 8191, 0, 0,
		0, 0, 0, -256, 1023, 0, 0, 0, 0,
		268369920, 0, 0, 0, 0, 0, -16777216, 2047, 0,
		0, 0, 0, 0, 63, 0, 0, 0, 0,
		0, 2147483392, 0, 0, 0, 0, 0, -65536, 63,
		0, 0, 0, 0, -16777216, 67108863, 0, 0, 0,
		0, 0, 1, 0, 0, 0, 0, 0, 7936,
		0, 0, 0, 0, 0, -65536, 4095, 0, 0,
		0, 0, -16777216, 32767, 0, 0, 0, 0, 0,
		4095, 0, 0, 0, 0, 0, -256, -1, -1,
		-1, -1, 15, -65536, 3, 0, 0, 0, 0,
		-16777216, 63, 0, 0, 0, 0, 0, -1, -1,
		3, 0, 0, 0, -256, 3, 0, 0, 0,
		0, -65536, -1, -1, 7, 0, 0, -16777216, 16383,
		0, 0, 0, 0, 0, 131071, 0, 0, 0,
		0, 0, 256, 0, 0, 0, 0, 0, 983040,
		0, 0, 0, 0, 0, 50331648, 0, 0, 0,
		0, 0, 0, 63, 0, 0, 0, 0, 0,
		256, 0, 0, 0, 0, 0, 4128768, 0, 0,
		0, 0, 0, -16777216, 7, 0, 0, 0, 0,
		0, 1, 0, 0, 0, 0, 0, 768, 0,
		0, 0, 0, 0, 458752, 0, 0, 0, 0,
		0, 16777216, 0, 0, 0, 0, 0, 0, -1,
		65535, 0, 0, 0, 0, -256, -1, -1, 1,
		0, 0, -65536, -1, -1, 33554431, 0, 0, 251658240,
		0, 0, 0, 0, 0, 0, -1, -1, 8191,
		0, 0, 0, -256, -1, -1, 3, 0, 0,
		-65536, -1, 1048575, 0, 0, 0, -16777216, -1, -1,
		3, 0, 0, 0, 65535, 0, 0, 0, 0,
		0, 32512, 0, 0, 0, 0, 0, -65536, 65535,
		0, 0, 0, 0, -16777216, -1, -1, 15, 0,
		0, 0, -1, 511, 0, 0, 0, 0, -256,
		-1, -1, 1, 0, 0, -65536, -1, -1, -1,
		4194303, 0, -16777216, -1, -1, 4095, 0, 0, 0,
		1, 0, 0, 0, 0, 0, 16128, 0, 0,
		0, 0, 0, 196608, 0, 0, 0, 0, 0,
		520093696, 0, 0, 0, 0, 0, 0, -1, 536870911,
		0, 0, 0, 0, -256, 4095, 0, 0, 0,
		0, -65536, 1073741823, 0, 0, 0, 0, -16777216, -1,
		-1, 8388607, 0, 0, 0, -1, -1, 262143, 0,
		0, 0, -256, -1, 262143, 0, 0, 0, -65536,
		-1, 8191, 0, 0, 0, -16777216, cellmax, 0, 0,
		0, 0, 0, -1, -1, 255, 0, 0, 0,
		-256, 2097151, 0, 0, 0, 0, -65536, -1, 127,
		0, 0, 0, -16777216, -1, -1, 127, 0, 0,
		0, 16777215, 0, 0, 0, 0, 0, 4194048, 0,
		0, 0, 0, 0, -65536, -1, 1048575, 0, 0,
		0, -16777216, 255, 0, 0, 0, 0, 0, 1,
		0, 0, 0, 0, 0, -256, 32767, 0, 0,
		0, 0, 33488896, 0, 0, 0, 0, 0, 16777216,
		0, 0, 0, 0, 0, 0, 2097151, 0, 0,
		0, 0, 0, -256, 524287, 0, 0, 0, 0,
		-65536, -1, 33554431, 0, 0, 0, -16777216, 33554431, 0,
		0, 0, 0, 0, 31, 0, 0, 0, 0,
		0, 256, 0, 0, 0, 0, 0, 268369920, 0,
		0, 0, 0, 0, -16777216, 1, 0, 0, 0,
		0, 0, 33554431, 0, 0, 0, 0, 0, 768,
		0, 0, 0, 0, 0, 983040, 0, 0, 0,
		0, 0, 50331648, 0, 0, 0, 0, 0, 0,
		127, 0, 0, 0, 0, 0, 65280, 0, 0,
		0, 0, 0, -65536, -1, 131071, 0, 0, 0,
		-16777216, -1, -1, -1, 3, 0, 0, -1, -1,
		-1, 4095, 0, 0, -256, 16777215, 0, 0, 0,
		0, -65536, 536870911, 0, 0, 0, 0, -16777216, 16777215,
		0, 0, 0, 0, 0, 2097151, 0, 0, 0,
		0, 0, 1048320, 0, 0, 0, 0, 0, -65536,
		-1, 255, 0, 0, 0, 16777216
	};
	return ((soundid >= 0) && ((soundid / 32) < sizeof (audiodat)) && (audiodat[soundid / 32] & (1 << (soundid % 32))));
}
I couldn't make it more neat, so i only split the array after every 9th. Feel free to give it a neat padding!

EDIT: I just remembered they said to use hexadecimal, so it looks clean, here is it (it is 11192 characters larger):
Code:
stock IsValidSound(soundid)
{
	static const audiodat[] =
	{
		0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
		0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
		0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
		0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
		0xFFFFFFFF, 0x0000007F, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0xFFFFFF00, 0x0000003F, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000,
		0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x000FFFFF, 0xFF000000, 0x0000007F, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x0000001F, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x0001FF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3FFF0000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFFFFFFFF, 0x0003FFFF, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000300, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000F00, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1F000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000FF, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x007FFF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x007F0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFFFFFFFF, 0x01FFFFFF,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0xFFFFFF00, 0xFFFFFFFF, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x000F0000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3F000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000F00,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00070000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0xFF000000, 0xFFFFFFFF, 0x07FFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0xFFFFFFFF, 0x000000FF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3FFFFF00, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x1FFF0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x7FFFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x0003FFFF, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFFFFF, 0x007FFFFF, 0x00000000, 0x00000000,
		0x00000000, 0x1FFF0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFFFFFFFF,
		0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000007, 0x00000000, 0xFFFFFFFF, 0x000001FF, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0xFFFFFF00, 0x000000FF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00030000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFFFFFFFF, 0x00000FFF, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00001FFF, 0x00000000, 0x00000000, 0x00000000,
		0xFFFFFF00, 0xFFFFFFFF, 0xFFFFFFFF, 0x07FFFFFF, 0x00000000, 0x00000000, 0xFFFF0000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0x0000007F, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x000003FF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFFFFF,
		0x000000FF, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000, 0x0001FFFF, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0xFF000000, 0x00000007, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFFFFF, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0x000000FF, 0x00000000, 0x00000000, 0x00000000, 0xFF000000,
		0xFFFFFFFF, 0x0000FFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0x00FFFFFF, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000300, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x0FFF0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3F000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0xFFFFFF00, 0x00007FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000, 0x00000001,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0x00000FFF, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0xFFFFFFFF, 0x00007FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000F00,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000, 0x03FFFFFF, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x000007FF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0xFF000000, 0x001FFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0x07FFFFFF,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0001FF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x000F0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFFFFFFFF,
		0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00007FFF, 0x00000000, 0x0007FFFF, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000,
		0xFFFFFFFF, 0xFFFFFFFF, 0x01FFFFFF, 0x00000000, 0x00000000, 0xFF000000, 0x0000007F, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x0000000F, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00007F00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFFFFFFFF, 0x0000FFFF, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x007FFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000FF00, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000, 0x000003FF, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0xFF000000, 0x000001FF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF,
		0x00000007, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01FFFF00, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00FF0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000,
		0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x000FFFFF, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000F00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x001F0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x000001FF, 0x00000000, 0x00000000,
		0x00000000, 0xFFFFFF00, 0x01FFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000, 0x000001FF,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x0000001F, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000700,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00FF0000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0xFF000000, 0xFFFFFFFF, 0x0001FFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0xFFFFFFFF, 0xFFFFFFFF, 0x00000007, 0x00000000, 0x00000000, 0x00000000, 0x0001FF00, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0xFFFF0000, 0x00FFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0xFF000000, 0x000003FF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000007F, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0xFFFF0000, 0x00FFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000003FF, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0x0FFFFFFF, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x0FFFFF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000, 0x0003FFFF, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x3FFFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0x00FFFFFF,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x000000FF,
		0x00000000, 0xFF000000, 0x0000FFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000001F,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000300, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x03FF0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000,
		0x0000FFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001FFF, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0x000003FF, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x0FFF0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0x000007FF, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000003F, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x7FFFFF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000, 0x0000003F,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0x03FFFFFF, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001F00,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000, 0x00000FFF, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0xFF000000, 0x00007FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFFFFF, 0xFFFFFFFF,
		0xFFFFFFFF, 0xFFFFFFFF, 0x0000000F, 0xFFFF0000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0xFF000000, 0x0000003F, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF,
		0x00000003, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000007, 0x00000000, 0x00000000, 0xFF000000, 0x00003FFF,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0001FFFF, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000F0000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x03000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x0000003F, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x003F0000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0x00000007, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000300, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00070000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF,
		0x0000FFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000001,
		0x00000000, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0xFFFFFFFF, 0x01FFFFFF, 0x00000000, 0x00000000, 0x0F000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00001FFF,
		0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000003, 0x00000000, 0x00000000,
		0xFFFF0000, 0xFFFFFFFF, 0x000FFFFF, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF,
		0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x0000FFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00007F00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000, 0x0000FFFF,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000000F, 0x00000000,
		0x00000000, 0x00000000, 0xFFFFFFFF, 0x000001FF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00,
		0xFFFFFFFF, 0xFFFFFFFF, 0x00000001, 0x00000000, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
		0x003FFFFF, 0x00000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000FFF, 0x00000000, 0x00000000, 0x00000000,
		0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00003F00, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00030000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x1F000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0x1FFFFFFF,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0x00000FFF, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0xFFFF0000, 0x3FFFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFFFFFFFF,
		0xFFFFFFFF, 0x007FFFFF, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x0003FFFF, 0x00000000,
		0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFFFFF, 0x0003FFFF, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000,
		0xFFFFFFFF, 0x00001FFF, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0x7FFFFFFF, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x000000FF, 0x00000000, 0x00000000, 0x00000000,
		0xFFFFFF00, 0x001FFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0x0000007F,
		0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000007F, 0x00000000, 0x00000000,
		0x00000000, 0x00FFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x003FFF00, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0x000FFFFF, 0x00000000, 0x00000000,
		0x00000000, 0xFF000000, 0x000000FF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0x00007FFF, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x01FF0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x001FFFFF, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0x0007FFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0xFFFF0000, 0xFFFFFFFF, 0x01FFFFFF, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0x01FFFFFF, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000001F, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0FFF0000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x01FFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000300,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000F0000, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x03000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
		0x0000007F, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000FF00, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0x0001FFFF, 0x00000000, 0x00000000, 0x00000000,
		0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000003, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF,
		0xFFFFFFFF, 0x00000FFF, 0x00000000, 0x00000000, 0xFFFFFF00, 0x00FFFFFF, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0xFFFF0000, 0x1FFFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0x00FFFFFF,
		0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x001FFFFF, 0x00000000, 0x00000000, 0x00000000,
		0x00000000, 0x00000000, 0x000FFF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFF0000,
		0xFFFFFFFF, 0x000000FF, 0x00000000, 0x00000000, 0x00000000, 0x01000000
	};
	return ((soundid >= 0) && ((soundid / 32) < sizeof (audiodat)) && (audiodat[soundid / 32] & (1 << (soundid % 32))));
}
Just look at the usage time:
Code:
IsValidSoundSlow time: 225 ms
IsValidSound time: 11 ms
There is no any special benchmark code, i only used code to loop from 0 to 45400 to compare the times.

Note about "dat": you can store the audiodat[] array with fblockwrite and load it with fblockread if you want it to be more flexible, the file is attached below...
Attached Files
File Type: zip samp-audio.zip (621 Bytes, 2 views)
__________________
Need Help? Use Search, WIKI, and FAQ

Last edited by RoboN1X; 26/04/2019 at 03:05 PM.
RoboN1X is offline   Reply With Quote
Old 05/05/2019, 04:12 PM   #4003
OstGot
Gangsta
 
OstGot's Avatar
 
Join Date: Mar 2013
Location: Gomel, Belarus
Posts: 832
Reputation: 325
Default Re: Useful Functions

Simple and fast trimspaces function

PHP Code:
trimspaces(string[])
{
    new 
c;
    for(new 
istring[i] != '\0'; ++i)
    {
        if(
string[i] == ' ') continue;
        
string[c] = string[i];
        
c++;
    }
    
string[c] = EOS;
    return 
1//or you can return 'c' to get new string length after space removing

Where it can be used (code example):
PHP Code:
new string[] = "I love it!";
trimspaces(string);
printf("String 'I love it!' without spaces: '%s'"); 
Output:
HTML Code:
String 'I love it!' without spaces: 'Iloveit!'
Another example:
PHP Code:
new string[] = "[[               Header               ]]";
trimspaces(string);
printf("String '[[               Header               ]]' without spaces: '%s'"); 
Output:
HTML Code:
String '[[               Header               ]]' without spaces: '[[Header]]'
This function is faster than removing every space via strdel in case you have not very long string with a lot of spaces in it.
__________________
aka Nexius
Don't want to always check for updates of my scripts?
Include it the last, after all others
Nexius's Update Checker
OstGot is offline   Reply With Quote
Old 24/05/2019, 03:48 PM   #4004
Zorono
Huge Clucker
 
Join Date: Dec 2015
Location: Africa, Egypt, Alexandria
Posts: 348
Reputation: 30
Default Re: Useful Functions

Saving it for later use...
Code:
IsPlayerInWater(playerid)
{
    new lib[16], anims[32];
    GetAnimationName(GetPlayerAnimationIndex(playerid), lib, sizeof(lib), anims, sizeof(anims));
	if(!isnull(lib) && !strcmp(lib, "SWIM")) return 1;
    switch(GetPlayerAnimationIndex(playerid))
	{
	   case 1538..1542,1544,1250,1062: return 1;
	   default: return 0;
	}
    return 0;
}
IsPlayerAiming(playerid)
{
	switch(GetPlayerAnimationIndex(playerid))
	{
	   case 1160..1163,1167,1365,1643,1453,220: return 1;
	   default: return 0;
	}
 	return 0;
}
IsPlayerFalling(playerid)
{
    return (GetPlayerAnimationIndex(playerid) == 1195 || GetPlayerAnimationIndex(playerid) == 1197 || GetPlayerAnimationIndex(playerid) == 1133 || GetPlayerAnimationIndex(playerid) == 1130);
}
__________________
Zorono is offline   Reply With Quote
Old 02/07/2019, 04:05 PM   #4005
OstGot
Gangsta
 
OstGot's Avatar
 
Join Date: Mar 2013
Location: Gomel, Belarus
Posts: 832
Reputation: 325
Default Re: Useful Functions

Some useful vehicle functions (adapted to pawn from mta wiki):

IsVehicleLockable
Code:
IsVehicleLockable(modelid)
{
	switch(modelid)
	{
		case 425, 430, 435, 441, 446, 448, 450, 452..454, 461..465, 468, 472, 473, 481, 484, 493,
		501, 509, 510, 520..522, 539, 564, 581, 584, 586, 591, 594, 595, 606, 607, 608, 611: return 0;
	}
	return 1;
}
IsVehicleWithNumberPlate
Code:
IsVehicleWithNumberPlate(modelid)
{
	switch(modelid)
	{
		case 417, 425, 430, 446, 447, 452..454, 460, 469, 472, 473, 476, 481, 484,
		487, 488, 493, 497, 509..513, 519, 520, 548, 553, 563, 577, 592, 593, 595: return 0;
	}
	return 1;
}
IsVehicleWithThreePaintColors
Code:
IsVehicleWithThreePaintColors(modelid)
{
	switch(modelid)
	{
		case 446, 483, 524: return 1;
	}
	return 0;
}
__________________
aka Nexius
Don't want to always check for updates of my scripts?
Include it the last, after all others
Nexius's Update Checker
OstGot is offline   Reply With Quote
Old 31/07/2019, 10:53 AM   #4006
PemburuHantu
Big Clucker
 
PemburuHantu's Avatar
 
Join Date: May 2019
Location: Indonesia ( Gorontalo )
Posts: 71
Reputation: 0
Default Re: Useful Functions

hmmm and how can i auto unfreeze target id
I make admin msg system and in this system if player receive message as warn from admin the target id is freeze and auto unfreeze for 5 second. How can i make it ?
PemburuHantu is offline   Reply With Quote
Old 03/08/2019, 11:18 PM   #4007
B3x7K
Big Clucker
 
B3x7K's Avatar
 
Join Date: Aug 2017
Location: 惑星黒トカゲ
Posts: 68
Reputation: 3
Default Re: Useful Functions

Quote:
Originally Posted by PemburuHantu View Post
hmmm and how can i auto unfreeze target id
I make admin msg system and in this system if player receive message as warn from admin the target id is freeze and auto unfreeze for 5 second. How can i make it ?

This is not a place if you want to ask something, you better go to => https://forum.sa-mp.com/forumdisplay.php?f=12, maybe someone can answer your question.
__________________

HOW TO ENGLISH?!
AAAAAAAAAAAAAAAA

B3x7K is offline   Reply With Quote
Old 03/08/2019, 11:22 PM   #4008
B3x7K
Big Clucker
 
B3x7K's Avatar
 
Join Date: Aug 2017
Location: 惑星黒トカゲ
Posts: 68
Reputation: 3
Default Re: Useful Functions

sudo_start(playerid, targetid, const args[])
I got inspired on minecraft server which you can run any command to your selected target XD
But maybe it only work with zcmd or izcmd command. :\

PHP Code:
public start_sudo(playeridtargetid, const args[])
{
    if (!
args[0])
    {
        print(
"[SUDO ERROR]: string is empty!");
        return 
0;
    }
    new 
command[12], idxindex;

    
format(commandsizeof(command), "%s"ReturnCommand(playeridargs));
    
format(commandsizeof(command), "cmd_%s"command[1]);

    
index GetPVarInt(playerid"extracted_cmd");
    
idx CallRemoteFunction(command"is"targetidargs[++index]);

    
SetPVarInt(playerid"extracted_cmd"0);

    if (!
idx)
    {
        print(
"[SUDO ERROR]: are you sure, you are using zcmd command?! or the command is invalid");
        return 
0;
    }
    return 
1;
}

ReturnCommand(playerid, const string[])
{
    new 
extracted[24], index;

    
index strfind(string" "true);

    
SetPVarInt(playerid"extracted_cmd"index);
    
strmid(extractedstring0index); 
 
    return 
extracted;

__________________

HOW TO ENGLISH?!
AAAAAAAAAAAAAAAA

B3x7K is offline   Reply With Quote
Old 25/08/2019, 05:02 PM   #4009
OstGot
Gangsta
 
OstGot's Avatar
 
Join Date: Mar 2013
Location: Gomel, Belarus
Posts: 832
Reputation: 325
Default Re: Useful Functions

I tried to re-implementing the removed AttachPlayerObjectToPlayer function in pawn powered by Pawn.RakNet's RPC sending feature and it seems to work.

Dependencies: Pawn.RakNet

PHP Code:
stock fix_AttachPlayerObjectToPlayer(playeridobjectidattachtoidFloat:OffsetXFloat:OffsetYFloat:OffsetZFloat:rXFloat:rYFloat:rZ)
{
    if(!
IsPlayerConnected(playerid) || !IsValidPlayerObject(playeridobjectid) || !IsPlayerConnected(attachtoid)) return 0;
    new 
BitStream:bs BS_New();
    
BS_WriteValue(bsPR_UINT16objectidPR_UINT16attachtoidPR_FLOATOffsetXPR_FLOATOffsetYPR_FLOATOffsetZPR_FLOATrXPR_FLOATrYPR_FLOATrZ);
    
#if defined BS_SendRPC
        
BS_SendRPC(bsplayerid75);
    
#else
        
BS_RPC(bsplayerid75);
    
#endif
    
BS_Delete(bs);
    return 
1;
}

#if defined _ALS_AttachPlayerObjectToPlayer
    #undef AttachPlayerObjectToPlayer
#else
    #define _ALS_AttachPlayerObjectToPlayer
#endif
#define AttachPlayerObjectToPlayer fix_AttachPlayerObjectToPlayer 
Just use the original function name to call it (AttachPlayerObjectToPlayer) as it's already hooked.
__________________
aka Nexius
Don't want to always check for updates of my scripts?
Include it the last, after all others
Nexius's Update Checker
OstGot is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] [INC] LSF - Lorenc's Simple Functions (w/ gang/clan functions) Lorenc_ Includes 14 21/04/2018 04:06 AM
Functions? sciman001 Help Archive 7 19/03/2011 03:03 PM
How to get functions? Twain32 Help Archive 4 08/10/2010 07:37 PM
[Include] [INC] SA:MP New Functions 0.4a DKN ipsBruno Lançamentos/Releases 22 17/06/2010 08:38 AM
What this functions do? harrold Help Archive 2 08/05/2009 11:30 PM


All times are GMT. The time now is 01:47 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.