Credits : Ksna
Thanks Gudio, Dany
class PlayerClass{
raceplayer = false;
derbyplayer = false;
}
function onScriptLoad(){
race <- false;
racecount <- 0;
racestart <- false;
derby <- false;
derbycount <- 0;
derbystart <- false;
stats <- array( GetMaxPlayers(), null );
print( "Ksna's Race System Loaded." );
}
function onPlayerTeamKill( killer, killed, weapon, bodypart )
{
onPlayerKill( killer, killed, weapon, bodypart );
}
function onPlayerKill( killer, player, reason, bodypart )
{
if ( stats[ player.ID ].raceplayer ) {
racecount--;
Message( ">> " + player.Name + " is out of the race." );
if ( racecount == 0 ) closerace();
stats[ player.ID ].raceplayer = false;
}
if ( stats[ player.ID ].derbyplayer ) {
derbycount--;
Message( ">> " + player.Name + " is out of the derby." );
stats[ player.ID ].derbyplayer = false;
if ( derbycount == 1 ) checkderby();
}
Message( ""+killer.Name + " has been drowned Reason: Stop killing racing players " );
Killer.Pos = Vector( -597.7496,-1858.9531,28.1291 );
}
function onPlayerDeath( player, reason )
{
if ( stats[ player.ID ].raceplayer ) {
racecount--;
Message( ">> " + player.Name + " is out of the race." );
if ( racecount == 0 ) closerace();
stats[ player.ID ].raceplayer = false;
}
if ( stats[ player.ID ].derbyplayer ) {
derbycount--;
Message( ">> " + player.Name + " is out of the derby." );
stats[ player.ID ].derbyplayer = false;
if ( derbycount == 1 ) checkderby();
}
}
function onPlayerPart( player, reason )
{
if ( stats[ player.ID ].raceplayer ) {
racecount--;
Message( ">> " + player.Name + " is out of the race." );
if ( racecount == 0 ) closerace();
stats[ player.ID ].raceplayer = false;
}
if ( stats[ player.ID ].derbyplayer ) {
derbycount--;
Message( ">> " + player.Name + " is out of the derby." );
stats[ player.ID ].derbyplayer = false;
if ( derbycount == 1 ) checkderby();
}
}
function onPlayerJoin( player ){
stats[ player.ID ] = PlayerClass( player.Name );
}
function onPlayerExitVehicle( player, vehicle ) {
if ( stats[player.ID].raceplayer ){ vehicle.Locked = false; player.Vehicle = vehicle; vehicle.Locked = true; } // By Karan
if ( stats[player.ID].derbyplayer ){ vehicle.Locked = false; player.Vehicle = vehicle; vehicle.Locked = true; }
}
function onPlayerCommand( player, cmd, text ){
if( cmd == "race") {
if( race ) MessagePlayer("Race is already started.. ",player);
else{
race = true;
Message("Race is started by "+ player.Name +", 20sec to join the race.");
Message("Film Studio to Airport race started.");
NewTimer( "raceplayers", 20000, 1);
FindVehicle( 1 ).Pos = Vector( -54.2794, 966.151, 15.9403 );
FindVehicle( 2 ).Pos = Vector( -54.2794, 956.151, 15.9403 );
FindVehicle( 3 ).Pos = Vector( -54.2794, 946.151, 15.9403 );
FindVehicle( 4 ).Pos = Vector( -54.2794, 936.151, 15.9403 );
}
}
else if( cmd == "joinrace") {
if ( !player.Spawned )MessagePlayer("Spawn to use this command" player);
else if ( !race ) MessagePlayer("Race is not started do /race", player);
else if ( stats[player.ID].raceplayer ) MessagePlayer("You already joined race.",player);
else if ( racecount > 4 ) MessagePlayer("Too Late! Only 4 players can race at once", player);
else if ( racestart ) MessagePlayer("Too Late!", player);
else {
racecount++;
for( local i=0; i <= racecount; i++ )
{
local plr = FindPlayer( i );
player.Vehicle = FindVehicle( i );
}
player.Frozen = true;
stats[player.ID].raceplayer = true;
Message(""+ player.Name +" has joined race.")
}
}
else if( cmd == "derby") {
if( derby ) MessagePlayer("Derby is already started.. ",player);
else{
derby = true;
Message("Derby is started by "+ player.Name +", 20sec to join the derby.");
NewTimer( "derbyplayers", 20000, 1);
FindVehicle( 11 ).Pos = Vector( -1386.75, 1001.00, 252.25 ); // Change these values
FindVehicle( 12 ).Pos = Vector( -1386.75, 1011.00, 252.25 );
FindVehicle( 13 ).Pos = Vector( -1386.75, 1021.00, 252.25 );
FindVehicle( 14 ).Pos = Vector( -1386.75, 1031.00, 252.25 );
}
}
else if( cmd == "joinderby") {
if ( !player.Spawned )MessagePlayer("Spawn to use this command" player);
else if ( !derby ) MessagePlayer("Derby is not started do /derby", player);
else if ( stats[player.ID].derbyplayer ) MessagePlayer("You already joined derby.",player);
else if ( derbycount > 4 ) MessagePlayer("Too Late! Only 4 players can derby at once", player);
else if ( derbystart ) MessagePlayer("Too Late!", player);
else {
derbycount++;
for( local i=0; i <= derbycount + 10; i++ )
{
local plr = FindPlayer( i );
player.Vehicle = FindVehicle( i );
}
player.Frozen = true;
stats[player.ID].derbyplayer = true;
Message(""+ player.Name +" has joined derby.")
}
}
}
function raceplayers()
{
if ( racecount > 1 )
{
NewTimer( "Ann", 1000, 1, "3" );
NewTimer( "Ann", 2000, 1, "2" );
NewTimer( "Ann", 3000, 1, "1" );
} else closerace();
}
function derbyplayers()
{
if ( derbycount > 1 )
{
NewTimer( "DAnn", 1000, 1, "3" );
NewTimer( "DAnn", 2000, 1, "2" );
NewTimer( "DAnn", 3000, 1, "1" );
} else closederby();
}
function Ann( number )
{
for( local i=0; i <= GetMaxPlayers(); i++ )
{
local plr = FindPlayer( i );
if ( ( plr ) && ( stats[ plr.ID ].raceplayer ) )
{
switch( number.tointeger() )
{
case 1:
Announce( "1", plr );
startrace();
Announce( "Go!", plr );
break;
case 2:
Announce( "2", plr );
break;
case 3:
Announce( "3", plr );
break;
}
}
}
}
function DAnn( number )
{
for( local i=0; i <= GetMaxPlayers(); i++ )
{
local plr = FindPlayer( i );
if ( ( plr ) && ( stats[ plr.ID ].derbyplayer ) )
{
switch( number.tointeger() )
{
case 1:
Announce( "1", plr );
startderby();
Announce( "Go!", plr );
break;
case 2:
Announce( "2", plr );
break;
case 3:
Announce( "3", plr );
break;
}
}
}
}
function checkderby( )
{
for( local i=0; i <= GetMaxPlayers(); i++ )
{
local plr = FindPlayer( i );
if ( ( plr ) && ( stats[ plr.ID ].derbyplayer ) ) {
plr.Cash += 1000;
Message(""+plr.Name+" has won derby.");
closederby();
}
}
}
function startderby() {
derbystart = true;
CreatePickup( 382, Vector( -1435.9, -790.299, 14.6437 ) );
local plr;
for( local i=0; i <= GetMaxPlayers(); i++ ) {
{
plr = FindPlayer( i );
if ( ( plr ) && ( stats[ plr.ID ].derbyplayer ) ) {
plr.IsFrozen = false;
}
}
}
}
function closederby() {
Message( "Derby cancelled!" );
derby = false;
derbystart = false;
derbycount = 0;
local plr;
for( local i=0; i <= GetMaxPlayers(); i++ ){
{
plr = FindPlayer( i );
if ( plr )
{
if( stats[ plr.ID ].derbyplayer )
{
stats[ plr.ID ].derbyplayer = false;
plr.IsFrozen = false;
plr.Pos = Vector( 496.26, -83.9443, 10.0302 );
}
}
}
}
}
function startrace()
{
racestart = true;
CreatePickup( 382, Vector( -1435.9, -790.299, 14.6437 ) );
local plr;
for( local i=0; i <= GetMaxPlayers(); i++ )
{
{
plr = FindPlayer( i );
if ( ( plr ) && ( stats[ plr.ID ].raceplayer ) )
{
plr.IsFrozen = false;
}
}
}
}
function closerace() {
Message( "Race cancelled!" );
race = false;
racestart = false;
racecount = 0;
local plr;
for( local i=0; i <= GetMaxPlayers(); i++ ){
{
plr = FindPlayer( i );
if ( plr )
{
if( stats[ plr.ID ].raceplayer )
{
stats[ plr.ID ].raceplayer = false;
plr.IsFrozen = false;
plr.Pos = Vector( 496.26, -83.9443, 10.0302 );
}
}
}
}
}
function onPickupPickedUp( player, pickup )
{
if ( pickup.Model == 382 ) {
if ( stats[ player.ID ].raceplayer ) {
player.Cash+=1000;
Message( player.Name + " have got 1000$.");
pickup.Remove();
Message( ""+player.Name+" has won ." );
closerace();
}
}
}
Server Name Generator
text1 <- [ "Vice City", "Extreme", "Low Gravity", "GTA", "Grand Theft Auto :", "ClanWars", "Mega", "Infinity", "Downtown", "Twilight", "Advanced", "Hardcore", "Ultimate" ];
text2 <- [ "Deathmatch", "Cops and Robbers", "RPG", "Warzone", "ClanWars", "Adventure", "War + Roleplay", "Hell", "Survival", "Roleplay", "Rush", "VC", "Worlds" ];
function onPlayerCommand( player, cmd, text ){
if ( cmd == "gen" ){
Message( ""+text1[rand()% text1.len()]+" "+text2[rand()% text2.len()] );
}
else if ( cmd == "name" ){
Message( ""+player.Name+"'s "+text2[rand()% text2.len()] );
}
}
NIce work u did, u r gonna go far kid
Amazing Release. we are waiting for vccnr
Quote from: Samrt_Boy on Jul 21, 2015, 09:47 AMAmazing Release. we are waiting for vccnr
(facepalm)
good script.
PS: There can be no more than 1 vccnr?
So there could be no more than 1 DM
Quote from: DeViL_JiN on Jul 21, 2015, 12:16 PM-- Posts removed.
I never get urdu swearings :/
Anyways on the topic, great work I'm sure it will come handy to many users haven't gone through the code yet though.
3 Things
1.Thijn Remove Useless post
2.Great Work For it
3.Please No More Vccnr Seby is already angry
Ps Off:Devil Is Ki maa hi nhi ha xD
Sorry
blind??? i say no more vccnr -__- noob
Stop Bumping
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fimages.rapgenius.com%2Fa28d5da00fd636d4125fa6c5372b562b.500x282x9.gif&hash=4ee06f5ae9bf314c69cf50f08991dbcb2d5c2193)
Woa nice drama!
Thijin, pls delete the useless posts, I can't tolerate the bad words said here, and also lock the topic to prevent further things ahead
Quote from: KAKAN on Jul 21, 2015, 02:36 PMWoa nice drama!
Thijin, pls delete the useless posts, I can't tolerate the bad words said here, and also lock the topic to prevent further things ahead
Oh, Kid Listen your the first person to start insulting and you can't tolerate the bad words? lol
Useless posts removed. It's pointless, I will remove them anyways... Why can't you make your point without swearing?
I agree with most removed posts though. There's, what, 2 VCCNR servers? They aren't even full. What makes you think releasing a VCCNR script will change that? You will end up with the same shit SA:MP has: A million empty servers.
On topic though: The snippet could be better, but may prove a nice example to some beginner scripters. Keep 'em coming.
(y) for Thijn and ....
Kakan always jealous of Ksna Reason..
Kakan don't know how to make good snippets
Maybe yea but he didnt posted that again and again like you
One more thing this derby system isnt created by ksna my an friend given me this derby system few months ago
Quote from: Beztone on Jul 21, 2015, 04:53 PMMaybe yea but he didnt posted that again and again like you
One more thing this derby system isnt created by ksna my an friend given me this derby system few months ago
i actually made race first and derby same as race with little change and show me where is that derby system.
Quote from: Ksna on Jul 21, 2015, 05:06 PMQuote from: Beztone on Jul 21, 2015, 04:53 PMMaybe yea but he didnt posted that again and again like you
One more thing this derby system isnt created by ksna my an friend given me this derby system few months ago
i actually made race first and derby same as race with little change and show me where is that derby system.
Actually that link was too old and @ZippyShare erased those files from their server i will take that again when my friend got active
Stop lying and if you have any doubts compare my script and your's friend script and post your friend's script if possible.
Wait Ksna, u really made it?
If yes, then its a nice work!
@VssShawn Have u ever made even 1 snippet? You are totally depended on here for the shit scripts, and I'm not jealous of Ksna, Ksna is one of my friend too
Just because of this much mess here on the topic of "CnR", I will start working on a Cops and Robbers script from tomorrow which I will release.
On the other hand, as Thijn said the snippet could be better.
Good Luck Rasikh..
Kakan u just become friend because u are waiting for cnr ....
And Ksna I check that system something is missing onplayerkill ??? add their same one as Playerpart
Thanks Shawn, Updated.
You can put on pastebin?
?
lol there is already code even why u want in pastebin??
anyways there it is http://pastebin.com/nV4Vd5gB
what about it??
???
function onPlayerTeamKill( killer, killed, weapon, bodypart )
{
onPlayerKill( killer, killed, weapon, bodypart );
}
Add it
I'm looking forward you can make the race system with some checkpoints.
Quote from: [VSS]Shawn on Jul 21, 2015, 06:39 PMKakan u just become friend because u are waiting for cnr ....
LOL, I was his friend earlier, when I saw Doom's server 1st
Quotefunction onPlayerTeamKill( killer, killed, weapon, bodypart )
{
onPlayerKill( killer, killed, weapon, bodypart );
}
Added! It is not needed for free teams ;)
earned very good score of 10 face
Fixed bugs
when i use this crepy code without /race
else if( cmd == "joinrace") {
if ( !player.Spawned )MessagePlayer("Spawn to use this command" player);
else if ( !race ) MessagePlayer("Race is not started do /race", player);
else if ( stats[player.ID].raceplayer ) MessagePlayer("You already joined race.",player);
else if ( racecount > 4 ) MessagePlayer("Too Late! Only 4 players can race at once", player);
else if ( racestart ) MessagePlayer("Too Late!", player);
else {
racecount++;
for( local i=0; i <= racecount; i++ )
{
local plr = FindPlayer( i );
player.Vehicle = FindVehicle( i );
}
player.Frozen = true;
stats[player.ID].raceplayer = true;
Message(""+ player.Name +" has joined race.")
}
}
it say race not started do /joinrace
Shawn join race :\ wtf
Yes, Player should start race by typing /race then do /joinrace
LoL Wth Do u think Some newbies will come and do /race they will do /joinrace btw i have fix it
Server name generator added.
Nice Work
I think the server name generator will not work... anyways I didn't test it, so nice
Sorry For Bump but Server name generator how this code will change server name?
See the code again and think. I'll tell you later