AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need help with finding/replacing entities (https://forums.alliedmods.net/showthread.php?t=99480)

eradftw2678 08-05-2009 22:40

Need help with finding/replacing entities
 
So i found this code because it is the script i need, but i dont know how to modify it. I know the names of the entities, and I need to make them target something because right now they target nothing, what do i change in this code to make it work?

Code:

public find_and_replace(model[],type)
{
    new maxplayers = get_maxplayers()
    new temp_entlist[30]
    new num = 0;
    new Float:origin[3]
    new ent = engfunc(EngFunc_FindEntityByString,maxplayers,"model",model)
    while(ent)
    {
        temp_entlist[num] = ent
        num++
        ent = engfunc(EngFunc_FindEntityByString,ent,"model",model)
    }
    for(new i=0;i<num;i++)
    {
        pev(temp_entlist[i],pev_origin,origin)
        ent = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"armoury_entity"))
        set_pev(ent,pev_classname,"armoury_entity")
        engfunc(EngFunc_SetModel,ent,model)
        cs_set_armoury_type(ent,type)
        set_pev(ent,pev_solid,SOLID_TRIGGER)
        set_pev(ent,pev_movetype,MOVETYPE_FLY)
        set_pev(ent,pev_flags,512)
        engfunc(EngFunc_SetOrigin,ent,origin)
        engfunc(EngFunc_RemoveEntity,temp_entlist[i])
        dllfunc(DLLFunc_Spawn,ent)
    }
}



All times are GMT -4. The time now is 18:30.

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