SA-MP Forums Archive
rob command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: rob command (/showthread.php?tid=171097)



rob command - [Lsrcr]Rafa - 25.08.2010

hello guys i want someone help me with the /rob [id] command.
please post it the pawn code for it... thanks


Re: rob command - LarzI - 25.08.2010

If you want someone to make the code for you, post in Script Request.


Re: rob command - gangstajoe - 25.08.2010

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if (strcmp(cmd, "/Rob", true) == 0)
{
new tmp[256];
tmp = strtok( cmdtext, idx );
new Float:X, Float:y, Float:z;
new Float:u, Float:v, Float:w;
GetPlayerPos(playerid, X, y, z);
GetPlayerPos(strval(tmp), u, v, w);
if(GetPlayerMoney(strval(tmp)) <= 0)
{
SendClientMessage(playerid,0xFFFFFF,"He don't have money, so he can't be robbed");
return 1;
}
else if(IsPlayerInRangeOfPoint(strval(tmp),10.0,X,y,z))
{
new Money1 = GetPlayerMoney(strval(tmp));
new Money2 = random(Money1);

SetPlayerSpecialAction(strval(tmp),SPECIAL_ACTION_ HANDSUP);
SendClientMessage(strval(tmp), 0xFFFFFF, "You've been robbed!");
GivePlayerMoney(strval(tmp), -Money2);
GivePlayerMoney(playerid, Money2);
return 1;
}
}
return 0;
}

Something like that?


Re: rob command - [Lsrcr]Rafa - 25.08.2010

hmm this is not soo good script have much errors !


Re: rob command - gangstajoe - 25.08.2010

Quote:
Originally Posted by [Lsrcr]Rafa
Посмотреть сообщение
hmm this is not soo good script have much errors !
yeah, i just noticed.
if you replace SPECIAL_ACTION_ HANDSUP with SPECIAL_ACTION_HANDSUP, and include a_samp and gl_common.inc, it will be ok.

the good version:
Quote:

#define FILTERSCRIPT

#include <a_samp>
#include "../include/gl_common.inc"

#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n------------------------");
print(" Rob Script Activated");
print("------------------------\n");
}
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if (strcmp(cmd, "/Rob", true) == 0)
{
new tmp[256];
tmp = strtok( cmdtext, idx );
new Float:X, Float:y, Float:z;
new Float:u, Float:v, Float:w;
GetPlayerPos(playerid, X, y, z);
GetPlayerPos(strval(tmp), u, v, w);
if(GetPlayerMoney(strval(tmp)) <= 0)
{
SendClientMessage(playerid,0xFFFFFF,"He don't have money, so he can't be robbed");
return 1;
}
else if(IsPlayerInRangeOfPoint(strval(tmp),10.0,X,y,z))
{
new Money1 = GetPlayerMoney(strval(tmp));
new Money2 = random(Money1);

SetPlayerSpecialAction(strval(tmp),SPECIAL_ACTION_ HANDSUP);
SendClientMessage(strval(tmp), 0xFFFFFF, "You've been robbed!");
GivePlayerMoney(strval(tmp), -Money2);
GivePlayerMoney(playerid, Money2);
return 1;
}
}
return 0;
}




Re: rob command - [Lsrcr]Rafa - 25.08.2010

again have error but i fix it
btw thanks


Re: rob command - gangstajoe - 25.08.2010

Quote:
Originally Posted by [Lsrcr]Rafa
Посмотреть сообщение
again have error but i fix it
btw thanks
hm, i didn't get any errors, but ok..
you're welcome


Re: rob command - [Lsrcr]Rafa - 25.08.2010

can i have ur msn or something u have pm me if u want to tell me
i aprecitate this man