SA-MP Forums Archive
How to make natives? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make natives? (/showthread.php?tid=154561)



How to make natives? - NewTorran - 14.06.2010

Hi,

Well yeah the title pretty much says it all,
How can i make natives? If i try something like this:

pawn Код:
native SetInterior(playerid, interiorid);
It dosent do what its supposed to do
I have to end up using stock, So yeah.. How to use native?
I want this so incase i forgot what things to put it will show me.


Re: How to make natives? - DJDhan - 14.06.2010

Err Edit the includes?


Re: How to make natives? - NewTorran - 14.06.2010

Quote:
Originally Posted by DJDhan
Err Edit the includes?
Dont post if you dont know what im on about


Re: How to make natives? - Joe_ - 14.06.2010

I believe you use stock, then use 'native <function name'.


Re: How to make natives? - NewTorran - 14.06.2010

Quote:
Originally Posted by Joe_
I believe you use stock, then use 'native <function name'.
Are you sure?
Cause like a_samp is this:

pawn Код:
native print(const string[]);
native printf(const format[], {Float,_}:...);
native format(output[], len, const format[], {Float,_}:...);
native SendClientMessage(playerid, color, const message[]);
native SendClientMessageToAll(color, const message[]);
native SendPlayerMessageToPlayer(playerid, senderid, const message[]);
native SendPlayerMessageToAll(senderid, const message[]);
native SendDeathMessage(killer,killee,weapon);
native GameTextForAll(const string[],time,style);
native GameTextForPlayer(playerid,const string[],time,style);
native SetTimer(funcname[], interval, repeating);
native SetTimerEx(funcname[], interval, repeating, const format[], {Float,_}:...);
native KillTimer(timerid);
native GetTickCount();
native GetMaxPlayers();
native CallRemoteFunction(const function[], const format[], {Float,_}:...);
native CallLocalFunction(const function[], const format[], {Float,_}:...);
native Float:asin(Float:value);
native Float:acos(Float:value);
native Float:atan(Float:value);
native Float:atan2(Float:x, Float:y);
But i tried making stock and native but it brung errors, Symbol already defined


Re: How to make natives? - DJDhan - 14.06.2010

Dude, I posted coz I knew what you wanted to do. I thought maybe you can edit the a_samp include file and add your function there. But nevermind.


Re: How to make natives? - Joe_ - 14.06.2010

It's just like that because the functions are not in the includes (SA-MP Stuff, idk)

Maybe it's

pawn Код:
native myfunction(playerid, text[]);

myfunction(playerid, text[])
{
SendClientMessage(playerid, red, text);
return 1;
}
Without the 'stock'.


Re: How to make natives? - NewTorran - 14.06.2010

Quote:
Originally Posted by Joe_
It's just like that because the functions are not in the includes (SA-MP Stuff, idk)

Maybe it's

pawn Код:
native myfunction(playerid, text[]);

myfunction(playerid, text[])
{
SendClientMessage(playerid, red, text);
return 1;
}
Without the 'stock'.
E:\My Server\Server\pawno\include\a_func.inc(5) : error 021: symbol already defined: "SetInterior"
E:\My Server\Server\pawno\include\a_func.inc(9) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.


Re: How to make natives? - Joe_ - 14.06.2010

pawn Код:
native SetInterior(playerid, Interior);

stock SetInterior(playerid, interior)
{
SetPlayerInterior(playerid, interior);
return 1;
}
Should work... I've never used the native stuff, sorry if I'm no help.


Re: How to make natives? - DJDhan - 14.06.2010

I tried Joe_'s code and put it in a new script and here's what I found.
1) If i put the code in the part of code between #if defined FILTERSCRIPT and #else, it gives no errors but it also doesn't show you what parameters to put in in-case you forget.
2) If you put it outside the #endif, you get the two errors

Quote:

E:\My Server\Server\pawno\include\a_func.inc(5) : error 021: symbol already defined: "SetInterior"
E:\My Server\Server\pawno\include\a_func.inc(9) : error 010: invalid function or declaration
/sarcasm