Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums



(Advanced Search)

Forum Statistics
» Members: 6,670
» Latest member: oncel
» Forum threads: 2,489
» Forum posts: 12,544

Full Statistics

Online Users
There are currently 162 online users.
» 0 Member(s) | 157 Guest(s)
Bing, Yandex, Google, Twitter

Latest Threads
SA-MP Bedwars (2026)
Forum: Advertisements
Last Post: Amjad
4 hours ago
» Replies: 0
» Views: 23
libsamp - samp.dll re-imp...
Forum: Programming
Last Post: Knogle
Yesterday, 09:21 PM
» Replies: 0
» Views: 27
[Lançamento] Spawn — IDE ...
Forum: Portuguese/Português
Last Post: Daniil Korochansky
Yesterday, 01:25 PM
» Replies: 0
» Views: 24
PawnPro 3.3.0 Released
Forum: Releases
Last Post: NullSablex
2026-06-21, 09:25 AM
» Replies: 0
» Views: 49
Introducing PST — A Commu...
Forum: Pawn Scripting
Last Post: Daniil Korochansky
2026-06-20, 04:14 PM
» Replies: 0
» Views: 52
FCNPC for open.mp - the c...
Forum: Plugins
Last Post: MauroRisi
2026-06-20, 12:28 AM
» Replies: 2
» Views: 203
omp_npc not working
Forum: Pawn Scripting
Last Post: MauroRisi
2026-06-20, 12:13 AM
» Replies: 0
» Views: 39
[Release] Spawn — IDE for...
Forum: Programming
Last Post: Daniil Korochansky
2026-06-16, 05:41 AM
» Replies: 1
» Views: 106
discord unban appeal - pa...
Forum: Chat
Last Post: edgy
2026-06-15, 01:50 PM
» Replies: 1
» Views: 131
🎮 [91.134.166.72:5555] Jo...
Forum: Advertisements
Last Post: tokofridonashvili_01
2026-06-14, 05:39 PM
» Replies: 0
» Views: 75

 
  Help
Posted by: Xylosjr - 2019-07-17, 05:19 AM - Forum: Pawn Scripting - Replies (1)


Hi, I'm new here and I want to learn how to program with mysql and connect a database


  Math: vertical viewing angle
Posted by: Freaksken - 2019-07-15, 08:18 PM - Forum: Pawn Scripting - Replies (4)

I have a system in which I've worked out the code for giving an NPC a horizontal viewing angle (left image). How would I achieve a similar result, but now for the vertical direction (right image)?
[Image: viewing_angle.png?raw=1]

Below is the code for the left image, for reference. This is a math question, thus the code isn't really necessary, but might help you understand the problem. Just ignore that the angles start from the NPC's center instead of his eyes, that's easy enough to fix. As you can see, the z-position is irrelevant for the horizontal viewing angle, but probably not for the vertical viewing angle (not sure).

PHP Code:
static bool:FAI_IsPlayerInAggroViewingAngle(playeridnpcid) {
    
// Get NPC position
    
new Float:xnFloat:ynFloat:zn;
    
FCNPC_GetPosition(npcidxnynzn);

    
// Get player position
    
new Float:xpFloat:ypFloat:zp;
    if(!
IsPlayerNPC(playerid)) {
        
GetPlayerPos(playeridxpypzp);
    } else {
        
FCNPC_GetPosition(playeridxpypzp);
    }

    
// Calculate the angle between these 2 points
    
new Float:angleBetweenPoints atan2(xp xnyp yn);

    
// Get the NPC facing angle adjusted for the weird GTA angle system
    
new Float:npcFacingAngle 360.0 FCNPC_GetAngle(npcid);

    
// Calculate the smallest difference between these 2 angles as a value between -180.0 and 180.0
    
new Float:angleDifference angleBetweenPoints npcFacingAngle;
    if(
angleDifference 180.0) {
        
angleDifference -= 360.0;
    }
    if(
angleDifference < -180.0) {
        
angleDifference 360.0;
    }

    
// Get the absolute value of this angle
    
angleDifference floatabs(angleDifference);

    
// Check if the player is within the aggro viewing angle
    
if(angleDifference <= FAI_NPCs[npcid][FAI_NPC_AGGRO_VIEWING_ANGLE][playerid]/2) {
        return 
true;
    }
    return 
false;


Here's another visualisation of what the result should look like:
[Image: viewing_angle2.png?raw=1]


  Discord server
Posted by: RogueDrifter - 2019-07-15, 12:06 AM - Forum: Chat - Replies (4)

Unban roguedrifter from the discord server :sadface:


  A weird problem with includes
Posted by: mouiz - 2019-07-14, 01:00 PM - Forum: Pawn Scripting - Replies (7)

Quote:#include <../../gamemodes/modes/mode_robbery.pwn>

#include <../../gamemodes/modes/mode_dogfight.pwn>



These are ^ two includes in the 'gamemodes/modes' folder.





If i arrange them like this:?



Quote:#include <../../gamemodes/modes/mode_dogfight.pwn>

#include <../../gamemodes/modes/mode_robbery.pwn>



the 'mode_dogfight' works (gets included)?and the second one is ignored (it shows undefined symbol errors since the definitions of the functions are in the include)



If i arrange them oppositely then the 'mode_robbery' works, the second one is ignore.



How can i fix this?


  Pizza preferita?
Posted by: [SF]kAn3 - 2019-07-14, 01:59 AM - Forum: Italian/Italiano - Replies (2)

Beh almeno possiamo parlarne!

La mia in assoluto ? la 4 formaggi

Anche se puzza, ci piace?



E voi?


  This forum makes me be fat
Posted by: [SF]kAn3 - 2019-07-14, 01:12 AM - Forum: Chat - Replies (10)

When I read burgershot and see the burger I feel very hungry


  Include files should support "#pragma once"
Posted by: Aerotactics - 2019-07-13, 11:04 PM - Forum: Questions and Suggestions - Replies (1)

Instead of IFDEFINED, ELSE, ENDIF, etc. Include files should support a simple "#PRAGMA once" so that is only loaded once.


  Van m?g rem?nye a SA-MP K?z?ss?gnek?
Posted by: Mortyka - 2019-07-13, 06:53 PM - Forum: Hungarian/Magyar - Replies (3)

a k?rd?s adott


  Modding support?
Posted by: J_esus - 2019-07-12, 02:21 PM - Forum: Questions and Suggestions - Replies (1)

Ehn ...



Will a new "kdff" be made?


  What would you start?
Posted by: mouiz - 2019-07-12, 07:42 AM - Forum: Life - Replies (5)

If you had 100-500$ to start something profitable, what would it be ? Take it as a challenge ..