![]() |
Plugin crash...
Why does my plugin crashes when I use either globalvars_t->time, or globalvars_t->maxClients ? ? ?
I made a pointer to globalvars_t in my header file like so: float think_timer; globalvars_t *globals; when I use it in StartFrame() in my metamod plugin like so: if (timer < globals->time) { // do something } IT CRASHES: what is wrong ???:angry::angry::angry: |
Re: Plugin crash...
From the code you showed it seems that you are just using invalid pointer, it's normal to crash. You must give it proper value in h_export.cpp. Here is code sample from one "stub" metamod plugin:
Code:
//! Holds engine functionality callbacks Sinse I see that you don't have much expirience in C++ I will give you little example that is explained well, lets say that you already declared and initalized the gpGlobals pointer in h_export.cpp and after that you want to use it in other source file like for example "my_plugin_source.cpp". You must put this Code:
extern globalvars_t *gpGlobals; Here is code examples: globals.h file Code:
#include <extdll.h> Code:
#include "globals.h" Code:
#include "globals.h" |
All times are GMT +2. The time now is 16:42. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.