AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Model Spawn - Crash (https://forums.alliedmods.net/showthread.php?t=22187)

mysticssjgoku4 12-20-2005 22:15

Model Spawn - Crash
 
Ok, I try and spawn a model here for my car mod, and it crashes. The model doesn't show up or anything, and my server crashes. I did some troubleshooting to see the cause and it only crashes when I have
Code:
    new Float:maxs[3] = {64.0,64.0,36.0}     new Float:mins[3] = {-64.0,-64.0,-36.0}     entity_set_size(ent,mins,maxs)

Is there something wrong with that?
Thanks.

Here's the full code.

Code:
public makecarmdl(id) {         if(iscar[id] == 0) return PLUGIN_HANDLED         new Float:origin[3], authid[32]     entity_get_vector(id,EV_VEC_origin,origin)     new ent = create_entity("info_target")         entity_set_origin(ent,origin);     origin[1] += 50.0     entity_set_origin(id,origin)     entity_set_float(ent,EV_FL_takedamage,0.0)     //entity_set_float(ent,EV_FL_health,100.0)     new pcarid, query[256]     format(query,255,"SELECT CarID FROM users WHERE SteamID='%s'",authid)     result = dbi_query(dbc,query)     if( dbi_nextrow( result ) > 0 )         {         pcarid = dbi_field(result,1)         dbi_free_result(result)     }         new CarModel[32]     format(query,255,"SELECT CarModel FROM cars WHERE CarID='%i'",pcarid)     result = dbi_query(dbc,query)     if( dbi_nextrow( result ) > 0 )         {         dbi_field(result,1,CarModel,31)         dbi_free_result(result)     }         entity_set_string(ent,EV_SZ_classname,"car_parked");     entity_set_string(ent,EV_SZ_targetname,authid)     entity_set_model(ent,CarModel);     entity_set_int(ent,EV_INT_solid, 2)     //entity_set_byte(ent,EV_BYTE_controller1,125);     //entity_set_byte(ent,EV_BYTE_controller2,125);     //entity_set_byte(ent,EV_BYTE_controller3,125);     //entity_set_byte(ent,EV_BYTE_controller4,125);     new Float:maxs[3] = {64.0,64.0,36.0}     new Float:mins[3] = {-64.0,-64.0,-36.0}     entity_set_size(ent,mins,maxs)     entity_set_float(ent,EV_FL_animtime,2.0)     entity_set_float(ent,EV_FL_framerate,1.0)     entity_set_int(ent,EV_INT_sequence,0);     entity_set_float(ent,EV_FL_nextthink,halflife_time() + 0.01)             drop_to_floor(ent) }

XxAvalanchexX 12-20-2005 22:35

Is the model precached before-hand?

mysticssjgoku4 12-20-2005 22:35

no

XxAvalanchexX 12-20-2005 22:36

That's your problem.

mysticssjgoku4 12-20-2005 22:49

Quote:

Originally Posted by XxAvalanchexX
That's your problem.

Never mind, I figured out It wasn't getting an AUTHID because i forgot to add the get_user_authid. Now it crashes again. Any ideas?

MaximusBrood 12-21-2005 02:06

Quote:

Originally Posted by XxAvalanchexX
Is the model precached before-hand?

You have to precache it even if all clients already have the model and the server HAS to have the model in his server dir

XxAvalanchexX 12-21-2005 02:23

Yes.

mysticssjgoku4 12-21-2005 11:45

I prechached it, but it still crashes..... :(

MaximusBrood 12-21-2005 12:05

Quote:

Originally Posted by mysticssjgoku4
I prechached it, but it still crashes..... :(

Show me how you precached it, this is the correct way ->

Code:
public plugin_precache() {     precache_model("models/yay.mdl")     precache_model("models/yay2.mdl")         return PLUGIN_CONTINUE }

Quote:

Originally Posted by XxAvalanchexX
Yes.

It wasn't a question, it was an answer :wink:

mysticssjgoku4 12-21-2005 14:04

This is how I precached it.

Code:
precache_model("models/player/car_skyline/car_skyline.mdl")


All times are GMT -4. The time now is 15:51.

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