[Tutorial] How to create a plugin
#41

Hi, II would do something like that, in gamemodzie gives:
Код:
native StartScript();
and every filterscripcie works:
Код:
public OnScriptInit()
//Edit

And how to take advantage of the MySQL plugin, for example, to retrieve the name of the item and return it.
Reply
#42

What are the c++ functions i can use
Reply
#43

Quote:
Originally Posted by [GF]Sasino97
Посмотреть сообщение
What are the c++ functions i can use
****** for it.

EDIT:
@Fj0rtizFredde:
Thanks, it's working with invoke.
Reply
#44

I tried, but I didn't find nothing.... I typed "How to make a sa-mp plugin"
Reply
#45

Quote:
Originally Posted by [GF]Sasino97
Посмотреть сообщение
I tried, but I didn't find nothing.... I typed "How to make a sa-mp plugin"
Well, I guess it's better for you to stick with PAWN... But if you really want to create something using C++ functions I'd recommend this site -> http://www.cplusplus.com/
Reply
#46

Thankyou !!
Reply
#47

I KNOW you might not answer, but I happen to get 2 errors, tried some fixing, but no success, I'm a newbie @ VS.

Код:
error C2065: 'MyNat' : undeclared identifier
error C2365: 'MyNat' : redefinition; previous definition was 'formerly unknown identifier'
code
Код:
static cell AMX_NATIVE_CALL MyNat(AMX *amx, cell *params)
{  
    logprintf("Test, test :p.");
    return 1;
}
and
Код:
AMX_NATIVE_INFO projectNatives[] =
{
   { "MyNat", MyNat }
};
Reply
#48

I have no idea why you get the error, but you shouldn't get it if you have done everything correctly. Just begin a new project and try again, should work!
Reply
#49

I was searching something like this about 2 weeks.

Thanks RyDeR`!

Edit: where i can read about amx functions or something ho can help in dev plugin.

Like ur

pawn Code:
int __IsPlayerConnected(int playerid, AMX *amx) // AMX *amx must stay but it's just the playerid parameter that counts in his function.
{
    int
        index
    ;
    if(!amx_FindPublic(amx, "__IsPlayerConnected", &index))
    {
        cell
            retVal
        ;
        amx_Push(amx, playerid);
        amx_Exec(amx, &retVal, index);
        return (int)retVal;
    }
    return -1;
}
Where i can find like __IsPlayerConnected or this like stock in pawn?
Reply
#50

Hello,

im back with a new question :S
but, when i use floats in pawno, it becomes a different value in C++..
like -2000 becomes about 300 billion.. i already used float() int() etc. but nothing helps..
how to uses floats in c++

Ty in advance!

Solved, use amx_ctof or amx_ftoc
Reply
#51

This tutorial is good, but the sdk seems to be a bit goofy, since the compiler complains about not finding amxplugin.h even after i choose to include all files. Tried with MS Visual C++ 2008
Reply
#52

There's no amxplugin.h in it, did you mean amx.h?
Reply
#53

No, my compiler asks for "amxplugin.h"

Will try to get around it by checking project settings and such
Reply
#54

error!!
Reply
#55

Awesome, thank you
Reply
#56

Quote:
Originally Posted by Mean
View Post
I KNOW you might not answer, but I happen to get 2 errors, tried some fixing, but no success, I'm a newbie @ VS.

Code:
error C2065: 'MyNat' : undeclared identifier
error C2365: 'MyNat' : redefinition; previous definition was 'formerly unknown identifier'
code
Code:
static cell AMX_NATIVE_CALL MyNat(AMX *amx, cell *params)
{  
    logprintf("Test, test :p.");
    return 1;
}
and
Code:
AMX_NATIVE_INFO projectNatives[] =
{
   { "MyNat", MyNat }
};
Put this:
pawn Code:
static cell AMX_NATIVE_CALL MyNat(AMX *amx, cell *params)
{  
    logprintf("Test, test :p.");
    return 1;
}
Before this:
pawn Code:
AMX_NATIVE_INFO projectNatives[] =
{
   { "MyNat", MyNat }
};
Reply
#57

1. I can't seem to get logprintf to work with a string for example
logprintf("%s",params[1]);
2. How do I make it say something when my plugin is loaded.
Reply
#58

You could use existing c++ libraries to write text to the console. Just a suggestion.

pawn Code:
#include <iostream>//at top

static cell AMX_NATIVE_CALL MyNat(AMX *amx, cell *params)
{  
    std::cout << "test " << params[1] << std::endl; // cout defined in iostream
    return 1;
}
Reply
#59

Awesome!!!
Reply
#60

Quote:
Originally Posted by 1337connor
View Post
1. I can't seem to get logprintf to work with a string for example
logprintf("%s",params[1]);
2. How do I make it say something when my plugin is loaded.
1. Of course it won't work. You have to use "amx_StrParam(amx, params[1], buffer);". After this the data in params 1 will be in buffer.
2. Put it under "PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData)"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)