AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Making a plugin from .inc (https://forums.alliedmods.net/showthread.php?t=299484)

RAW_192 07-16-2017 05:21

Making a plugin from .inc
 
PHP Code:

#if defined _levelsystem_included
    #endinput
#endif

#define _levelsystem_included

// Returns player Level.
native get_user_point(id)

// Sets player Level.
native set_user_point(idamount

This is my .inc

it does a simple task and thats assigning points to a player

I want to make a plugin for this .inc so that i can use it on servers .. Help please ?

eyal282 07-16-2017 05:59

Re: Making a plugin from .inc
 
Append every blue ( according to this very post ) colored line to your plugin outside of any publics.

DjSoftero 07-16-2017 08:03

Re: Making a plugin from .inc
 
please read this tutorial: https://forums.alliedmods.net/showthread.php?t=41251 before asking any questions, because it is very detailed and simple.
edit--
this might help you aswell: https://forums.alliedmods.net/showthread.php?t=46779

RAW_192 07-17-2017 12:10

Re: Making a plugin from .inc
 
Can i get a little more help here?

I did understand this [https://forums.alliedmods.net/showthread.php?t=41251]

But the thing is since it is a point system so

I will have to define a new global

and then set the parameters?

eyal282 07-17-2017 12:30

Re: Making a plugin from .inc
 
Quote:

Originally Posted by RAW_192 (Post 2535911)
Can i get a little more help here?

I did understand this [https://forums.alliedmods.net/showthread.php?t=41251]

But the thing is since it is a point system so

I will have to define a new global

and then set the parameters?

Check what I told you that you ignored. After you do it, natives will work.

DjSoftero 07-17-2017 12:51

Re: Making a plugin from .inc
 
Quote:

Originally Posted by eyal282 (Post 2535915)
Check what I told you that you ignored. After you do it, natives will work.

i`m pretty sure he created that inc file. it won`t magicaly save players xp and it wont have a magical way of knowing how much p to give per kill/death etc.

RAW, have you got the saving part done? or you just wrote a simple include file and want to know what to do next?
what global variable are you talking about? player_xp[] or smth?

HamletEagle 07-17-2017 12:59

Re: Making a plugin from .inc
 
What the above guy is asking is if you have the points system ready and:
a)you want to create an API for it to use in other plugin
b)you have the API and you want to use it in other plugin
c)you don't even have the points system and you want to build it from 0.

RAW_192 07-19-2017 12:44

Re: Making a plugin from .inc
 
Actually i have made some progress , But the issue is when i install this plugin , The server crashes

PHP Code:

public plugin_natives()
{
    
// Player natives //
    
register_native("get_user_point""native_get_user_point"1);
    
register_native("set_user_point""native_set_user_point"1);
}
public 
My_Point(id)
{
    if(!
is_user_alive(id) && is_user_connected(id))
        return 
PLUGIN_HANDLED;
        
    
client_print_color(idprint_chat"^4[%s] you have %d points."TAGg_iPoints[id])
    
    return 
PLUGIN_HANDLED
}
Load(id)
{   
    new 
szAuthId[32]; get_user_authid(idszAuthIdcharsmax(szAuthId));
    
    new 
szData[200], iTimeStamp;
    if(
nvault_lookup(g_iVaultszAuthIdszDatacharsmax(szData), iTimeStamp))
    {
              new 
szSavedname[32], szPoint[16];
              
parse(szDataszSavednamecharsmax(szSavedname), szPointcharsmax(szPoint))
              
remove_quotes(szSavedname)
              
remove_quotes(szPoint)
              
set_user_info(id"name"szSavedname)
              
g_iPoints[id] = str_to_num(szPoint)
     }
}
// Native: get_user_point
public native_get_user_point(id)
{
    return 
g_iPoints[id];
}

// Native: set_user_point
public native_set_user_point(idamount)

{
    
g_iPoints[id] = amount;



DjSoftero 07-19-2017 14:18

Re: Making a plugin from .inc
 
what does console say when you load plugin in debug mode?


All times are GMT -4. The time now is 23:10.

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