Processing Payday Code For Everybody Problem(Timer,playerid)
#1

Hello friend im trying to process a payday timer but apparently it doesnt give payday to everybody. Only i seem to get it as id 0 so id 1 and others dont get it.. Also same problem exists with command /id which only can show id 0 but not id 1 and others..

My Codes:
Код:
SetTimer("payday", 30000 ,1); //on game mode init

forward payday(playerid);
public payday(playerid)
{
	new savingsmoney,Text[200],bankmoney;
	if (!INGAME[playerid][LOGIN]) {
	    format(Text,sizeof(Text),"You Need To Login Before Doing Anything.");
		SendClientMessage(playerid,COLOR_RED,Text);
	}
	else {
		USER[playerid][EXP] = USER[playerid][EXP]+1;
		savingsmoney = (USER[playerid][SAVINGS]/100)*5;
		bankmoney = (USER[playerid][BANK]/100)*2;
		USER[playerid][SAVINGS] = USER[playerid][SAVINGS]+savingsmoney;
		USER[playerid][BANK] = USER[playerid][BANK]+bankmoney;
		format(Text,sizeof(Text),"---------------------------------------------");
		SendClientMessage(playerid, -1, Text);
		format(Text,sizeof(Text),"You Have Earned 1 Experience Point On PayDay");
		SendClientMessage(playerid, -1, Text);
		format(Text,sizeof(Text),"Your New Bank Balance Is: %d",USER[playerid][BANK]);
		SendClientMessage(playerid, -1, Text);
		format(Text,sizeof(Text),"Your New Savings Balance Is: %d",USER[playerid][SAVINGS]);
		SendClientMessage(playerid, -1, Text);
		format(Text,sizeof(Text),"---------------------------------------------");
		SendClientMessage(playerid, -1, Text);
	}
	return 1;
}

CMD:id(playerid, params[])
{
	new id,string[150],name[24],pname[24];
	if(sscanf(params, "u", name)) return SendClientMessage(playerid,-1,"Usage: /id [name]");
	id = GetPlayerID(name);
	GetPlayerName(id,pname,24);
	format(string,sizeof(string),"%d %s",id,pname);
	SendClientMessage(playerid,COLOR_LIGHTGRAY,string);
	return 1;
}

stock GetPlayerID(const Name[])
{
	for(new i; i<MAX_PLAYERS; i++)
	{
	  if(IsPlayerConnected(i))
	  {
	    new pName2[MAX_PLAYER_NAME];
			GetPlayerName(i, pName2, sizeof(pName2));
	    if(strcmp(Name, pName2, true)==0)
	    {
	      return i;
			}
		}
	}
	return -1;
}
Any Help Is Appreciated
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)