Quote:
Originally Posted by Oshizu
I'm trying to add attribute to player using signature
CTFPlayer::AddPlayerAttribute(CEconItemAttrib ute *)
but i'm not sure what value i'm suppose to add or how it should look like
PHP Code:
#include <sourcemod> #include <sdktools> new Handle:hGameConf; new Handle:hGiveAttribute;
public Plugin:myinfo = { name = "[TF2] Attribute Add", author = "Oshizu", description = "Test", version = "0.1d", url = "none" }; public OnPluginStart() {
hGameConf = LoadGameConfigFile("oshizu.attribute"); StartPrepSDKCall(SDKCall_Player); PrepSDKCall_SetFromConf(hGameConf, SDKConf_Signature, "CTFPlayer::AddPlayerAttribute"); PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain); hGiveAttribute = EndPrepSDKCall(); RegConsoleCmd("sm_maxhealth", SetMaxHealth); }
public Action:SetMaxHealth(client, args) { SDKCall(hGiveAttribute, client, "26 500.0"); }
Gamedata
PHP Code:
"Games" { /* Team Fortress 2 */ "tf" { "Signatures" { "CTFPlayer::AddPlayerAttribute" { "library" "server" "windows" "\x55\x8B\xEC\x8B\x45\x08\x85\xC0\x74\x2A\x50\x81\xC1\x04\x0A\x00\x00" "linux" "@_ZN9CTFPlayer18AddPlayerAttributeEP18CEconItemAttribute" "mac" "@_ZN9CTFPlayer18AddPlayerAttributeEP18CEconItemAttribute" } } } }
Seems to crash my server. Probatly line 'SDKCall(hGiveAttribute, client, "26 500.0");' is incorrectly made.
|
You can't use that function in an SDKCall. If you look at the linux symbol, the function prototype is actually "CTFPlayer::AddPlayerAttribute(CEconItemAttri bute *)"
The reason that code is crashing your server is because you're trying to pass a string when the function is expecting a CEconItemAttribute* as the argument, which you cannot create in SourcePawn.