Credits : Ksna
Thanks Gudio, Dany
Code: [Select]
Server Name Generator
Code: [Select]
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()] );
}
}