for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GivePlayerMoney(i,5000);
}
}
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GivePlayerMoney(i,5000);
break;
}
}
GivePlayerMoney(playerid, 5000);
|
If you don't want to give all players money, remove the loop that goes through all players!
|
public OnPlayerConnect(playerid)
{
SetTimerEx("OneSecondPlayerTimer",1000,true,"d",playerid);
return 1;
}
|
I don't know, did you TEST it on YOUR hardware? I can tell you if that's laggy or not on MY PC, but that's completely useless information for you!
|
//at top
new GetsMoney[MAX_PLAYERS];
//your timer()
for(new i=0; i<MAX_PLAYERS; i++)
{
if(GetsMoney[i]>0)
{
// GivePlayerMoney(i,5000);
GivePlayerMoney(i,GetsMoney[i]);
GetsMoney[i]=0;//after a player recieved money once, set it to 0 to avoid getting cash each time
}
}
CMD:recieve(playerid,params[]){
new targetid,amount;
if(sscanf(params,"uD(1000)",targetid,amount))
{
SendClientMessage(playerid,0xff5555ff,"/recieve <id> [amount]");
return 1;
}
GetsMoney[i]=amount;//to be stored in the array + synced in the next timer loop
SendClientMessage(playerid,0x55ff55ff,"Money sent.");
return 1;
}
public OnPlayerConnect(playerid)
{
GetsMoney[i]=1000;
return 1;
}
GetsMoney[i]=0;