08.02.2009, 03:56
For starters:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[256];
new playermoney;
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new playername[MAX_PLAYER_NAME];
new cmd[256];
new tmp[256];
new giveplayerid, moneys, idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/wb", true) == 0) && PlayerToPoint(1.5 ,playerid,2305.6890,-16.0881,26.7496))
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid])
{
if(PlayerInfo[playerid][pLeader] == 7)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "NAUDOJIMAS: /wb [pinigu suma]");
new
takeamount = strval(tmp),
name[MAX_PLAYER_NAME];
if(takeamount > biudzetas)
{
SendClientMessage(playerid, COLOR_GREY, " Biudzete tiek pinigu nera.");
format(string, sizeof(string), "Dabartinis biudzetas: [$%d]", biudzetas);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
if(takeamount < 0) return 1;
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
biudzetas -= takeamount;
format(string, sizeof(string), "Meras %s nueme [$%d] is biudzeto (Biudzete liko: $%d).", name, takeamount, biudzetas);
SendClientMessageToAll(COLOR_WHITE, string);
GivePlayerMoney(playerid, takeamount);
SaveStuff();
}
else SendClientMessage(playerid, COLOR_GREY, " Tu neesi meras !");
}
}
return 1;
}
if(strcmp(cmd, "/db", true) == 0) && PlayerToPoint(1.5 ,playerid,2305.6890,-16.0881,26.7496))
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid])
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "NAUDOJIMAS: /db [pinigu suma]");
new
giveamount = strval(tmp),
name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
if(giveamount < 1 || giveamount > 999999) return SendClientMessage(playerid, COLOR_GREY, " Bloga pinigu suma !");
if(giveamount > GetPlayerMoney(playerid)) return SendClientMessage(playerid, COLOR_GREY, " Jus neturite tiek pinigu !");
biudzetas += giveamount;
format(string, sizeof(string), "%s idejo $%d i biudzeta (Dabartinis biudzetas: %d$)", name, giveamount, biudzetas);
SendClientMessageToAll(COLOR_WHITE, string);
GivePlayerMoney(playerid, -giveamount);
SaveStuff();
}
SendClientMessage(playerid, COLOR_ORANGE, " Jus neasate banke! ");
}
return 1;
}