AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Entity spawn (https://forums.alliedmods.net/showthread.php?t=6922)

LynX 10-19-2004 09:20

Entity spawn
 
I'm almost finished with mine plugin, but say, how do you spawn an entity, and give that entity a model? Entity should be pickable, and when player pick it, player should die (I assume that player should die with kill native).

Votorx 10-20-2004 07:06

Look at the engine include file and try to figure it out

XxAvalanchexX 10-23-2004 00:07

Put this wherever you want to create the entity.
Code:
new deathent = create_entity("info_target"); entity_set_string(deathent,EV_SZ_classname,"deathent"); // give it custom name entity_set_model(deathent,"models/yourmodelhere.mdl"); // don't forget to precache it entity_set_origin(deathent,ORIGINHERE); // figure it out however

Put this just somewhere in your code, this is what kills the player when he picks it up.
Code:
  // Entity collision   public pfn_touch(ptr,ptd) {    // Make sure one of the entities is a player    if(ptr < 1 || ptd < 1 || ptd > 32 || !is_user_alive(ptd) || !is_user_connected(ptd)) {     return PLUGIN_CONTINUE;    }    // Get classname    new classname[33];    entity_get_string(ptr,EV_SZ_classname,classname,32);    // See if it is our custom entity    if(equal(classname,"deathent") == 1) {     set_user_health(ptd,0); // kill user     client_print(ptd,print_chat,"* You've picked up the death entity!");     remove_entity(ptr); // remove death entity     return PLUGIN_CONTINUE;    }    return PLUGIN_CONTINUE;   }


All times are GMT -4. The time now is 17:26.

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