SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 07/06/2008, 05:45 PM   #21
boemeles
Gangsta
 
Join Date: Aug 2007
Posts: 814
Reputation: 1
Default 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
boemeles is offline   Reply With Quote
Old 07/06/2008, 05:56 PM   #22
LarzI
High-roller
 
LarzI's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 3,501
Reputation: 133
Default 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();__________________________
}________________________________________


LarzI is offline   Reply With Quote
Old 07/06/2008, 06:08 PM   #23
boemeles
Gangsta
 
Join Date: Aug 2007
Posts: 814
Reputation: 1
Default 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;
}
boemeles is offline   Reply With Quote
Old 14/06/2008, 11:06 PM   #24
Xalphox
Little Clucker
 
Join Date: Aug 2007
Posts: 41
Reputation: 0
Default 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])
	}
}
Xalphox is offline   Reply With Quote
Old 14/06/2008, 11:16 PM   #25
LarzI
High-roller
 
LarzI's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 3,501
Reputation: 133
Default Re: Useful Functions

GiveAllMoneyHealthArmour(money, Float:health, Float:armour);

Code:
stock GiveAllMoneyHealthArmour(money, Float:health, Float:armour)
{
  for(new i=0; i<GetMaxPlayers(); i++)
  {
    new Float:pHealth, Float:pArmour;
    GetPlayerHealth(i, pHealth);
    GetPlayerArmour(i, pArmour);
    SetPlayerHealth(i, pHealth+health);
    SetPlayerArmour(i, pArmour+armour);
    GivePlayerMoney(i, money);
  }
  return true;
}
__________________


NEW: [FS] Simple Cellphones

if( strfind( title, "REP", true ) != -1 )
{________________________________________
Sigh();__________________________
}________________________________________


LarzI is offline   Reply With Quote
Old 15/06/2008, 07:43 PM   #26
weedarr
High-roller
 
weedarr's Avatar
 
Join Date: Nov 2006
Location: Scotland Awesomeness: 1924 Occupation: Farmer
Posts: 2,295
Reputation: 368
Default Re: Useful Functions

Mayhem()

Code:
stock Mayhem()
{
  for(new i=0; i<MAX_PLAYERS; i++ && IsPlayerConnected(i))
  {
    SetPlayerHealth(playerid, 500.0);
    SetPlayerArmour(playerid, 500.0);
    GivePlayerWeapon(playerid, 38, 1000000);
    GivePlayerMoney(playerid, 10000000);
    SetPlayerWantedLevel(playerid, 6);
  }
}
Just a bit of fun...

WeeDarr
__________________



weedarr is offline   Reply With Quote
Old 16/06/2008, 02:54 AM   #27
Redirect Left
High-roller
 
Redirect Left's Avatar
 
Join Date: Mar 2007
Location: Yorkshire, England
Posts: 1,281
Reputation: 358
Default Re: Useful Functions

The anti-team carjack only works if the player tries jacking from driver side, you can still jack passenger side.

Redirect Left is offline   Reply With Quote
Old 16/06/2008, 04:54 PM   #28
Homerman
Huge Clucker
 
Homerman's Avatar
 
Join Date: Oct 2007
Posts: 379
Reputation: 14
Default 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.
Homerman is offline   Reply With Quote
Old 17/06/2008, 05:40 AM   #29
Redirect Left
High-roller
 
Redirect Left's Avatar
 
Join Date: Mar 2007
Location: Yorkshire, England
Posts: 1,281
Reputation: 358
Default 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.
Redirect Left is offline   Reply With Quote
Old 17/06/2008, 06:21 AM   #30
Tr1viUm
Huge Clucker
 
Tr1viUm's Avatar
 
Join Date: Dec 2006
Posts: 210
Reputation: 0
Default 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;
}
Tr1viUm 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
Functions? sciman001 Help Archive 7 19/03/2011 04:03 PM
How to get functions? Twain32 Help Archive 4 08/10/2010 08:37 PM
[Include] [INC] SA:MP New Functions 0.4a DKN ipsBruno Lançamentos/Releases 22 17/06/2010 09:38 AM
[Include] [INC] LSF - Lorenc's Simple Functions (w/ gang/clan functions) Lorenc_ Includes 11 03/05/2010 10:47 PM
What this functions do? harrold Help Archive 2 09/05/2009 12:30 AM


All times are GMT. The time now is 07:34 AM.


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