Okay so my friend decided to make a plugin but ofcourse it doesnt work
could some 1 point out the mistakes ?
Code:
#include <sdktools>
#include <sourcemod>
new gift[MAXPLAYERS+1];
public Plugin:myinfo =
{
name = "Gift",
author = "Diplomatas",
description = "Redaguotas mokymosi tikslais Plugin Gift",
version = "1.1",
url="http://sourcemod.net"
}
public OnPluginStar()
{
RegConsoleCmd("sm_gift", Command_Gift);
HookEvent("player_spawn", OnPlayerSpawn);
}
public OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if(IsPlayerAlive(client))
{
PrintToChat(client, "[Info] : Rasyk !gift");
gift[client] = 1;
}
}
public Action:Command_Gift(client, args)
{
if (IsPlayerAlive(client))
{
if (gift[client] > 0)
{
new bonus = GetRandomInt(1,20);
if(bonus == 1)
{
new health = GetClientHealth(client);
new nowhealth = health + 45;
SetEntityHealth(client, nowhealth);
PrintToChat(client, "[Info] : Laimejai +45 HP");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 2)
{
GivePlayerItem(client, "weapon_hegrenade");
GivePlayerItem(client, "weapon_flashbang");
GivePlayerItem(client, "weapon_smokegrenade");
PrintToChat(client, "[Info] : Laimejai granatu rinkini");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 3)
{
new Float:speed = GetEntPropFloat(client,Prop_Data, "m_flLaggedMovementValue");
new Float:nowspeed = speed + 0.4;
SetEntPropFloat(client,Prop_Data, "m_flLaggedMovementValue", nowspeed);
PrintToChat(client, "[Info] : Esi greitesnis uz kitus");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 4)
{
PrintToChat(client, "[Info] : Nieko nelaimejai");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 5)
{
GivePlayerItem(client, "weapon_usp");
PrintToChat(client, "[Info] : Laimejai USP");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 6)
{
PrintToChat(client, "[Info] : Nieko nelaimejai");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 7)
{
PrintToChat(client, "[Info] : Nieko nelaimejai");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 8)
{
PrintToChat(client, "[Info] : Nieko nelaimejai");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 9)
{
PrintToChat(client, "[Info] : Nieko nelaimejai");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 10)
{
PrintToChat(client, "[Info] : Nieko nelaimejai");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 11)
{
PrintToChat(client, "[Info] : Nieko nelaimejai");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 12)
{
PrintToChat(client, "[Info] : Nieko nelaimejai");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 13)
{
PrintToChat(client, "[Info] : Nieko nelaimejai");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 14)
{
PrintToChat(client, "[Info] : Nieko nelaimejai");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 15)
{
PrintToChat(client, "[Info] : Nieko nelaimejai");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 16)
{
PrintToChat(client, "[Info] : Nieko nelaimejai");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 17)
{
PrintToChat(client, "[Info] : Nieko nelaimejai");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 18)
{
PrintToChat(client, "[Info] : Nieko nelaimejai");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 19)
{
PrintToChat(client, "[Info] : Nieko nelaimejai");
gift[client]--;
return Plugin_Handled;
}
else if (bonus == 20)
{
PrintToChat(client, "[Info] : Nieko nelaimejai");
gift[client]--;
return Plugin_Handled;
}
}
else
{
PrintToChat(client, "[Info] : Jau gavai savo dovana");
return Plugin_Handled;
}
}
else
{
PrintToChat(client, "[Info] : Turi buti gyvas, kad gautum dovana");
return Plugin_Handled;
}
return Plugin_Continue;
}