Код:
dcmd_pay(playerid, params[])
{
new ReturnPlayer, pName[24], PlayerFile[50], ClientFile[50], ReturnUserName[24], pCash[50], str[128], str2[128], Value;
new Float:PX,Float:PY,Float:PZ;
GetPlayerName(playerid, pName, sizeof(pName));
format(PlayerFile, sizeof(PlayerFile), "/users/%s.ini", pName);
if(!dini_Exists(PlayerFile)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You aren't registered! Use /register to create an account.");
if(dini_Exists(PlayerFile))
{
if(sscanf(params, "dd", ReturnPlayer, Value))
{
if(IsPlayerConnected(ReturnPlayer))
{
GetPlayerPos(ReturnPlayer,PX,PY,PZ);
if(IsPlayerInRangeOfPoint(playerid,5,PX,PY,PZ))
{
GetPlayerName(ReturnPlayer, ReturnUserName, sizeof(ReturnUserName));
format(ClientFile, sizeof(ClientFile), "/users/%s.ini", ReturnUserName);
if(dini_Exists(ClientFile))
{
pCash[24] = GetPlayerMoney(playerid);
if(Value <= pCash[24] && Value >= 1)
{
GetPlayerName(ReturnPlayer, ReturnUserName, sizeof(ReturnUserName));
GivePlayerMoney(ReturnPlayer, Value);
GivePlayerMoney(playerid, -Value);
PlayerInfo[playerid][Money] -= Value;
PlayerInfo[ReturnPlayer][Money] += Value;
dini_IntSet(PlayerFile, "Money", PlayerInfo[playerid][Money]);
dini_IntSet(ClientFile, "Money", PlayerInfo[ReturnPlayer][Money]);
format(str,sizeof(str), "%s has given you $%d",pName, Value);
SendClientMessage(ReturnPlayer, COLOR_WHITE,str);
format(str2,sizeof(str2), "You have given %s $%d", ReturnUserName, Value);
SendClientMessage(playerid, COLOR_WHITE, str2);
}
else
{
SendClientMessage(playerid, COLOR_BRIGHTRED, "You dont have enough money!");
}
}
else
{
SendClientMessage(playerid, COLOR_BRIGHTRED, "The player you wish to give money to is not registerd!");
}
}
else
{
SendClientMessage(playerid, COLOR_BRIGHTRED, "You are not close enough to that player!");
}
}
else
{
SendClientMessage(playerid, COLOR_BRIGHTRED, "Invalid playerid.");
}
}
else
{
SendClientMessage(playerid, COLOR_BRIGHTRED, "Usage: /pay [Playerid] [Ammount]");
}
}
return 1;
}
It compiles, whan you do: /pay it says you dont have wnought money (should say Usage
when you do: /pay 0 , it says your not close enought or something....