robber system
#10

Try this, it's just the /taze command from a RP script which I modified.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new giveplayername[MAX_PLAYER_NAME];
    new sendername[MAX_PLAYER_NAME];

    if(strcmp("/rob", cmdtext, true, 10) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        if(IsPlayerInAnyVehicle(playerid))
            {
              SendClientMessage(playerid, COLOR_GREY, "You cannot rob someone while being in a Car!");
              return 1;
            }
            new victim = GetClosestPlayer(playerid);
            if(IsPlayerConnected(victim))
            {
                if(GetDistanceBetweenPlayers(playerid,victim) < 5)
                {
                  if(IsPlayerInAnyVehicle(victim))
                  {
                    SendClientMessage(playerid, COLOR_GREY, "You cannot rob someone who is in a car!");
                    return 1;
                  }
                  GetPlayerName(victim, giveplayername, sizeof(giveplayername));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    new randt = random(4)+1;
                    if(randt == 1)
                    {
                      format(string, sizeof(string), "* %s shoots with his Tazer at %s, but missed.", sendername ,giveplayername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    }
                    else
                    {
                        format(string, sizeof(string), "* You were robbed by %s.", sendername);
                        SendClientMessage(victim, COLOR_WHITE, string);
                        format(string, sizeof(string), "* You robbed %s and stole $$s.", giveplayername, GetPlayerMoney(victim));
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        format(string, sizeof(string), "* %s puts his hand into %s 's pocket and steals his money.", sendername ,giveplayername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        GameTextForPlayer(victim, "~r~Robbed", 2500, 3);
                        GivePlayerMoney(playerid, GetPlayerMoney(victim));
                        ResetPlayerMoney(victim, 0);
                    }
                    else
                    {
                      SendClientMessage(playerid, COLOR_GREY, "  No-one near you!");
                      return 1;
                    }
                }
            }
        }
        return 1;
    }
    return 0;
}
EDIT:
Indentation looks bad on the forums but you can fix that yourself.
Reply


Messages In This Thread
robber system - by sggassasin - 28.07.2009, 04:55
Re: robber system - by Abernethy - 28.07.2009, 04:56
Re: robber system - by Joe Staff - 28.07.2009, 05:04
Re: robber system - by sggassasin - 28.07.2009, 05:06
Re: robber system - by Abernethy - 28.07.2009, 05:14
Re: robber system - by sggassasin - 28.07.2009, 05:24
Re: robber system - by Abernethy - 28.07.2009, 05:52
Re: robber system - by sggassasin - 28.07.2009, 06:10
Re: robber system - by sggassasin - 28.07.2009, 06:31
Re: robber system - by Gappy - 28.07.2009, 06:34
Re: robber system - by sggassasin - 28.07.2009, 06:46
Re: robber system - by Gappy - 28.07.2009, 07:01
Re: robber system - by sggassasin - 28.07.2009, 08:00
Re: robber system - by sggassasin - 28.07.2009, 08:21
Re: robber system - by XtremeChio - 28.07.2009, 08:23
Re: robber system - by Gappy - 28.07.2009, 08:24
Re: robber system - by sggassasin - 28.07.2009, 08:46
Re: robber system - by Gappy - 28.07.2009, 08:51
Re: robber system - by sggassasin - 28.07.2009, 09:02
Re: robber system - by Gappy - 28.07.2009, 09:14

Forum Jump:


Users browsing this thread: 3 Guest(s)