[INC] Shoot the cow -
Correlli - 25.09.2012
What is this?
This is a script which allows you to shoot and kill cows... and also resurrect them, and shoot and kill them again I guess.
Video:
https://*****.com/50134010
Credits:
-
****** for
foreach & randomEx functions,
- whoever created the IsPlayerAimingAt and other functions for it.
How to install?
It's easy and simple - download and put the cshoot.inc into the
\pawno\include\ folder and do the same thing with the
foreach.inc file.
Open your script and put this:
pawn Code:
#include <foreach>
#include <cshoot>
right after the
Put the cows in the
OnGameModeInit callback.
Example:
pawn Code:
/*
CreateCow(Float:x, Float:y, Float:z, health, Float:speed, Float:range);
*/
CreateCow(261.24, -1809.09, 5.25, 200, 3.0, 6.5);
CreateCow(282.52, -1804.90, 5.29, 200, 2.25, 8.0);
CreateCow(264.51, -1790.43, 5.24, 200, 2.75, 5.0);
These 3 cows are located at the Santa Maria Beach. Here are the spawn coordinates:
Functions:
CreateCow
Adds a cow to the server.
@Float: x = Cow spawn X position.
@Float: y = Cow spawn Y position.
@Float: z = Cow spawn Z position.
@health = Cow health.
@Float: speed = Cow speed.
@Float: range = Cow range in which cow will move.
returns the cow ID which starts with 0. If you exceed the
MAX_COWS define then it will return the invalid ID which is -1.
If you set the health which is higher than MAX_COW_HEALTH, then the function will automatically set it to the MAX_COW_HEALTH. The similar thing will happen if you set the health which is lower than MIN_COW_HEALTH, the function will set it to the MIN_COW_HEALTH. The same thing will happen with the speed - MAX_COW_SPEED / MIN_COW_SPEED.
Example:
pawn Code:
new
gCow = -1;
public OnGameModeInit()
{
gCow = CreateCow(261.24, -1809.09, 5.25, 200, 3.0, 6.5);
return true;
}
DestroyCow
Deletes the cow from the server.
@cowid = The cow ID.
returns true if the cow is valid and false if it's not.
Example:
IsCowCreated
Checks if cow is created.
@cowid = The cow ID.
returns true if the cow is valid and false if it's not.
Example:
pawn Code:
if(IsCowCreated(gCow)) printf("Cow is created.");
else printf("Cow is NOT created.");
SetCowHealth
Sets the new amount of health for the cow.
@cowid = The cow ID.
@health = Cow health.
returns true if the cow is valid and false if it's not.
If you set the health which is higher than MAX_COW_HEALTH, then the function will automatically set it to the MAX_COW_HEALTH. The similar thing will happen if you set the health which is lower than 0, the function will set it to 0.
Example:
GetCowHealth
Returns the current amount of health for the cow.
@cowid = The cow ID.
returns amount of health if the cow is valid and false if it's not.
Example:
pawn Code:
printf("Health of cow with ID %i: %i", gCow, GetCowHealth(gCow));
KillCow
Kills the cow - this function won't call the OnCowDeath callback.
@cowid = The cow ID.
returns true if the cow is valid and false if it's not.
Example:
ResurrectCow | RespawnCow
Resurrects/respawns the cow and sets a new health for it.
@cowid = The cow ID.
@health = Cow health.
returns true if the cow is valid and false if it's not or if cow is not dead.
If you set the health which is higher than MAX_COW_HEALTH, then the function will automatically set it to the MAX_COW_HEALTH. The similar thing will happen if you set the health which is lower than MIN_COW_HEALTH, the function will set it to the MIN_COW_HEALTH.
Example:
IsCowDead
Checks if cow is dead.
@cowid = The cow ID.
returns true if the cow is dead and false if it's not or if cow isn't created.
Example:
pawn Code:
if(IsCowDead(gCow)) printf("Cow is dead.");
else printf("Cow is NOT dead.");
Callbacks:
OnCowDeath
Callback will be called when the cow dies.
@cowid = The cow ID.
@killerid = The killer ID.
@reason = Weapon ID.
Example:
pawn Code:
public OnCowDeath(cowid, killerid, reason)
{
new
string[96];
GetPlayerName(killerid, string, MAX_PLAYER_NAME);
format(string, 96, "OnCowDeath(Cow ID: %i, Killer name: %s, Weapon ID: %i)",
cowid, string, reason);
SendClientMessage(killerid, -1, string);
return true;
}
OnCowTakeDamage
Callback will be called when the cow takes damage.
@cowid = The cow ID.
@shooterid = The shooter ID.
@reason = Weapon ID.
@damage = The amount of health cow has lost.
Example:
pawn Code:
public OnCowTakeDamage(cowid, shooterid, reason, damage)
{
new
string[108];
GetPlayerName(shooterid, string, MAX_PLAYER_NAME);
format(string, 108, "OnCowTakeDamage(Cow ID: %i, Shooter name: %s, Weapon ID: %i, Damage: %i)",
cowid, string, reason, damage);
SendClientMessage(shooterid, -1, string);
return true;
}
Defines:
pawn Code:
#define MAX_COWS (3)
#define ENABLE_SOUND (0)
#define MIN_COW_SPEED (1.0)
#define MAX_COW_SPEED (5.0)
#define MIN_COW_HEALTH (10)
#define MAX_COW_HEALTH (200)
MAX_COWS - The maximum amount of cows allowed for script to load on the server.
ENABLE_SOUND - If this is setted to 1, then you will hear the cow moo-sound on the cow damage/death (I didn't enable it in the video, because it "lags" a bit for a player).
MIN_COW_SPEED / MAX_COW_SPEED - The minimum / maximum speed of the cow.
MIN_COW_HEALTH / MAX_COW_HEALTH - The minimum / maximum health of the cow.
How to get coordinates for cows?
I myself am using JernejL's REAL Map Editor, in which I place the cow objects (ID: 16442) where I want to have them. This Map Editor is not for people with weak computers, so if you have a weak computer, you can use any other Map Editor.
Download:
http://www.solidfiles.com/d/ce887b8bfa
Other:
When you delete the last cow then the timer will stop so you don't have to do anything, and when you add the first cow then it will start again.
This include supports only these weapons:
If you want to loop through all created cows, then use this example:
pawn Code:
foreach(Cows, a)
{
RespawnCow(a, 200);
}
Re: [INC] Shoot the cow -
Lordzy - 25.09.2012
Wow.
Epic script.
Your releases are awesome.
Great JoB and keep going +3
Edit: Need to share reps to somemore because I've reped you in your previous cool map.
I'll rep you soon.
Once again, cool include.
And I'll surely use this.
EDIT2:
REPED!
Re: [INC] Shoot the cow -
Black Wolf - 25.09.2012
Awesome willl this work on 3c ?
Re: [INC] Shoot the cow -
davve95 - 25.09.2012
Sounds awesome I will look at the video later!.
Re: [INC] Shoot the cow -
Correlli - 25.09.2012
Quote:
Originally Posted by [xB]Lordz
And I'll surely use this.
|
Great, report bugs if you find any.
Quote:
Originally Posted by Black Wolf
Awesome willl this work on 3c ?
|
I guess it will - I don't see any problem why it wouldn't.
Re: [INC] Shoot the cow -
Gamer` - 25.09.2012
Hiddos willn't like it.
Re: [INC] Shoot the cow -
Hiddos - 25.09.2012
y u so disrespectful
((((((
Re: [INC] Shoot the cow -
Correlli - 25.09.2012
Quote:
Originally Posted by Hiddos
y u so disrespectful ((((((
|
Eh, just shoot it.
Re: [INC] Shoot the cow -
Hiddos - 26.09.2012
Quote:
Originally Posted by Correlli
Eh, just shoot it.
|
So is 'damage' based on the amount of damage guns normally do to players? I've seen this before but that was 1-hit kill.
Re: [INC] Shoot the cow -
Correlli - 26.09.2012
Quote:
Originally Posted by Hiddos
So is 'damage' based on the amount of damage guns normally do to players? I've seen this before but that was 1-hit kill.
|
Well, if you look at the code, you can see this:
Every weapon (from these 15) does it's own damage.
Quote:
Originally Posted by nRaike
Are you still over here?
|
Sure I am.
Quote:
Originally Posted by nRaike
Remember of me? :>
|
Yeah, I think I do. Last time I heard from you, you had some team who was working on some RP gamemode if I remember correctly?