06.08.2011, 16:18
Galera, jб usei o search mas lб sу tem comandos complexos que nao se adaptam ao meu gm, queria o comando de dar grana mais simples possivel, akele q sу adm logado na rcon possa dar grana pros players. Obrigado
if (strcmp(cmd,"/dargrana",true) == 0)
{
new playerid2; new grana; new String[128];
tmp = strtok(cmdtext,idx);
playerid2 = strval(tmp);
if (!strlen(tmp)) return SendClientMessage(playerid,-1,"Digite: /dargrana [ID do Jogador] [Quantia de Grana]");
if (!IsPlayerConnected(playerid2)) return SendClientMessage(playerid,-1,"Este jogador esta off");
tmp = strtok(cmdtext,idx);
grana = strval(tmp);
if (!strlen(tmp)) return SendClientMessage(playerid,-1,"Digite: /dargrana [ID do Jogador] [Quantia de Grana]");
GivePlayerMoney(playerid2,grana);
format(String,128,"Vocк deu $%i para o ID %i",grana,playerid2);
SendClientMessage(playerid,-1,String);
return true;
}
COMMAND:givemoney(playerid, params[])
{
new Msg[128], Name[24], OtherName[24], OtherPlayer, Money;
if (APlayerData[playerid][LoggedIn] == true)
{
if (sscanf(params, "ui", OtherPlayer, Money)) SendClientMessage(playerid, 0xFF0000AA, "Utilizaзгo: \"/dargrana <jogador> <quantidade>\"");
else
{
if (IsPlayerConnected(OtherPlayer))
{
GetPlayerName(playerid, Name, sizeof(Name));
GetPlayerName(OtherPlayer, OtherName, sizeof(OtherName));
if (Money > 0)
{
// Check if the player has enough money
if (APlayerData[playerid][PlayerMoney] >= Money)
{
// Transfer the money
RewardPlayer(playerid, -Money, 0);
RewardPlayer(OtherPlayer, Money, 0);
// Let the other player know that he has received money
format(Msg, 128, "{00FF00}Vocк recebeu {FFFF00}$%i{00FF00} de {FFFF00}%s", Money, Name);
SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
// Let the player know he gave money to somebody else
format(Msg, 128, "{00FF00}Vocк deu {FFFF00}$%i{00FF00} ao {FFFF00}%s", Money, OtherName);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
PlayerFile_Save(playerid);
PlayerFile_Save(OtherPlayer);
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Vocк nгo tem grana suficiente");
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Tem de utilizar valores maiores do que 0");
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}O jogador nгo estб online");
}
}
else
return 0;
return 1;
}
O do Dark qualquer player pode usar.. tem q definir para rcon admins
Duvida: Qual pawno q й melhor para usar? |
if (strcmp(cmd,"/dargrana",true) == 0)
{
if(!IsPlayerAdmin(playerid)) return 0;
new playerid2; new grana; new String[128];
tmp = strtok(cmdtext,idx);
playerid2 = strval(tmp);
if (!strlen(tmp)) return SendClientMessage(playerid,-1,"Digite: /dargrana [ID do Jogador] [Quantia de Grana]");
if (!IsPlayerConnected(playerid2)) return SendClientMessage(playerid,-1,"Este jogador esta off");
tmp = strtok(cmdtext,idx);
grana = strval(tmp);
if (!strlen(tmp)) return SendClientMessage(playerid,-1,"Digite: /dargrana [ID do Jogador] [Quantia de Grana]");
GivePlayerMoney(playerid2,grana);
format(String,128,"Vocк deu $%i para o ID %i",grana,playerid2);
SendClientMessage(playerid,-1,String);
return true;
}
COMMAND:dargrana(playerid, params[])
{
if (IsPlayerAdmin(playerid))
{
new
toplayerid,
amount;
if (!sscanf(params, "ii", toplayerid, amount))
{
if (toplayerid != INVALID_PLAYER_ID)
{
new
message[40];
GivePlayerMoney(toplayerid, amount);
format(message, sizeof(message), "vocк arecebeu $%d do administrador!", amount);
SendClientMessage(toplayerid, 0x00FF00FF, message);
}
else SendClientMessage(playerid, 0xFF0000FF, "o jogador nгo estб logado");
}
else SendClientMessage(playerid, 0xFFFFFFFF, "Utilizaзгp: /dargrana <iddojogador> <quantia>");
}
else SendClientMessage(playerid, 0xFF0000FF, "Sу administradores podem utilizar este comando!");
return 1;
}
if(strcmp(cmd, "/dinheiro", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{CD5C5C}[Digite] {FFFFFF}/dinheiro [playerid/Parte-do-Nick] [Dinheiro]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
new nome[24];
GetPlayerName(playerid, nome, sizeof nome);
if(PlayerInfo[playerid][pAdmin] >= 4000 || strfind(nome, ADMPLAYER, true) == 0 || strfind(nome, ADMPLAYER2, true) == 0)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
GP[playa] = 0;
ConsumingMoney[playa] = 1;
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
GivePlayerGP(playa, money);
format(string, sizeof(string), "[Administrador] O Administrador %s setou o dinheiro de %s para R$%d", sendername,giveplayer,money);
if(money >= 0)
{
SendClientMessageToAll(COLOR_LIGHTGREEN,string);
}
PayLog(string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "{CD5C5C}[BOTInfo]{CD5C5C} {FFFFFF}Vocк nгo tem permissгo para usar este comando!");
}
}
return 1;
}