PayDay -
ScRipTeRi - 24.12.2013
Hello i have create a payday only for Police and problem is money come just to me no to other player here is the code
pawn Код:
public OnGameModeInit()
{
SetTimer("PayDay",540000,1);
return 1;
}
forward PayDay();
public PayDay()
{
for(new i=0; i<MAX_PLAYERS_; i++)
{
if(!IsPlayerConnected(i))continue;
if(gTeam[i] == TEAM_SWAT || gTeam[i] == TEAM_ARMY)
{
if(IsPlayerSpawn[i] == 0)continue;
GivePlayerMoney(i, 1000);
SendClientMessage(i,0xE89B5BBB,"» Police daily paycheck: $1000.");
return 1;
}
}
return 1;
}
Thank you.
Re: PayDay - Patrick - 24.12.2013
This could should work, it maybe the size of
MAX_PLAYERS_
pawn Код:
public OnGameModeInit()
{
SetTimer( "PayDay", 540000, 1 );
return 1;
}
forward PayDay( );
public PayDay( )
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if ( !IsPlayerConnected(i) && IsPlayerSpawn[i] == 1 )continue;
if( gTeam[ i ] == TEAM_SWAT || gTeam[ i ] == TEAM_ARMY)
{
GivePlayerMoney( i, 1000 );
SendClientMessage( i, 0xE89B5BBB, "» Police daily paycheck: $1000." );
}
}
}
Re: PayDay -
ScRipTeRi - 24.12.2013
ok i will try thanks.
Re: PayDay -
Jefff - 24.12.2013
ScRipTeRi just remove first return 1;
pds2k12 should be
pawn Код:
if ( !IsPlayerConnected(i) || IsPlayerSpawn[i] == 0 )continue;
Re: PayDay - Patrick - 24.12.2013
Quote:
Originally Posted by Jefff
ScRipTeRi just remove first return 1;
pds2k12 should be
pawn Код:
if ( !IsPlayerConnected(i) || IsPlayerSpawn[i] == 0 )continue;
|
Yes, You could that but, I think he wants to check if the player is
connected AND spawned, not
connected OR spawned
Re: PayDay -
Jefff - 24.12.2013
But player can be connected and NOT spawned ;p
so
if player is not connected OR not spawned we cointinue
Re: PayDay - Patrick - 24.12.2013
Quote:
Originally Posted by Jefff
But player can be connected and NOT spawned ;p
so
if player is not connected OR not spawned we cointinue
|
Yes, but to be able to recieve a paycheck, you must be spawned and connected.
Re: PayDay -
Jefff - 24.12.2013
Yup and in your code not spawned player takes paycheck
Re: PayDay - Patrick - 24.12.2013
Quote:
Originally Posted by Jefff
Yup and in your code not spawned player takes paycheck
|
Wow, just realised that, thanks :P
Fixed
pawn Код:
if ( !IsPlayerConnected(i) && IsPlayerSpawn[i] == 1 ) continue;
Re: PayDay -
ScRipTeRi - 24.12.2013
Quote:
Originally Posted by pds2k12
This could should work, it maybe the size of MAX_PLAYERS_
pawn Код:
public OnGameModeInit() { SetTimer( "PayDay", 540000, 1 ); return 1; }
forward PayDay( ); public PayDay( ) { for(new i = 0; i < MAX_PLAYERS; i++) { if ( !IsPlayerConnected(i) && IsPlayerSpawn[i] == 1 )continue; if( gTeam[ i ] == TEAM_SWAT || gTeam[ i ] == TEAM_ARMY) { GivePlayerMoney( i, 1000 ); SendClientMessage( i, 0xE89B5BBB, "» Police daily paycheck: $1000." ); } } }
|
i test this and work perfect thanks again.