20.05.2010, 13:54
Peguei de um gm
pawn Код:
new giveplayerid, moneys, idx;
new giveplayer[MAX_PLAYER_NAME];
new sendername[MAX_PLAYER_NAME];
new playermoney;
new tmp[256];
if(strcmp(cmd, "/transferir", true) == 0) {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COR_BRANCO, "Use: /pagar [id] [quantidade]");
return 1;
}
giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COR_BRANCO, "Use: /pagar [id] [quantidade]");
return 1;
}
moneys = strval(tmp);
if (IsPlayerConnected(giveplayerid)) {
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = GetPlayerMoney(playerid);
if (moneys > 0 && playermoney >= moneys) {
GivePlayerMoney(playerid, (0 - moneys));
GivePlayerMoney(giveplayerid, moneys);
format(string, sizeof(string), "Voce enviou %s (id: %d), $%d.", giveplayer,giveplayerid, moneys);
SendClientMessage(playerid, COR_BRANCO, string);
format(string, sizeof(string), "Vocк recebeu $%d de %s (id: %d).", moneys, sendername, playerid);
SendClientMessage(giveplayerid, COR_BRANCO, string);
printf("%s(playerid:%d) transferiu %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
}
else {
SendClientMessage(playerid, COR_BRANCO, "Erro ao pagar jogador");
}
}
else {
format(string, sizeof(string), "%d nгo estб online", giveplayerid);
SendClientMessage(playerid, COR_BRANCO, string);
}
return 1;
}