PayDay
#1

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.
Reply
#2

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." );
        }
    }
}
Reply
#3

ok i will try thanks.
Reply
#4

ScRipTeRi just remove first return 1;

pds2k12 should be

pawn Код:
if ( !IsPlayerConnected(i) || IsPlayerSpawn[i] == 0 )continue;
Reply
#5

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
Reply
#6

But player can be connected and NOT spawned ;p

so

if player is not connected OR not spawned we cointinue
Reply
#7

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.
Reply
#8

Yup and in your code not spawned player takes paycheck
Reply
#9

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;
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)