12.01.2016, 18:59
Galera achei esse FS de quando morrer a grana ficar no chгo
mais quando ele morre a grana vai para o chгo e tais na hora de pegar ele recebe 3x a mais alguйm sabe resolver?
mais quando ele morre a grana vai para o chгo e tais na hora de pegar ele recebe 3x a mais alguйm sabe resolver?
pawn Код:
#include <a_samp>
#define MAX_DINHEIRO 300000
#define MAX_GRANA 10000
new Dinheiro[3][MAX_DINHEIRO];
new Grana[MAX_GRANA];
new Timer[MAX_PLAYERS];
forward PegandoGrana(playerid);
public OnPlayerDeath(playerid, killerid, reason)
{
new Float:X,Float:Y,Float:Z;
for(new i = 0; i != MAX_DINHEIRO; i++)
{
GetPlayerPos(playerid, X, Y, Z);
if(GetPlayerMoney(playerid) >= 100000)
{
Dinheiro[0][i] = CreateObject(1210, X, Y, Z-1,-90,0,0);
for(new g = 0; g != MAX_GRANA; g++)
{
Grana[g] = 100000;
}
SetPVarInt(playerid, "GranaDoJogador", GetPlayerMoney(playerid));
GivePlayerMoney(playerid, -GetPVarInt(playerid,"GranaDoJogador"));
return 1;
}
if(GetPlayerMoney(playerid) >= 10000)
{
Dinheiro[0][i] = CreateObject(1212, X, Y, Z-1,0,0,0);
Dinheiro[1][i] = CreateObject(1212, X+1, Y, Z-1,0,0,0);
Dinheiro[2][i] = CreateObject(1212, X, Y-1, Z-1,0,0,0);
SetPVarInt(playerid, "GranaDoJogador", GetPlayerMoney(playerid));
GivePlayerMoney(playerid, -GetPVarInt(playerid,"GranaDoJogador"));
for(new g = 0; g != MAX_GRANA; g++)
{
Grana[g] = 10000;
}
return 1;
}
if(GetPlayerMoney(playerid) >= 1000)
{
Dinheiro[0][i] = CreateObject(1212, X, Y, Z-1,0,0,0);
Dinheiro[1][i] = CreateObject(1212, X+1, Y, Z-1,0,0,0);
SetPVarInt(playerid, "GranaDoJogador", GetPlayerMoney(playerid));
GivePlayerMoney(playerid, -GetPVarInt(playerid,"GranaDoJogador"));
for(new g = 0; g != MAX_GRANA; g++)
{
Grana[g] = 1000;
}
return 1;
}
if(GetPlayerMoney(playerid) >= 100)
{
Dinheiro[0][i] = CreateObject(1212, X, Y, Z-1,0,0,0);
SetPVarInt(playerid, "GranaDoJogador", GetPlayerMoney(playerid));
GivePlayerMoney(playerid, -GetPVarInt(playerid,"GranaDoJogador"));
for(new g = 0; g != MAX_GRANA; g++)
{
Grana[g] = 100;
}
return 1;
}
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/pegargrana", cmdtext, true, 10) == 0)
{
new Float:X,Float:Y,Float:Z;
for(new i = 0; i != MAX_DINHEIRO; i++)
{
if(GetObjectPos(Dinheiro[i][i], X, Y, Z))
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, X, Y, Z))
{
ApplyAnimation(playerid, "BOMBER", "BOM_Plant_Crouch_Out", 4.0, 1, 0, 0, 0, 0);
Timer[playerid] = SetTimerEx("PegandoGrana", 900, 0, "i", playerid);
return 1;
}
}
else
{
SendClientMessage(playerid, -1, "<{FF0000}!{FFFFFF}> Nгo ha nada no chгo!");
return 1;
}
}
return 1;
}
return 0;
}
public PegandoGrana(playerid)
{
new Float:X,Float:Y,Float:Z;
for(new i = 0; i != MAX_DINHEIRO; i++)
{
GetPlayerPos(playerid, X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 3.0, X, Y, Z))
{
if(GetObjectModel(Dinheiro[i][i]))
{
DestroyObject(Dinheiro[0][i]);
DestroyObject(Dinheiro[1][i]);
DestroyObject(Dinheiro[2][i]);
KillTimer(Timer[playerid]);
ClearAnimations(playerid);
for(new g = 0; g != MAX_GRANA; g++)
{
GivePlayerMoney(playerid, Grana[g]);
}
}
}
}
return 1;
}