08.06.2012, 13:37
hey guys,
ive back since 1 year dint script and i try to make a minigame. But, i have make a mistake or maybe more cuz i cant find any problem on this script
idk what to do. hope u guys have the solution for this problem.
ive back since 1 year dint script and i try to make a minigame. But, i have make a mistake or maybe more cuz i cant find any problem on this script
pawn Код:
#include a_samp
#include a_colours
#define MAX_NAMES MAX_PLAYER_NAME
#define MAX_STRINGS 2500
new str [ MAX_STRINGS ] ;
new pname [ MAX_NAMES ] ;
new kname [ MAX_NAMES ] ;
new Sawnoff [ MAX_PLAYERS ] ;
new pNums = 0 ;
new MatchStarted = 0 ;
new Timer ;
forward SawnoffMatchTimer ( playerid ) ;
new Float: RandomSpawn [ ] [ 4 ] =
{
{ -1482.9537 , 442.8302 , 30.0820 , 235.5746 } ,
{ -1471.2516 , 338.4551 , 30.0859 , 319.5487 } ,
{ -1345.7300 , 337.5241 , 30.0859 , 45.0895 } ,
{ -1345.2181 , 444.5579 , 30.0859 , 134.7037 }
} ;
public OnFilterScriptInit ( )
{
return 1 ;
}
public OnFilterScriptExit ( )
{
return 1 ;
}
public OnPlayerConnect ( playerid )
{
return 1 ;
}
public OnPlayerDisconnect ( playerid , reason )
{
return 1 ;
}
public OnPlayerDeath ( playerid , killerid , reason )
{
if ( Sawnoff [ playerid ] == 1 )
{
pNums-- ;
}
if ( pNums < 1 )
{
GetPlayerName ( playerid , pname , sizeof ( pname ) ) ;
GetPlayerName ( killerid , kname , sizeof ( kname ) ) ;
format ( str , sizeof ( str ) , "%s have beaten %s in Sawnoff match!" , kname , pname ) ;
SendClientMessageToAll ( COLOR_RED , str ) ;
pNums = 0 ;
Sawnoff [ playerid ] = 0 ;
}
return 1 ;
}
public OnPlayerSpawn ( playerid )
{
return 1 ;
}
public OnPlayerCommandText ( playerid , cmdtext [ ] )
{
if ( strcmp ( cmdtext , "/sawnoff" , true ) == 0 )
{
if ( MatchStarted == 1 && Sawnoff [ playerid ] == 0 )
{
format ( str , sizeof ( str ) , "You have joined sawnoff match!" ) ;
SendClientMessage ( playerid , COLOR_RED , str ) ;
Sawnoff [ playerid ] = 1 ;
pNums++ ;
}
if ( Sawnoff [ playerid ] == 1 )
{
format( str , sizeof ( str ) , "Sorry, you already submitted the sawnoff match" ) ;
SendClientMessage ( playerid , COLOR_RED , str ) ;
}
if ( pNums > 4 && Sawnoff [ playerid ] == 0 )
{
format( str , sizeof ( str ) , "Sorry, the match had enough player to play." ) ;
SendClientMessage ( playerid , COLOR_RED , str ) ;
}
if ( MatchStarted == 0 )
{
format ( str , sizeof ( str ) , "Sawnoff match will start in 15 seconds. type /sawnoff to join." ) ;
SendClientMessageToAll ( COLOR_RED , str ) ;
Sawnoff [ playerid ] = 1 ;
MatchStarted = 1 ;
pNums++ ;
Timer = SetTimer ( "SawnoffMatchTimer" , 15000 , false ) ;
}
return 1 ;
}
return 0 ;
}
public SawnoffMatchTimer ( playerid )
{
if ( pNums > 2 && Sawnoff [ playerid ] == 1 )
{
new randomspawn = random ( sizeof ( RandomSpawn ) ) ;
format ( str , sizeof ( str ) , "The Match Started successfully" ) ;
SendClientMessage ( playerid , COLOR_RED , str ) ;
SetPlayerPos ( playerid , RandomSpawn [ randomspawn ] [ 0 ] , RandomSpawn [ randomspawn ] [ 1 ] , RandomSpawn [ randomspawn ] [ 2 ] ) ;
SetPlayerFacingAngle ( playerid , RandomSpawn [ randomspawn ] [ 3 ] ) ;
SetPlayerHealth ( playerid , 100.0 ) ;
SetPlayerArmour ( playerid , 100.0 ) ;
ResetPlayerWeapons ( playerid ) ;
GivePlayerWeapon ( playerid , 28 , 99999 ) ;
GivePlayerWeapon ( playerid , 26 , 99999 ) ;
Sawnoff [ playerid ] = 1 ;
MatchStarted = 1 ;
}
if ( pNums < 2 && Sawnoff [ playerid ] == 1 )
{
format ( str , sizeof ( str ) , "Sorry not enough player" ) ;
SendClientMessage ( playerid , COLOR_RED , str ) ;
pNums = 0 ;
MatchStarted = 0 ;
Sawnoff [ playerid ] = 0 ;
}
KillTimer ( Timer ) ;
return 1 ;
}
public OnDialogResponse ( playerid , dialogid , response , listitem , inputtext [ ] )
{
return 1 ;
}