01.06.2011, 17:03
(
Последний раз редактировалось Shadoww5; 01.06.2011 в 19:46.
)
Pronto. Ta ae.
Nгo usei o seu codigo pois daria mais trabalho, entгo criei os meus proprios comandos:
#EDIT Testou ??
Nгo usei o seu codigo pois daria mais trabalho, entгo criei os meus proprios comandos:
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext,"/sCurar",true) == 0)
{
new pID, grana, Float:Vida, Float:XYZ[3], n[MAX_PLAYER_NAME], n2[MAX_PLAYER_NAME], str[128];
tmp = strtok(cmdtext, idx);
pID = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, -1,"USO: /sCurar [ID] [PRECO]");
tmp = strtok(cmdtext, idx);
grana = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, -1,"USO: /sCurar [ID] [PRECO]");
GetPlayerHealth(pID, Vida);
if(Vida >= 100) return SendClientMessage(playerid, -1,"O jogador jб estб com a vida completa.");
if(GetPVarInt(playerid,"Curando") == 1)) return SendClientMessage(playerid, -1,"Vocк jб estб curando alguem.");
if(GetPVarInt(pID,"Curando") == 1)) return SendClientMessage(playerid, -1,"O jogador jб estб sendo curado.");
GetPlayerPos(pID, XYZ[0], XYZ[1], XYZ[2]);
GetPlayerName(pID, n2, sizeof(n2));
GetPlayerName(playerid, n, sizeof(n));
if(!IsPlayerInRangeOfPoint(playerid, 5, XYZ[0], XYZ[1], XYZ[2]) return SendClientMessage(playerid, -1, "Vocк nгo estб proximo ao jogador.");
format(str, sizeof(str),"O jogador %s te ofereceu cura por %d dolбres. Para aceitar digite /aceitarcura.", n, grana);
SendClientMessage(pID,-1,str);
format(str, sizeof(str),"Vocк ofereceu cura para o jogador %s por %d dolбres. Aguarde atй que ele aceite.", n2, grana);
SendClientMessage(playerid,-1,str);
SetPVarInt(playerid,"Curando", 1);
SetPVarInt(pID,"Curando", 1);
SetPVarInt(pID,"User",playerid);
SetPVarInt(pID,"Valor",grana);
return 1;
}
if(strcmp(cmdtext,"/aceitarcura",true) == 0)
{
new n[MAX_PLAYER_NAME], n2[MAX_PLAYER_NAME], str[128];
if(GetPVarInt(playerid,"Curando") == 0) return SendClientMessage(playerid, -1,"Ninguйm te ofereceu cura.");
GetPlayerName(GetPVarInt(playerid,"User"), n, sizeof(n));
GetPlayerName(playerid, n2, sizeof(n2));
format(str, sizeof(str),"Vocк foi curado por %s no valor de %d dolбres.", n, GetPVarInt(playerid,"Valor"));
SendClientMessage(playerid, -1, str);
format(str, sizeof(str),"Vocк curou %s por %d dolбres.", n2, GetPVarInt(playerid,"Valor"));
SendClientMessage(playerid, -1, str);
GivePlayerMoney(playerid, -GetPVarInt(playerid,"Valor"));
GivePlayerMoney(GetPVarInt(playerid,"User"), GetPVarInt(playerid,"Valor"));
SetPlayerHealth(playerid,100.0);
SetPVarInt(GetPVarInt(playerid, "User"), "Curando", 0);
SetPVarInt(playerid, "Curando", 0);
DeletePVar(playerid,"Valor");
DeletePVar(playerid,"User");
return 1;
}
return 0;
}