25.08.2010, 10:13
hello guys i want someone help me with the /rob [id] command.
please post it the pawn code for it... thanks
please post it the pawn code for it... thanks
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; } |
#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; } |