08.05.2014, 10:34
pawn Code:
for(new i = 0; i < GetMaxPlayers(); i++)
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if(IsPlayerConnected(playerid) && spawned[playerid] == 1)
{
pInfo[playerid][DaysAlive] ++;
if(pInfo[playerid][DaysAlive] == 1)
{
if(online != 1)
{
pInfo[playerid][birthdays] ++;
new pmoney, randcash,playername[100];
pmoney = GetPlayerMoney(i);
GetPlayerName(playerid,playername, sizeof(playername));
randcash = random(pmoney);
GiveCashToPlayer(playerid,-randcash);
GivePlayerMoney(playerid, randcash);
SCM(playerid,COLOR_ORANGE,"Happy Birth Day");
new str[500],str1[500];
format(str,sizeof(str),"~g~h~Happy ~b~~h~Birth ~P~H~Day~N~~W~Recived ~G~$%d",randcash);
GameTextForPlayer(playerid,str,5000,3);
format(str1,sizeof(str1),"~g~h~Happy ~b~~h~Birth ~P~H~Day~N~~W~%s(%d)~N~Sent ~G~$%d",playername,playerid,randcash);
GameTextForAllBut(playerid,str1,5000,3);
format(string,sizeof(string),"~P~~H~HAPPY BIRH DAY ~W~%s(%d) ~B~~H~is now ~R~~H~%d ~B~~H~years old",playername,playerid,pInfo[playerid][birthdays]);
TextDrawSetString(Textdraw222,string);
TextDrawShowForAll(Textdraw222);
AUTO_SAVE(playerid);
}
}
}
}
}
pawn Code:
forward GiveCashToPlayer(playerid,const money);
public GiveCashToPlayer(playerid,const money)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(!IsPlayerConnected(i)) continue;
if(playerid == i) continue;
GivePlayerMoney(i,money);
}
}
pawn Code:
forward GameTextForAllBut(playerid, const text[],time,style);
public GameTextForAllBut(playerid, const text[],time,style)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(!IsPlayerConnected(i)) continue;
if(playerid == i) continue;
GameTextForPlayer(i,text,time,style);
}
}
pawn Code:
forward TextDrawShowForAllBut(playerid,const Text:TextDraw);
public TextDrawShowForAllBut(playerid,const Text:TextDraw)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(!IsPlayerConnected(i)) continue;
if(playerid == i) continue;
TextDrawShowForPlayer(i,TextDraw);
}
}
e.g
An player got $1 it will take random amount from him 1 or 0 not 2-onward
pawn Code:
format(str1,sizeof(str1),"~g~h~Happy ~b~~h~Birth ~P~H~Day~N~~W~%s(%d)~N~Sent ~G~$%d",playername,playerid,randcash);
GameTextForAllBut(playerid,str1,5000,3);
Then the amount we get from all online player give it to player who got birthday
pawn Code:
GivePlayerMoney(playerid, randcash);
format(str,sizeof(str),"~g~h~Happy ~b~~h~Birth ~P~H~Day~N~~W~Recived ~G~$%d",randcash);
GameTextForPlayer(playerid,str,5000,3);
Help me here too
https://sampforum.blast.hk/showthread.php?tid=511647