/stealmoney problem! -
Addons - 05.07.2013
Hi. I've big problem with my command, i try everything, but no effect. I mean that when I use this command she work without "victim" and "player" will receive money.
Command:
Код:
//---------------------------------[STEAL MONEY-THIEVES]--------------------//
if(strcmp(cmd, "/stealmoney", true) == 0)
{
if(PlayerInfo[playerid][pMember] + PlayerInfo[playerid][pLeader] == 7)
{
new victima = GetClosestPlayer(playerid);
if(GetDistanceBetweenPlayers(playerid,victima) < 3)
{
if(StealTimer[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "* Asteapta 5 minute pentru a putea folosi din nou aceasta comanda!");
return 1;
}
SetTimerEx("StealReset", 300000, false, "i", playerid);
new smoney = random(5000);
new nume1[24];
new nume2[24];
GetPlayerName(victima, nume2, sizeof(nume2));
GetPlayerName(playerid, nume1, sizeof(nume1));
format(string, sizeof(string), "%s ti-a furat din portofel {32CD32}%d${FFFFFF}!", nume1, smoney);
SendClientMessage(target, COLOR_WHITE, string);
format(string, sizeof(string), "* Ai furat din portofelul lui %s suma de {32CD32}%d${FFFFFF}!", nume2, smoney);
SendClientMessage(playerid, COLOR_WHITE, string);
StealTimer[playerid] = 1;
GivePlayerMoney(playerid, smoney);
GivePlayerMoney(victima, -smoney);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Nu e nimeni langa tine!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Nu esti membru Thieves!");
return 1;
}
return 1;
}
PS: SOrry for my english, i'm romanian!
PS2: I will give rep. for solution!
Re: /stealmoney problem! -
Necip - 05.07.2013
I can't really understand your English, try telling it in a better way.You mean that both Victim and Player get money?Or that the command doesn't do anything?
Re: /stealmoney problem! -
Akira297 - 05.07.2013
Код:
new nume2[24];
GetPlayerName(victima, nume2, sizeof(nume2));
GetPlayerName(playerid, nume1, sizeof(nume1));
format(string, sizeof(string), "%s ti-a furat din portofel {32CD32}%d${FFFFFF}!", nume1, smoney);
SendClientMessage(target, COLOR_WHITE, string);
format(string, sizeof(string), "* Ai furat din portofelul lui %s suma de {32CD32}%d${FFFFFF}!", nume2, smoney);
SendClientMessage(playerid, COLOR_WHITE, string);
StealTimer[playerid] = 1;
GivePlayerMoney(playerid, smoney);
GivePlayerMoney(victima, -smoney);
- I didn't change anything but remember to keep everything together. That includes spacing.
Re: /stealmoney problem! -
Addons - 05.07.2013
Ok, so: command should provide one who use it some money $$ from "victim". Victim must be in "thieves perimeter" to be robbed. Problem is if I type this command and there is none besides me all the work order and receive money.
For example, today was 1 player on my server (me)! I use /stealcommand and it work but in my perimeter don't was "victim". Message received was: "You steal 2541$ from [empty space]'s pocket!"
Now, you understand? My english was 'tormented'!
Re: /stealmoney problem! -
Necip - 05.07.2013
Do you have ProxDetector function?
Re: /stealmoney problem! -
Addons - 05.07.2013
Yep.
Re: /stealmoney problem! -
Necip - 05.07.2013
Get ProxDetectorS if you don't have it:
pawn Код:
ProxDetectorS(Float:radi, playerid, targetid) {
new
Float: fp_playerPos[3];
GetPlayerPos(targetid, fp_playerPos[0], fp_playerPos[1], fp_playerPos[2]);
if(IsPlayerInRangeOfPoint(playerid, radi, fp_playerPos[0], fp_playerPos[1], fp_playerPos[2]) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(targetid))
{
return 1;
}
return 0;
}
And here is the new code:
pawn Код:
if(strcmp(cmd, "/stealmoney", true) == 0)
{
if(PlayerInfo[playerid][pMember] + PlayerInfo[playerid][pLeader] == 7)
{
new victima;
if (ProxDetectorS(4.0, playerid, victima))
{
if(StealTimer[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "* Asteapta 5 minute pentru a putea folosi din nou aceasta comanda!");
return 1;
}
SetTimerEx("StealReset", 300000, false, "i", playerid);
new smoney = random(5000);
new nume1[24];
new nume2[24];
GetPlayerName(victima, nume2, sizeof(nume2));
GetPlayerName(playerid, nume1, sizeof(nume1));
format(string, sizeof(string), "%s ti-a furat din portofel {32CD32}%d${FFFFFF}!", nume1, smoney);
SendClientMessage(target, COLOR_WHITE, string);
format(string, sizeof(string), "* Ai furat din portofelul lui %s suma de {32CD32}%d${FFFFFF}!", nume2, smoney);
SendClientMessage(playerid, COLOR_WHITE, string);
StealTimer[playerid] = 1;
GivePlayerMoney(playerid, smoney);
GivePlayerMoney(victima, -smoney);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Nu e nimeni langa tine!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Nu esti membru Thieves!");
return 1;
}
return 1;
}
I am not really sure if this is going to work...
Re: /stealmoney problem! -
Addons - 05.07.2013
Oh, thanks. It work perfect!
PS: + rep, I hope you do not mind *laugh*!