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

spawn objects/entities [Help]


Post New Thread Reply   
 
Thread Tools Display Modes
ajr1234
Senior Member
Join Date: Mar 2011
Location: Chicago, IL, U.S.A.
Old 02-16-2013 , 14:16   Re: spawn objects/entities [Code Revise REQ]
Reply With Quote #21

Quote:
Originally Posted by striker07 View Post
Both methods for arrays are very usefull, i prefer yours though becous its logic is not specifically sourcemod related and it could benefit me more in the future for other projects idk .
Actually, a dynamic container may benefit you more Valve uses dynamic containers all over the place (see CUtlVector). However, I find that static containers are easier to use in SourcePawn. Were I coding this plugin in c++, I would have used std::vector instead. Dynamic arrays, after optimization, can be fast-- with O(1) pushing back and O(log n) popping back. In SourcePawn however, there seems to be an overhead to it, so I always use static containers unless I really need dynamic ones.


Quote:
Originally Posted by striker07 View Post
an invalid edict id would not be a problem in all these stocks becous all possible entities are cached into the array? it would only retrieve a false result?
Because the entire array is initialized to zero (see the 'new' declaration in Pawn), we can be sure that the entire array at the start of the map is initialized to NO_ACTIVATOR (defined as zero). The stocks would then just return false.

Note that all the additions I have made are untested-- I wrote it on my jailbroken Ubuntu tablet

EDIT: see here - http://wiki.alliedmods.net/Introduct...wn#Declaration

Last edited by ajr1234; 02-16-2013 at 14:34.
ajr1234 is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 02-17-2013 , 14:58   Re: spawn objects/entities [Code Revised]
Reply With Quote #22

nice :p.

I do get a problem with making the entity, in both cs:s and cs:go.
for createentitybyname, can't i choose my own classname? do i have to choose one from this list?: https://developer.valvesoftware.com/...#Item_entities

This is my error message in console:
Code:
L 02/17/2013 - 20:47:25: "Nick<4><BOT><CT>" killed "Troy<6><BOT><TERRORIST>" with "usp" (headshot)
Attempted to create unknown entity type my_entity!
L 02/17/2013 - 20:47:25: [SM] Native "TeleportEntity" reported: NULL not allowed
L 02/17/2013 - 20:47:25: [SM] Displaying call stack trace for plugin "DDamagePerk2.smx":
L 02/17/2013 - 20:47:25: [SM] [0] Line 116, C:\Program Files (x86)\Sourcemod\SourcePawn\temp397.sp::CreateSomeEntity()
L 02/17/2013 - 20:47:25: [SM] [1] Line 108, C:\Program Files (x86)\Sourcemod\SourcePawn\temp397.sp::Event_PlayerDeath()
tryed both SetEntPropVector and teleportentity, it gives the same result

Spoiler
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]

Last edited by striker07; 02-17-2013 at 15:00.
striker07 is offline
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 02-17-2013 , 16:05   Re: spawn objects/entities [Code Revised]
Reply With Quote #23

Quote:
"my_entity"
???

https://developer.valvesoftware.com/...st_of_entities
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 02-17-2013 , 16:27   Re: spawn objects/entities [Code Revised]
Reply With Quote #24

Spoiler


EDIT 2:

Finally fixed the model now, but now it cant spawn becous the entity id created is wrong so i made an extra check to be sure.

-> Code:

L 02/18/2013 - 0299: "Henry<27><BOT><TERRORIST>" [-62 372 2] killed "Keith<29><BOT><CT>" [468 90 69] with "xm1014"
Attempted to create unknown entity type prop_static!
DEBUG ----> Invalid entity index -1
L 02/18/2013 - 029:43: "Bill<21><BOT><CT>" [




code: spawn ent block
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]

Last edited by striker07; 02-17-2013 at 20:48.
striker07 is offline
ajr1234
Senior Member
Join Date: Mar 2011
Location: Chicago, IL, U.S.A.
Old 02-17-2013 , 21:41   Re: spawn objects/entities [Code Revised]
Reply With Quote #25

Prop_static does not have an associated edict; use prop_dynamic instead.

EDIT: Try...

PHP Code:
CreateSomeEntity(Float:Origin[3]) 

    new 
entity CreateEntityByName("prop_dynamic"); 
 
    ...

    
// add before dispatchspawn() function
    
DispatchKeyValue(entity"Solid""6");
    
    
// move the following code to after dispatchspawn()
    
TeleportEntity(entityOriginNULL_VECTORNULL_VECTOR); 
    
SetEntityModel(entity"models/props/perk1c/perk1c.mdl"); 
    
SetEntityRenderMode(entityRENDER_TRANSCOLOR); 
    
SetEntityRenderFx(entityRENDERFX_PULSE_SLOW); 
    
SetEntityRenderColor(entity3119136160);

   ...
   
   
// no need to "return" anything (void)


Last edited by ajr1234; 02-17-2013 at 21:50.
ajr1234 is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 02-17-2013 , 21:59   Re: spawn objects/entities [Code Revised]
Reply With Quote #26

prop_dynamic crashes the server for both css and csgo.
changed the code abit again (removed plugin handled) and added a diffrent model but the game also sais its a bad model:
(with prop_static)
Code:
L 02/18/2013 - 03:40:22: ".:}O$G{:. ,.SkyHigH,<2><STEAM_1:1:4926290><TERRORIST>" [495 1323 32] killed "Eric<12><BOT><CT>" [657 1032 96] with "glock" (headshot)
Attempted to create unknown entity type prop_static!
DEBUG ----> Invalid entity index -1
L 02/18/2013 - 03:40:23: "Finn<17><BOT><TERRORIST>" threw hegrenade [-922 745 -181]
Attempting to precache model, but model name is NULL
L 02/18/2013 - 03:40:28: "Eric<12><BOT><CT>" purchased "m4a1"
csgo error with prop_dynamic:
Spoiler


cs:s with prop_dynamic:
Spoiler


tested alot of things out and none work been looking at it so long and just can't find the problem

EDIT:
Quote:
Originally Posted by ajr1234 View Post
PHP Code:
CreateSomeEntity(Float:Origin[3]) 

new 
entity CreateEntityByName("prop_dynamic"); 

...

// add before dispatchspawn() function
DispatchKeyValue(entity"Solid""6");

// move the following code to after dispatchspawn()
TeleportEntity(entityOriginNULL_VECTORNULL_VECTOR); 
SetEntityModel(entity"models/props/perk1c/perk1c.mdl"); 
SetEntityRenderMode(entityRENDER_TRANSCOLOR); 
SetEntityRenderFx(entityRENDERFX_PULSE_SLOW); 
SetEntityRenderColor(entity3119136160);

...

// no need to "return" anything (void)

server still crashes, gonna play around some more today try some new diffrent things
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]

Last edited by striker07; 02-18-2013 at 03:21.
striker07 is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 02-18-2013 , 03:20   Re: spawn objects/entities [Help]
Reply With Quote #27

Can you give us the newest version of the code you're using?
bl4nk is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 02-18-2013 , 05:15   Re: spawn objects/entities [Help]
Reply With Quote #28

Sure, i have 2 now, but the BETA one keeps giving me problems at compiling when passing a float array using datapack timer. tryed various methods.
Attached Files
File Type: sp Get Plugin or Get Source (DDamagePerk2BETA.sp - 142 views - 7.7 KB)
File Type: sp Get Plugin or Get Source (DDamagePerk2.sp - 295 views - 7.2 KB)
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]
striker07 is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 02-18-2013 , 06:10   Re: spawn objects/entities [Help]
Reply With Quote #29

For the beta version:

PHP Code:
        WritePackFloat(pacOrigin[0]);
        
WritePackFloat(pacOrigin[1]);
        
WritePackFloat(pacOrigin[2]);
...
    
Origin[0] = ReadPackFloat(pac);
    
Origin[1] = ReadPackFloat(pac);
    
Origin[2] = ReadPackFloat(pac); 
bl4nk is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 02-18-2013 , 06:47   Re: spawn objects/entities [Help]
Reply With Quote #30

Spoiler

Update:
Made a beta version with debug information, i got it to run and my server doesnt crash
but the model isnt being shown correctly or teleported correctly not sure it never gets touched neighter.
Also the visual effects are not visible :s.
Console logs:
Code:
L 02/18/2013 - 15:06:26: "Andy<7><BOT><TERRORIST>" killed "Matt<3><BOT><CT>" with "galil"
DispatchSpawn succes for perk 60, sending data..
Special effects for perk 60 done
Perk 60 teleported to x: -918.817 , y: 1396.754 , z: -47.968
Setting CBaseEntity to non-brush model models/player/lomme/lomme1.mdl
perk 60 is assigned a model and render
Why is the entity id in spawnsucces suddenly not valid anymore, what could cause that?
Attached Files
File Type: sp Get Plugin or Get Source (DDamagePerk2BETA.sp - 282 views - 9.3 KB)
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]

Last edited by striker07; 02-18-2013 at 11:15.
striker07 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 18:55.


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