Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #define PLUGIN_VERSION "1.0"
- static const String:MODEL_NICK_ARMS[] = "models/v_models/v_shotgun_spas.mdl";
- public Plugin:myinfo =
- {
- name = "Model Index Tests",
- author = "DeathChaos",
- description = "Survivor arms and stuff",
- version = PLUGIN_VERSION,
- }
- public OnPluginStart()
- {
- RegConsoleCmd("sm_v", ViewModel, "ViewModel Test");
- }
- public OnMapStart()
- {
- CheckModelPreCache(MODEL_NICK_ARMS);
- }
- public Action:ViewModel(client, args)
- {
- if (!IsSurvivor(client))
- {
- return;
- }
- new ViewModelIndex = GetEntPropEnt(client, Prop_Send, "m_hViewModel") ;
- new String:model[PLATFORM_MAX_PATH]="";
- GetEntPropString(ViewModelIndex, Prop_Data, "m_ModelName", model, sizeof(model));
- new String:message[PLATFORM_MAX_PATH]="";
- Format(message,sizeof(message),"Your Current View Model Index is : %i and it's model is %s", ViewModelIndex, model);
- PrintToChat(client, message);
- SetEntityModel(ViewModelIndex, MODEL_NICK_ARMS);
- }
- stock bool:IsSurvivor(client)
- {
- if (client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2)
- {
- return true;
- }
- return false;
- }
- stock CheckModelPreCache(const String:Modelfile[])
- {
- if (!IsModelPrecached(Modelfile))
- {
- PrecacheModel(Modelfile, true);
- PrintToServer("Precaching Model:%s",Modelfile);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment