SA-MP Forums Useful Functions
 New Account Members List Search Today's Posts Mark Forums Read

07/06/2008, 04:45 PM   #21
boemeles
Gangsta

Join Date: Aug 2007
Posts: 814
Reputation: 1
Re: Useful Functions

Quote:
 Originally Posted by WeeDarr http://web.archive.org/web/200702250...hp?topic=638.0 Latest archive of the usefull functions topic. I suggest you add to the first post. WeeDarr
pages 5 / 8 are not archived... its anice idea to add it though

 07/06/2008, 04:56 PM #22 LarzI High-roller     Join Date: Apr 2007 Location: Norway Posts: 3,499 Reputation: 136 Re: Useful Functions We had soo many useful functions, why did it have to fuck up?? Thanks for the link WeeDarr __________________ NEW: [FS] Simple Cellphones if( strfind( title, "REP", true ) != -1 ) {________________________________________ Sigh();__________________________ }________________________________________
 07/06/2008, 05:08 PM #23 boemeles Gangsta   Join Date: Aug 2007 Posts: 814 Reputation: 1 Re: Useful Functions Lets get back to Useful Functions? i kinda needed this, so i made it... IsValidSound(soundid) Code: ```stock IsValidSound(soundid) { new Sounds[] = { 1002, 1009, 1027, 1035, 1036, 1039, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1062, 1063, 1068, 1069, 1076, 1077, 1083, 1084, 1085, 1097, 1098, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1153, 1154, 1163, 1165, 1166, 1169, 1183, 1184, 1185, 1186, 1187, 1188 }; for(new i = 0; i < sizeof(Sounds); i++) { if(soundid == i) return 1; } return 0; }```
 14/06/2008, 10:06 PM #24 Xalphox Little Clucker   Join Date: Aug 2007 Posts: 41 Reputation: 0 Re: Useful Functions RemovePlayerWeapon(playerid, weaponid): Code: ```RemovePlayerWeapon(playerid, weaponid) { new plyWeapons[12] new plyAmmo[12] for(new slot = 0; slot != 12; slot++) { new wep, ammo GetPlayerWeaponData(playerid, slot, wep, ammo) if(wep != weaponid) { GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]) } } ResetPlayerWeapons(playerid) for(new slot = 0; slot != 12; slot++) { GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot]) } }```
 14/06/2008, 10:16 PM #25 LarzI High-roller     Join Date: Apr 2007 Location: Norway Posts: 3,499 Reputation: 136 Re: Useful Functions GiveAllMoneyHealthArmour(money, Float:health, Float:armour); Code: ```stock GiveAllMoneyHealthArmour(money, Float:health, Float:armour) { for(new i=0; i
 15/06/2008, 06:43 PM #26 weedarr High-roller     Join Date: Nov 2006 Location: Scotland Awesomeness: 1924 Occupation: Farmer Posts: 2,295 Reputation: 368 Re: Useful Functions Mayhem() Code: ```stock Mayhem() { for(new i=0; i
 16/06/2008, 01:54 AM #27 Redirect Left High-roller     Join Date: Mar 2007 Location: Yorkshire, England Posts: 1,306 Reputation: 362 Re: Useful Functions The anti-team carjack only works if the player tries jacking from driver side, you can still jack passenger side.
 16/06/2008, 03:54 PM #28 Homerman Huge Clucker     Join Date: Oct 2007 Posts: 378 Reputation: 14 Re: Useful Functions Some checking - You have a command, and just use: if(!CheckValidWeather(weatherid)) { SendClientMessage(playerid,COLOUR_***,"[ ! ] Invalid weather ID!"); return 1; } or other Checks... So: Code: ```stock CheckValidWeapon(wepid) { if (wepid > 0 && wepid< 19 || wepid > 21 && wepid < 47) { return 1; } return 0; } stock CheckValidWeather(wid) { if (wid > 0 && wid < 50) { return 1; } return 0; } stock CheckValidTime(timeid) { if (timeid > 1 && timeid < 24) { return 1; } return 0; } stock CheckValidSkin(playerid,SkinID) { if((SkinID == 0)||(SkinID == 7)||(SkinID >= 9 && SkinID <= 41)||(SkinID >= 43 && SkinID <= 64)||(SkinID >= 66 && SkinID <= 73)||(SkinID >= 75 && SkinID <= 85)||(SkinID >= 87 && SkinID <= 118)||(SkinID >= 120 && SkinID <= 148)||(SkinID >= 150 && SkinID <= 207)||(SkinID >= 209 && SkinID <= 264)||(SkinID >= 274 && SkinID <= 288)||(SkinID >= 290 && SkinID <= 299)) { return 1; } return 0; }``` Useful because if player get weather 50, he will get "matrix" and he see s***, time 25 and bigger can shut down ure server... Skins - If player get bigger skin as 299, it will crash all players... __________________ I am not scripting gamemodes anymore, though if you'd like to see something created by me, I am currently running a webcomic and meme site. You can check it if you want and support me with a ******** like/Retweet/******+ recommendation, I would really appreciate it. Thanks a lot! You may also help me by donating via PayPal.
17/06/2008, 04:40 AM   #29
Redirect Left
High-roller

Join Date: Mar 2007
Location: Yorkshire, England
Posts: 1,306
Reputation: 362
Re: Useful Functions

Quote:
Originally Posted by -Seif-
Quote:
 Originally Posted by [RP Jolteon ] The anti-team carjack only works if the player tries jacking from driver side, you can still jack passenger side.
Lol Jolt... You can't jack someone from the passenger seat, heh. Though it'd be cool if it was possible but it isn't, it's only driver's seat.
Stand at the passenger side of the car, press enter, you jack the car, like you do in SP, thats what I meant, I've managed to do it when I was testing this function.
See this, very bad demomstration, look closely, there are two people in the car, one is just getting out, the other jacked from the passenger side: http://www.easytohide.info/imagehost...c8rbxxv9is.png
The name tag for [RP]HeaT_Taylor is where the other person jacked from.

 17/06/2008, 05:21 AM #30 Tr1viUm Huge Clucker     Join Date: Dec 2006 Posts: 210 Reputation: 0 Re: Useful Functions IsAnyTrailerAttachedToVehicle Returns 1 when a trailer is attacked to the vehicle, 0 otherwise. Code: ```IsAnyTrailerAttachedToVehicle(vehicleid) { new trailerid = GetVehicleTrailer(vehicleid); new modelid = GetVehicleModel(trailerid); if(modelid == 435 || modelid == 450 || modelid == 591 || modelid == 606 || modelid == 607 || modelid == 610 || modelid == 569 || modelid == 590 || modelid == 584 || modelid == 570 || modelid == 608 || modelid == 611) return true; return false; }``` GetPlayersInVehicle This function simpely returns the amount players in a vehicle. (0 if it is empty) Code: ```GetPlayersInVehicle(vehicleid) { new amount = 0; for(new i = 0; i < GetMaxPlayers(); i++) { if(!IsPlayerConnected(i) || !IsPlayerInVehicle(i,vehicleid)) continue; amount++; } return amount; }```

 Thread Tools Display Modes Linear Mode

 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 Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Lorenc_ Includes 14 21/04/2018 04:06 AM sciman001 Help Archive 7 19/03/2011 03:03 PM 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 harrold Help Archive 2 08/05/2009 11:30 PM

All times are GMT. The time now is 05:50 PM.

 -- (EN) English -- (RU) Русски Contact Us - SA-MP - Archive - Top