Raised This Month: $51 Target: $400
 12% 

Solved How to get bools from other plugins?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Theon32
Member
Join Date: Sep 2018
Location: mvm_isolation_rc3
Old 04-29-2019 , 07:48   How to get bools from other plugins?
Reply With Quote #1

This may have been answered already, but I don't really understand.
How do I get a bool that looks like this?
PHP Code:
bool PlayerSpecificBool[MAXPLAYERS] = false
Sorry if this has been answered before.


Thanks!

Last edited by Theon32; 04-29-2019 at 21:25. Reason: Setting title to include [Solved] as a prefix.
Theon32 is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 04-29-2019 , 08:22   Re: How to get bools from other plugins?
Reply With Quote #2

Quote:
Originally Posted by Theon32 View Post
This may have been answered already, but I don't really understand.
How do I get a bool that looks like this?
PHP Code:
bool PlayerSpecificBool[MAXPLAYERS] = false
Sorry if this has been answered before.


Thanks!
https://wiki.alliedmods.net/Creating...eMod_Scripting)
__________________
8guawong is offline
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 04-29-2019 , 10:35   Re: How to get bools from other plugins?
Reply With Quote #3

Quote:
Originally Posted by 8guawong View Post
Fixed link, the last parenthesis didn't get put into it for some reason.

Last edited by CliptonHeist; 04-29-2019 at 10:36.
CliptonHeist is offline
Theon32
Member
Join Date: Sep 2018
Location: mvm_isolation_rc3
Old 04-29-2019 , 13:46   Re: How to get bools from other plugins?
Reply With Quote #4

Thanks! I'll try to look through this. I am a beginning coder and at this point, anything helps!
Theon32 is offline
Theon32
Member
Join Date: Sep 2018
Location: mvm_isolation_rc3
Old 04-29-2019 , 21:24   Re: How to get bools from other plugins?
Reply With Quote #5

Actually figured it out by looking at this post that I missed here:

Quote:
Originally Posted by Dr. McKay View Post
Plugin A:

PHP Code:
native MyPlugin_RetreiveValue();
native MyPlugin_RetreiveClientValue(client);

public 
Action:MyCallback(clientargs) {
    new 
myValue MyPlugin_RetreiveValue();
    new 
myClientValue MyPlugin_RetreiveClientValue(client);
    
ReplyToCommand(client"myValue: %d, myClientValue: %d"myValuemyClientValue);
    return 
Plugin_Handled;

Plugin B:

PHP Code:
new myValues[MAXPLAYERS 1];
new 
myValue;

public 
APLRes:AskPluginLoad2(Handle:myselfbool:lateString:error[], err_max) {
    
CreateNative("MyPlugin_RetreiveValue"Native_RetreiveValue
    CreateNative
("MyPlugin_RetreiveClientValue"Native_RetreiveClientValue);
    return 
APLRes_Success;
}

public 
Native_RetreiveValue(Handle:pluginnumParams) {
    return 
myValue;
}

public 
Native_RetreiveClientValue(Handle:pluginnumParams) {
    new 
client GetNativeCell(1);
    if(
client || client MaxClients || !IsClientInGame(client)) {
        
ThrowNativeError(SP_ERROR_INDEX"Client index %d is not valid or is not in game"client);
        return -
1;
    }
    return 
myValues[client];

I've provided an example of retrieving a simple global variable and an example of returning a client-specific global variable.
Thanks everyone!
Theon32 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:24.


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