SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 21/12/2008, 10:46 AM   #171
Nero_3D
High-roller
 
Nero_3D's Avatar
 
Join Date: Jun 2007
Location: Germany
Posts: 2,836
Reputation: 671
Default Re: Useful Functions

Quote:
Originally Posted by Y_Leѕѕ
Quote:
Originally Posted by LarzI aka. GloZzy
I've also tried my code out, and it's actually working...
Only in the very limited tests which you did. Remember - a successful test doesn't prove an absence of bugs, just fails to prove the presence of bugs. I'm telling you there's a bug just from looking at the code, the fact that it didn't show up in tests just proves your testing is inadequate.
Oh ye your are right, yesterday I didnt noticed XD but now (after looking again) I see it too :S
Nero_3D is offline   Reply With Quote
Old 21/12/2008, 05:48 PM   #172
LarzI
High-roller
 
LarzI's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 2,628
Reputation: 136
Default Re: Useful Functions

I never said there wasn't anything wrong with it, but for the things I made it for, it works.

But, please tell me what's wrong/should be different
__________________


NEW: [FS] Simple Cellphones

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


LarzI is offline   Reply With Quote
Old 21/12/2008, 05:59 PM   #173
Nero_3D
High-roller
 
Nero_3D's Avatar
 
Join Date: Jun 2007
Location: Germany
Posts: 2,836
Reputation: 671
Default Re: Useful Functions

1. You have only one variable defined as a textdraw
2. You always create a new textdraw and save the id in the variable
3. You destroy the textdraw saved in the variable after some seconds

But what will happend if you use the function a second time before the textdraw got destroyed ?
Answer: The variable will get overwriten and the oldtextdraw will stay + the new disapear earlier
Nero_3D is offline   Reply With Quote
Old 21/12/2008, 07:32 PM   #174
LarzI
High-roller
 
LarzI's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 2,628
Reputation: 136
Default Re: Useful Functions

Ok, thanks for telling me, but I won't fix it, I cba XD
__________________


NEW: [FS] Simple Cellphones

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


LarzI is offline   Reply With Quote
Old 21/12/2008, 07:58 PM   #175
domidom
Big Clucker
 
Join Date: Feb 2007
Posts: 177
Reputation: 15
Default Re: Useful Functions

Quote:
Originally Posted by LarzI aka. GloZzy
Ok, thanks for telling me, but I won't fix it, I cba XD
Is it 'I cba' or 'I c' (c obviously meaning 'cant')?
domidom is offline   Reply With Quote
Old 21/12/2008, 08:25 PM   #176
LarzI
High-roller
 
LarzI's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 2,628
Reputation: 136
Default Re: Useful Functions

cba is Can't Be Assed/bothered
__________________


NEW: [FS] Simple Cellphones

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


LarzI is offline   Reply With Quote
Old 29/12/2008, 05:42 PM   #177
kc
Gangsta
 
kc's Avatar
 
Join Date: Aug 2007
Posts: 618
Reputation: 115
Default Re: Useful Functions

Quote:
Originally Posted by Boylett
An exact copy of the function "rand" in PHP.

pawn Code:
rand(minnum = cellmin,maxnum = cellmax) return random(maxnum - minnum + 1) + minnum;
pawn Code:
#define rand(%1,%2) (random(%2 - %1 + 1) + %1)

not exact, but close enough =p
kc is offline   Reply With Quote
Old 04/01/2009, 11:19 PM   #178
LarzI
High-roller
 
LarzI's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 2,628
Reputation: 136
Default Re: Useful Functions

NOTE!: This is NOT tested by anyone, so it might won't work!

Credits to: Whoever made PlayerToPoint and Andre9977 for the style of posting a function

IsAtPoint(Float:radi, whatis[], id, Float, Float:y, Float:z)
Float:radi - Radius
whatis - Can be playerid, vehicleid or objectid
id - The ID of either playerid, vehicleid or objectid. Depends on what you entered in whatis
Float, Float:y, Float:z - The position we're checking player's/vehicle's/object's lenght from

pawn Code:
stock IsAtPoint(Float:radi, whatis, id, Float:x, Float:y, Float:z)
{
  new Float:oldposx, Float:oldposy, Float:oldposz;
  new Float:tempposx, Float:tempposy, Float:tempposz;
  if(whatis == playerid)
    GetPlayerPos(id, oldposx, oldposy, oldposz);
    else if(whatis == objectid
      GetObjectPos(id, oldposx, oldposy, oldposz);
    else if(whatis == vehicleid
      GetVehiclePos(id, oldposx, oldposy, oldposz);
    else
      return false;
  tempposx = (oldposx -x);
  tempposy = (oldposy -y);
  tempposz = (oldposz -z);
  if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  {
    return 1;
  }
  return 0;
}

Please if you test this, or just see it, tell me if this won't/doesn't work.
Then I'll just edit this post, without the code and all
__________________


NEW: [FS] Simple Cellphones

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


LarzI is offline   Reply With Quote
Old 04/01/2009, 11:26 PM   #179
Nero_3D
High-roller
 
Nero_3D's Avatar
 
Join Date: Jun 2007
Location: Germany
Posts: 2,836
Reputation: 671
Default Re: Useful Functions

LarzI this wont work

/Working on a fixed version/
Nero_3D is offline   Reply With Quote
Old 04/01/2009, 11:32 PM   #180
LarzI
High-roller
 
LarzI's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 2,628
Reputation: 136
Default Re: Useful Functions

Forgot to compile in an if statement, sorry for that...
And thanks for fixing it
__________________


NEW: [FS] Simple Cellphones

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


LarzI 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 05:06 AM
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
What this functions do? harrold Help Archive 2 09/05/2009 12:30 AM


All times are GMT. The time now is 12:52 PM.


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