Raised This Month: $51 Target: $400
 12% 

May I ask you please give me simple effect samples


Post New Thread Reply   
 
Thread Tools Display Modes
tristen620
Junior Member
Join Date: Feb 2012
Old 02-19-2014 , 05:24   Re: May I ask you please give me simple effect samples
Reply With Quote #11

Quote:
Originally Posted by vrsiz1002 View Post
I try teleportentity but import errer beacouse of teleportentity.
(25) : error 017: undefined symbol "event"
* Note that code is case sensitive so be careful.

(25) : warning 204: symbol is assigned a value that is never used: "client"
* The client was never used so I commented it out.

(39) : error 035: argument type mismatch (argument 4)
* argument 4 which is velocity expects an array with 3 floats, read link for detailed information
* https://wiki.alliedmods.net/Vectors_...ned_(Scripting)

(34) : warning 204: symbol is assigned a value that is never used: "velocity"
*

Code:
/* Plugin Template generated by Pawn Studio */

#include <sourcemod>
#include <sdktools>
public Plugin:myinfo = 
{
name = "New Plugin",
author = "Unknown",
description = "<- Description ->",
version = "1.0",
url = "<- URL ->"
}

new spawncount[MAXPLAYERS+1];


public OnPluginStart()
{
HookEvent("round_start", roundfreezeend_event);
RegConsoleCmd("attack", HookCmd);
}

/** public Action:roundfreezeend_event(Handle:Event, const String:Name[], bool:Broadcast)
  * Here you use "Event" but later you refer to it as "event", code is case sensitive */
public Action:roundfreezeend_event(Handle:event, const String:Name[], bool:Broadcast)
{
  /** new client = GetClientOfUserId(GetEventInt(event, "userid"));
    * Here you declare client but don't actually use it */
  for(new i = 1; i <= MaxClients; i++)
    spawncount[i] = 1;
}

public Action:HookCmd(client, args)
{
  // https://wiki.alliedmods.net/Vectors_Explained_(Scripting)
  new Float:velocity = 100.0;
  /** if(spawncount[client] == 1)
    * You specify that they must have exactly one spawn count, what if they somehow have more than one
    * or if you give them two for being special, if it is two then it wont work because it is not exactly
    * one. */
  if(spawncount[client] >= 1)
  {
    //new effect = PrecacheModel("dieserver/battlecru7.vmt"); //doing this here is a bad idea...
    spawncount[client]--; 
    TeleportEntity(effect, NULL_VECTOR, NULL_VECTOR, velocity); 
    
    CreateTimer(30.0, RespawnPlayer, client);
    PrintToChat(client, "You are boosted");
  }
  else
  {
    PrintToChat(client, "wait");
  }
}

public Action:RespawnPlayer(Handle:Timer, any:client)
{
  spawncount[client]++;
  PrintToChat(client, "You can booster again");
}
I got sidetracked at work but I think a slightly more efficient
way of determining who can and who cannot "booster" would be to
simply write the time when they successfully use it and check
against that number when they attempt to use it again as it would
reduce the number of timers flying around which can really bite
if you let them stack up.

Code:
/** I will assume that everyone is allowed to use "booster"
  * and that they may use it immediately after spawning
  */
#include <sourcemod>
#include <sdktools>

public Plugin:myinfo = 
{
  name = "New Plugin",
  author = "Unknown",
  description = "<- Description ->",
  version = "1.0",
  url = "<- URL ->"
}

new Float:boostTime[MAXPLAYERS+1];
new Float:boostStrength = 64.0;
new custom_effect; //create the space for the effect
public OnPluginStart()
{
  HookEvent("round_start", RoundStartEvent);
  RegConsoleCmd("boost", BoostEvent);
  custom_effect=PrecacheModel("dieserver/battlecru7.vmt"); //precache the effect ONCE, not every time the ability is used.
}

public Action:RoundStartEvent(Handle:event, const String:Name[], bool:Broadcast)
{
  for(new i = 1; i <= MaxClients; i++)
    boostTime[i] = 0.0;
}

public Action:BoostEvent(client, args)
{
  new Float:time=GetEngineTime();
  if(time > boostTime[client]+30.0)
  {
    new Float:eAngle[3];
    GetClientEyeAngles(client,eAngle);
    
    new Float:startpos[3];
    GetClientEyePosition(client,startpos);
    
    new Float:dir[3];
    GetAngleVectors(eAngle, dir, NULL_VECTOR, NULL_VECTOR);
    ScaleVector(dir, boostStrength);

    TeleportEntity(custom_effect, NULL_VECTOR, NULL_VECTOR, dir);
    boostTime[client]=time
    PrintToChat(client, "Boost Activated!");
  }
  else
    PrintToChat(client, "Boost not ready!");
}
I hope I remembered all that correctly, if not at least you have a whole lot more to read about.
tristen620 is offline
vrsiz1002
Junior Member
Join Date: Feb 2014
Old 02-19-2014 , 08:03   Re: May I ask you please give me simple effect samples
Reply With Quote #12

Thx reply.It can compile.but I cannot look effect;;.

Boost is beacause of remodeling other plugin.lol
vrsiz1002 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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