Raised This Month: $ Target: $400
 0% 

what is wrong?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
javalia
Senior Member
Join Date: May 2009
Location: korea, republic of
Old 02-02-2010 , 05:41   what is wrong?
Reply With Quote #1

i am using 1.3.0 ver of sourcemod and so i have tried to make this work
but i cant..

public Action:CommandWeld(client, args){

//인수로 받을 것들은 첫번째 웰드대상, 두번째 웰드 대상, 웰드엔티티이름, 통제시스템 엔티티
if(args == 3){

decl String:targetname1[256], String:targetname2[256], String:targetname3[256];

GetCmdArg(1, targetname1, sizeof(targetname1));
GetCmdArg(2, targetname2, sizeof(targetname2));
GetCmdArg(3, targetname3, sizeof(targetname3));

new constraint = EntRefToEntIndex(CreateEntityByName("phys_con straint"));

if(constraint != -1){

decl Float:clientposition[3];
GetClientAbsOrigin(client, clientposition);
new String:positionstring[128];
Format(positionstring, 128, "%f %f %f", clientposition[0], clientposition[1], clientposition[2]);
DispatchKeyValue(constraint,"Origin", positionstring);

DispatchKeyValue(constraint, "targetname", targetname3);
DispatchKeyValue(constraint, "attach1", targetname1);
DispatchKeyValue(constraint, "attach2", targetname2);
DispatchKeyValue(constraint, "forcelimit", "999999.99");
DispatchKeyValue(constraint, "torquelimit", "999999.99");
DispatchSpawn(constraint);
PrintToChat(client, "\x04웰드엔티티 %d 을 생성하고 타겟네임을 \"%s\"(으)로 설정했으며, 엔티티 \"%s\" (와)과 \"%s\" (을)를 웰드했습니다", constraint, targetname3, targetname1, targetname2);

}

}else if(args >= 4){

decl String:targetname1[256], String:targetname2[256], String:targetname3[256], String:targetname4[256];

GetCmdArg(1, targetname1, sizeof(targetname1));
GetCmdArg(2, targetname2, sizeof(targetname2));
GetCmdArg(3, targetname3, sizeof(targetname3));
GetCmdArg(4, targetname4, sizeof(targetname4));

new constraint = EntRefToEntIndex(CreateEntityByName("phys_con straint"));

if(constraint != -1){

decl Float:clientposition[3];
GetClientAbsOrigin(client, clientposition);
new String:positionstring[128];
Format(positionstring, 128, "%f %f %f", clientposition[0], clientposition[1], clientposition[2]);
DispatchKeyValue(constraint,"Origin", positionstring);

DispatchKeyValue(constraint, "targetname", targetname3);
DispatchKeyValue(constraint, "attach1", targetname1);
DispatchKeyValue(constraint, "attach2", targetname2);
DispatchKeyValue(constraint, "constraintsystem", targetname4);
DispatchKeyValue(constraint, "forcelimit", "999999.99");
DispatchKeyValue(constraint, "torquelimit", "999999.99");
DispatchSpawn(constraint);
PrintToChat(client, "\x04웰드엔티티 %d 을 생성하고 타겟네임을 \"%s\"(으)로 설정했으며, 엔티티 \"%s\" (와)과 \"%s\" (을)를 웰드하고 통제시스템 엔티티로 \"%s\" (을)를 설정했습니다", constraint, targetname3, targetname1, targetname2, targetname4);

}

}else{

ReplyToCommand(client, "사용법 : sm_웰드 <웰드대상> <웰드대상> <웰드엔티티타겟네임> [선택적]<통제시스템>");

}

return Plugin_Handled;

}

"phys_constraint" is logical entity.
and than why i cant make that work...
javalia is offline
Frus
Senior Member
Join Date: Aug 2009
Old 02-02-2010 , 10:06   Re: what is wrong?
Reply With Quote #2

Code:
new constraint = EntRefToEntIndex(CreateEntityByName("phys_constraint"));
CreateEntityByName returns an entity index, not an entity reference.
Frus is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 02-02-2010 , 12:47   Re: what is wrong?
Reply With Quote #3

Quote:
Originally Posted by Frus View Post
Code:
new constraint = EntRefToEntIndex(CreateEntityByName("phys_constraint"));
CreateEntityByName returns an entity index, not an entity reference.
Everything returns a reference if there can only be a reference.

The original poster is going to have to be more specific than "it doesn't work."
Fyren is offline
javalia
Senior Member
Join Date: May 2009
Location: korea, republic of
Old 02-02-2010 , 14:41   Re: what is wrong?
Reply With Quote #4

this is whole plugin..
help me...i am having hard day with this...
i am setting targetname of an entity by sm_타겟네임
and it was work very good
but
when using weld command as

!웰드 targetname1 targetname2 targetname_that_logicalentity_will_have


but it not works...
Attached Files
File Type: sp Get Plugin or Get Source (buildmod.sp - 277 views - 13.7 KB)
javalia is offline
javalia
Senior Member
Join Date: May 2009
Location: korea, republic of
Old 02-02-2010 , 23:07   Re: what is wrong?
Reply With Quote #5

help me! bumping...sorry but is someone can show me perfect working example code that working with logical entity?
javalia 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 04:56.


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