Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Snippet Showroom => Topic started by: aledark24 on December 26, 2012, 08:03:59 pm

Title: [new command] rob in the street xD
Post by: aledark24 on December 26, 2012, 08:03:59 pm
[pawn]new Billetera[MAX_PLAYERS];[/pawn]

[pawn]     else if (strcmp(cmd, "rob", true) == 0) {
      tmp = strtok( cmdtext, idx ); new plr = FindPlayerIDFromString( tmp );
            if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Please log-in to your account." );
      else if ( !strlen( tmp ) ) SendClientMessage( playerid, COLOR_GREEN, "USAGE: /c rob [Nick/ID]" );
      else if ( plr == INACTIVE_PLAYER_ID ) SendClientMessage( playerid, COLOR_RED, "Error: Unknown player" );
      else if ( !IsPlayerSpawned( plr ) ) SendClientMessagef( playerid, COLOR_GREEN, "Error: %s does not spawned!", gPlayers[ plr ] );
       else if(!NeedPlayerInArea(playerid,-1120.6895,-809.5638,-693.6281,-137.1244)) SendClientMessage(playerid, GREEN,"[Error] - You can only steal in an area near the bank");
       else {
       
              new Float:RX, Float:RY, Float:RZ, szMsg[256];
                  GetPlayerPos(playerid,RX,RY,RZ);
                  if(PlayerToPoint(3.0,plr,RX,RY,RZ))
                        format( szMsg, sizeof( szMsg ), "%s is stealing the wallet of %s", gPlayers[playerid],gPlayers[plr]);
         SendClientMessageToAll( COLOR_RED, szMsg );
              SetTimer("robando", 7000, false);
                  TogglePlayerControllable(playerid,0);
                  IncPlayerHandCash(playerid,150);
              DecPlayerHandCash(plr,150);
             Billetera[playerid] = 1;
              SetPlayerMarker(playerid,15);
         }
      return 1;
   }[/pawn]

HEM is not finish yet because contain one bug if the player "plr" not is in the area = disccount money xD
 

Stock AND public
[pawn]
//==============================================================================
stock NeedPlayerInArea(playerid,Float:MinX,Float:MaxX,Float:MinY,Float:MaxY)
{
      new Float:x,Float:y,Float:z;
       GetPlayerPos(playerid, x, y, z);
       if(x >= MinX && x <= MaxX && y >= MinY && y <= MaxY) return 1;
       else return 0;
      return 1;
}
//==============================================================================
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    tempposx = (oldposx -x);
    tempposy = (oldposy -y);
    tempposz = (oldposz -z);
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
    {
        return 1;
    }
    return 0;
}
//==============================================================================
public robando() {
    for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
       if(Billetera == 0) {
       }
       if(Billetera == 1) {
           SendClientMessage(i,COLOR_YELLOW,"You have been seen, Escape immediately!");
           TogglePlayerControllable(i,1);

  }
      }
      }
}
//==============================================================================[/pawn]

Only rob in this area

(https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-prn1/63784_10200174813510850_962411977_n.jpg)
Title: Re: [new command] rob in the street xD
Post by: mrockxkingbutt on December 26, 2012, 11:07:42 pm
man i am a fan of you but plz give me a pawno code means fix this that it can works in gups too
Title: Re: [new command] rob in the street xD
Post by: aledark24 on December 27, 2012, 12:25:16 am
wtf?is working in gups i compile in gups so what do you mean?
Title: Re: [new command] rob in the street xD
Post by: mrockxkingbutt on December 27, 2012, 11:49:01 am
man i send you my script plz dont give that to anyone just keep in your computer if you make a system cool plz test in gups means edited gups
thanks
i send you script via PM
Title: Re: [new command] rob in the street xD
Post by: mrockxkingbutt on December 27, 2012, 02:56:45 pm
it works in gups with this code
[pawn]          else if (strcmp(cmd, "rob", true) == 0) {
      tmp = strtok( cmdtext, idx ); new plr = FindPlayerIDFromString( tmp );
            if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Please log-in to your account." );
      else if ( !strlen( tmp ) ) SendClientMessage( playerid, COLOR_GREEN, "USAGE: /c rob [Nick/ID]" );
      else if ( plr == INACTIVE_PLAYER_ID ) SendClientMessage( playerid, COLOR_RED, "Error: Unknown player" );
             else {
       
              new Float:RX, Float:RY, Float:RZ, szMsg[256];
                  GetPlayerPos(playerid,RX,RY,RZ);
                  if(PlayerToPoint(3.0,plr,RX,RY,RZ))
                        format( szMsg, sizeof( szMsg ), "%s is stealing the wallet of %s", gPlayers[playerid],gPlayers[plr]);
         SendClientMessageToAll( COLOR_RED, szMsg );
              SetTimer("robando", 7000, false);
                  TogglePlayerControllable(playerid,0);
                  IncPlayerHandCash(playerid,150);
              DecPlayerHandCash(plr,150);
             Billetera[playerid] = 1;
              SetPlayerMarker(playerid,15);
         }
  return 1;
   }[/pawn]
Title: Re: [new command] rob in the street xD
Post by: · KaTaNNa · on December 27, 2012, 05:31:19 pm
Necesitas prohibir el robo a cierta distancia :

[pawn]new Float:RX, Float:RY, Float:RZ;
   GetPlayerPos(playerid,RX,RY,RZ);
   if(PlayerToPoint(3.0,plr,RX,RY,RZ)) {  // si el "player" esta cerca de "plr".Robo aceptado!
       format( szMsg, sizeof( szMsg ), "%s is stealing the wallet of %s", gPlayers[playerid],gPlayers[plr]);
         SendClientMessageToAll( COLOR_RED, szMsg );
              SetTimer("robando", 7000, false);
      TogglePlayerControllable(playerid,0);
      IncPlayerHandCash(playerid,150);
              DecPlayerHandCash(plr,150);
             Billetera[playerid] = 1;
              SetPlayerMarker(playerid,15);
              }
      else {
      SendClientMessage(playerid,COLOR_RED,"Necesitas estar cerca de algun jugador para poder Robarle!"); // si el "player" esta lejos de "plr" . Robo denegado :(!
      }[/pawn]
Title: Re: [new command] rob in the street xD
Post by: aledark24 on December 28, 2012, 03:23:27 am
el asunto es k queria hacerlo solo cerca del banco por eso no lo hize de esa manera
 No kiero en todo el servidor!
Necesitas prohibir el robo a cierta distancia :

[pawn]new Float:RX, Float:RY, Float:RZ;
   GetPlayerPos(playerid,RX,RY,RZ);
   if(PlayerToPoint(3.0,plr,RX,RY,RZ)) {  // si el "player" esta cerca de "plr".Robo aceptado!
       format( szMsg, sizeof( szMsg ), "%s is stealing the wallet of %s", gPlayers[playerid],gPlayers[plr]);
         SendClientMessageToAll( COLOR_RED, szMsg );
              SetTimer("robando", 7000, false);
      TogglePlayerControllable(playerid,0);
      IncPlayerHandCash(playerid,150);
              DecPlayerHandCash(plr,150);
             Billetera[playerid] = 1;
              SetPlayerMarker(playerid,15);
              }
      else {
      SendClientMessage(playerid,COLOR_RED,"Necesitas estar cerca de algun jugador para poder Robarle!"); // si el "player" esta lejos de "plr" . Robo denegado :(!
      }[/pawn]
Title: Re: [new command] rob in the street xD
Post by: NeskWriter on December 28, 2012, 03:07:05 pm
nice map
Title: Re: [new command] rob in the street xD
Post by: mrockxkingbutt on December 29, 2012, 11:55:50 am
man this help to stop yourself not that player
Title: Re: [new command] rob in the street xD
Post by: JaVeD on February 11, 2013, 06:46:36 am
IF some one if robbed then we can rob him again and again ? please put this command if player is robbed in 1 hours we cant rob again this player it show the message " This player is robbed recently "