Raised This Month: $12 Target: $400
 3% 

Help Optimize This Code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AvaStIn
Senior Member
Join Date: Feb 2013
Location: Algeria
Old 09-27-2014 , 09:58   Help Optimize This Code
Reply With Quote #1

Hey everyone I would like to optimize this code or find another way cuz I think its using maths more than pawn...
__________________
Project : Speedrun / Fastrun / CrazySpeed & [FPS CATEGORY]

o [
||||||||||||||||||||] - 95%

Project : Upgraded Drshop To V6.0

o [||||||||||||||||||||]- 100%

Last edited by AvaStIn; 10-08-2014 at 16:52. Reason: Mistakes of typing
AvaStIn is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-27-2014 , 10:43   Re: Help Optimize This Code
Reply With Quote #2

Please explain what you want to do.
__________________

Last edited by HamletEagle; 09-27-2014 at 10:43.
HamletEagle is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 09-27-2014 , 11:20   Re: Help Optimize This Code
Reply With Quote #3

PHP Code:
public rgid )
{
  
pev(idpev_originorigin2)
  new 
Float:Dx[1], Float:Dy[1]
  
Dx[0] = origin2[0] - origin[0]
  
Dy[0] = origin2[1] - origin[1]
  
  new 
dir Dx[0]*Dx[0] < Dy[0]*Dy[0]
  
  
client_print(idprint_chat"Moving In %s' %s"dir"YY":"XX"origin2[dir]<origin[dir]?"--":"++")

__________________
Impossible is Nothing
Sylwester is offline
AvaStIn
Senior Member
Join Date: Feb 2013
Location: Algeria
Old 09-27-2014 , 14:44   Re: Help Optimize This Code
Reply With Quote #4

Quote:
Originally Posted by Sylwester View Post
PHP Code:
public rgid )
{
  
pev(idpev_originorigin2)
  new 
Float:Dx[1], Float:Dy[1]
  
Dx[0] = origin2[0] - origin[0]
  
Dy[0] = origin2[1] - origin[1]
  
  new 
dir Dx[0]*Dx[0] < Dy[0]*Dy[0]
  
  
client_print(idprint_chat"Moving In %s' %s"dir"YY":"XX"origin2[dir]<origin[dir]?"--":"++")

Thx everyone this one works perfectly
__________________
Project : Speedrun / Fastrun / CrazySpeed & [FPS CATEGORY]

o [
||||||||||||||||||||] - 95%

Project : Upgraded Drshop To V6.0

o [||||||||||||||||||||]- 100%

Last edited by AvaStIn; 10-08-2014 at 16:51. Reason: Useless details
AvaStIn is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 09-27-2014 , 15:35   Re: Help Optimize This Code
Reply With Quote #5

PHP Code:
speed[dir] +=  (_:(origin2[dir] > origin[dir]) - 1) * 3.0 
__________________
Impossible is Nothing
Sylwester is offline
AvaStIn
Senior Member
Join Date: Feb 2013
Location: Algeria
Old 09-27-2014 , 16:41   Re: Help Optimize This Code
Reply With Quote #6

Quote:
Originally Posted by Sylwester View Post
PHP Code:
speed[dir] +=  (_:(origin2[dir] > origin[dir]) - 1) * 3.0 
Woow works great thx for everything ,i know i asked too much but in case i wanted to change 3.0 to 5.0 for exmple ? Do i have to change anything else??
__________________
Project : Speedrun / Fastrun / CrazySpeed & [FPS CATEGORY]

o [
||||||||||||||||||||] - 95%

Project : Upgraded Drshop To V6.0

o [||||||||||||||||||||]- 100%
AvaStIn is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 09-27-2014 , 16:50   Re: Help Optimize This Code
Reply With Quote #7

no
__________________
Impossible is Nothing
Sylwester is offline
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

Forum Jump


All times are GMT -4. The time now is 08:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode