AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Restrict Functiuon to Model (https://forums.alliedmods.net/showthread.php?t=45927)

Stephen 10-14-2006 15:20

Restrict Functiuon to Model
 
Code:
public function(id) {     if (EArray[id] == 0)     if (entity_get_int(id, EV_INT_playerclass) == 1)     {         new animation = entity_get_int(id, EV_INT_sequence)         if (animation == 1)         {             if (get_pdata_int(id, 666) > 1)                     set_task(0.1,"Ignition",id)             return PLUGIN_HANDLED         }     }     return PLUGIN_CONTINUE }

Hey there.
I have an question HOW would i stop "function(id)" from beeing used when the correct model inst used.
Lets say you have to be SuperduperModel.mdl to make the above Fuction work.

I hope you understand what i mean.

Rolnaaba 10-16-2006 09:52

Re: Restrict Functiuon to Model
 
Code:
if(cs_get_user_model(id, "SuperduperModel.mdl")) {      set_task(0.1, "function", id) }

MaximusBrood 10-16-2006 10:12

Re: Restrict Functiuon to Model
 
Rollnaab, seriously, stop posting rubbish.

---

Stephen, you got 2 if clauses that don't make any sense. The first one and the one with if(get_pdata_int...).

Just put this on top of the function to only make it work for the gaben model:

Code:
static userModel[32]; cs_get_user_model(id, userModel, 31); if( !equal(userModel, "gaben.mdl") )      return PLUGIN_HANDLED

Zenith77 10-16-2006 12:23

Re: Restrict Functiuon to Model
 
Quote:

Originally Posted by Rolnaaba (Post 391756)
Code:
if(cs_get_user_model(id, "SuperduperModel.mdl")) {      set_task(0.1, "function", id) }

Adding to what Maximus said, here is what is wrong. I also have no idea why or who would post that code like that:
  • That is not how the native decleration is. cs_get_user_model returns a players model through a string buffer provided the programmer.
  • Stop using set_tasks to call functions. If you don't know how to call a function, read the tutorials.

MaximusBrood 10-16-2006 12:38

Re: Restrict Functiuon to Model
 
Zenith: set_task() was used in the original code :wink:

Zenith77 10-16-2006 19:48

Re: Restrict Functiuon to Model
 
*Jumps off clip.

XxAvalanchexX 10-16-2006 21:14

Re: Restrict Functiuon to Model
 
The model returned from cs_get_user_model would be "gaben", not "gaben.mdl".


All times are GMT -4. The time now is 04:44.

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