sereky
02-12-2012, 17:54
For example: if the counter's value is 6, run the giveweapon(client, "weapon_..."); command 6 times (in one occasion).
This small source is an example.
#include <sourcemod>
#include <sdktools>
new count[MAXPLAYERS+1];
public Action: ... (an event)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
...
count[client] ++; //add +1 everytime when event hooked
CreateTimer(5.0, give, client);
}
public Action:give(Handle:timer, any:client)
{
giveweapon(client, "weapon_..."); //??? run this multiple times, according to a counter's value
count[client] = 0; //reset the counter
}
giveweapon(client, String:class[40])
{
new ent = CreateEntityByName(class);
if (ent != -1)
{
DispatchSpawn(ent);
EquipPlayerWeapon(client, ent); //or shall I put something here?
}
}
This small source is an example.
#include <sourcemod>
#include <sdktools>
new count[MAXPLAYERS+1];
public Action: ... (an event)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
...
count[client] ++; //add +1 everytime when event hooked
CreateTimer(5.0, give, client);
}
public Action:give(Handle:timer, any:client)
{
giveweapon(client, "weapon_..."); //??? run this multiple times, according to a counter's value
count[client] = 0; //reset the counter
}
giveweapon(client, String:class[40])
{
new ent = CreateEntityByName(class);
if (ent != -1)
{
DispatchSpawn(ent);
EquipPlayerWeapon(client, ent); //or shall I put something here?
}
}