Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Snippet Showroom => Topic started by: aledark24 on March 18, 2013, 03:21:39 pm

Title: NOW!! You can't rob the players in the server, like cops and robers!
Post by: aledark24 on March 18, 2013, 03:21:39 pm
[pawn]new Wallet[MAX_PLAYERS];[/pawn]

 "Gups or Fc version"
 [pawn]              else if(strcmp(cmd,"rob",true) == 0) {
{
     tmp = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
      if(Wallet[plr] == 1) {

        SendClientMessage(playerid,0xAA3333AA,"You not cant rob the same player again!");
}
       if ( !strlen( tmp ) ) SendClientMessage( playerid, 0xFFFF00AA, "Write: /c rob [Nick/ID]" );
       else if ( plr == INACTIVE_PLAYER_ID ) SendClientMessage( playerid, 0xAA3333AA, "Error: Unknown Player" );
   else{
   if(Wallet[plr] == 0) {
    new Float:XR, Float:YR, Float:ZR;
   GetPlayerPos(playerid,XR,YR,ZR);
   if(PlayerToPoint(3.0,plr,XR,YR,ZR)) {
       format( szMsg, sizeof( szMsg ), "%s steal the wallet of %s", gPlayers[playerid],gPlayers[plr]);
        SendClientMessageToAll( 0xFFFF00AA, szMsg );
        IncPlayerHandCash(playerid,200);
        DecPlayerHandCash(plr,200);
        Wallet[plr] = 1;
       SetPlayerMarker(playerid,15);
       }
      else SendClientMessage(playerid,0xAA3333AA,"Need to be closer for rob");
      }
  }
}

      return 1;
}[/pawn]

[pawn]public OnPlayerDeath(playerid, killerid, reason, bodypart)
{

Wallet[playerid] = 0;[/pawn]

[pawn]public OnPlayerDisconnect(playerid, reason)
{

Wallet[playerid] = 0;[/pawn]

All scripts version

[pawn]               else if(strcmp(cmd,"rob",true) == 0) {
{
     tmp = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
      if(Wallet[plr] == 1) {

        SendClientMessage(playerid,0xAA3333AA,"You not cant rob the same player again!");
}
       if ( !strlen( tmp ) ) SendClientMessage( playerid, 0xFFFF00AA, "Write: /c rob [Nick/ID]" );
   else{
   if(Wallet[plr] == 0) {
    new Float:XR, Float:YR, Float:ZR;
   GetPlayerPos(playerid,XR,YR,ZR);
   if(PlayerToPoint(3.0,plr,XR,YR,ZR)){
   if ( GetPlayerMoney( plr ) > 199 ) {
       format( szMsg, sizeof( szMsg ), "%s steal the wallet of %s", gPlayers[playerid],gPlayers[plr]);
        SendClientMessageToAll( 0xFFFF00AA, szMsg );
       format( szMsg, sizeof( szMsg ),"You steal $ 200 of the player %s",gPlayers[plr]);
        SendClientMessage(playerid, 0xFFFF00AA, szMsg );
        SetPlayerMoney(plr,GetPlayerMoney(plr) - 200);
        SetPlayerMoney(playerid,GetPlayerMoney(playerid) + 200);
        Wallet[plr] = 1;
        }
        if ( GetPlayerMoney( plr ) < 199 ){
      SendClientMessage(playerid,0xFFFF00AA,"This player not have money to rob");
       SetPlayerMarker(playerid,15);
       Wallet[plr] = 0;
       }
       }
      else SendClientMessage(playerid,0xAA3333AA,"Need to be closer for rob");
      }
  }
}

      return 1;
}[/pawn]
Title: Re: NOW!! You can't rob the players in the server, like cops and robers!
Post by: Tomiijaja on March 18, 2013, 03:56:34 pm
Na lo robaste, no eres capaz de hacer tu propio comando, solo le robas al script de madara (Warchiefs)
Title: Re: NOW!! You can't rob the players in the server, like cops and robers!
Post by: dynavolt71 on March 18, 2013, 03:57:35 pm
Sorry alejandro. You may edit and add "this is for GUPS"
Title: Re: NOW!! You can't rob the players in the server, like cops and robers!
Post by: aledark24 on March 19, 2013, 04:50:38 pm
Sorry alejandro. You may edit and add "this is for GUPS"

if you are stup_ _ ....
and not see ...
if you not have IncPlayerHandCash or DecPlayerHandCash
is you problem, but have two system
SetPlayerMoney -200
and SetPlayerMoney + 200
so...
you only need remove

IncPlayerHandCash and DecPlayerHandCash

Note: I have a server from 0
Only i put the register system of gups, but have my own system of
IncPlayerHandCash and DecPlayerHandCash and bank System, if you need my system only talk whit me
Title: Re: NOW!! You can't rob the players in the server, like cops and robers!
Post by: .ElBoyz on March 19, 2013, 09:00:29 pm
Na lo robaste, no eres capaz de hacer tu propio comando, solo le robas al script de madara (Warchiefs)

TomiJaja , EN Ningun warchiefs sale comando "rob" , al parecer Tu lo unico que sabes es , Cojer 1 comando y traducirlo y cojerlo para ti , Repeta Lo rango.
Title: Re: NOW!! You can't rob the players in the server, like cops and robers!
Post by: sseebbyy on March 19, 2013, 09:53:08 pm
What happens if the victim player doesn't have 200$ ? It will still take + give that amount.

+ Why you used both functions that increase/decrease the money of a player ?

Quote
Code: [Select]
IncPlayerHandCash(playerid,200);
        DecPlayerHandCash(plr,200);
SetPlayerMoney(plr,GetPlayerMoney(plr) - 200);
SetPlayerMoney(playerid,GetPlayerMoney(playerid) + 200);

This couple of lines will take $200 from the victim once (at the second line: "DecPlayerHandCash(plr,200);") and will take again this amoun (200 $) because you have used this line: "SetPlayerMoney(plr,- 200);" . And the robber will increase $400 not $200 by robbing that player.

+ just $200 will be saved in the database, the rest of $200 will be just in the HUD, so just $200 will be usable.
Title: Re: NOW!! You can't rob the players in the server, like cops and robers!
Post by: dynavolt71 on March 20, 2013, 01:49:33 pm
Who stu*** now ?
Title: Re: NOW!! You can't rob the players in the server, like cops and robers!
Post by: aledark24 on March 20, 2013, 03:53:45 pm
What happens if the victim player doesn't have 200$ ? It will still take + give that amount.

+ Why you used both functions that increase/decrease the money of a player ?

Quote
Code: [Select]
IncPlayerHandCash(playerid,200);
        DecPlayerHandCash(plr,200);
SetPlayerMoney(plr,GetPlayerMoney(plr) - 200);
SetPlayerMoney(playerid,GetPlayerMoney(playerid) + 200);

This couple of lines will take $200 from the victim once (at the second line: "DecPlayerHandCash(plr,200);") and will take again this amoun (200 $) because you have used this line: "SetPlayerMoney(plr,- 200);" . And the robber will increase $400 not $200 by robbing that player.

+ just $200 will be saved in the database, the rest of $200 will be just in the HUD, so just $200 will be usable.


Because not all players have DecPlayerHandCash And IncPlayerHandCash, so this reason is "not have public" Deleted inc and dec :p
and i posted my commands but always update and keep the latest update.....
Title: Re: NOW!! You can't rob the players in the server, like cops and robers!
Post by: sseebbyy on March 20, 2013, 05:22:40 pm
Because not all players have DecPlayerHandCash And IncPlayerHandCash, so this reason is "not have public" Deleted inc and dec :p
and i posted my commands but always update and keep the latest update.....

I'm talking about players that have both functions implemented. (DecPlayerHandCash & IncPlayerHandCash)
I suggest you to give more details in the first post, or to make 2 versions: one for GUPS and one for standard scripts. (detailed too)

+

What happens if the victim player doesn't have 200$ ? It will still take + give that amount.
Title: Re: NOW!! You can't rob the players in the server, like cops and robers!
Post by: aledark24 on March 21, 2013, 06:26:21 pm
Because not all players have DecPlayerHandCash And IncPlayerHandCash, so this reason is "not have public" Deleted inc and dec :p
and i posted my commands but always update and keep the latest update.....

I'm talking about players that have both functions implemented. (DecPlayerHandCash & IncPlayerHandCash)
I suggest you to give more details in the first post, or to make 2 versions: one for GUPS and one for standard scripts. (detailed too)

+

What happens if the victim player doesn't have 200$ ? It will still take + give that amount.



ok ok


[pawn]               else if(strcmp(cmd,"rob",true) == 0) {
{
     tmp = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
      if(Wallet[plr] == 1) {

        SendClientMessage(playerid,0xAA3333AA,"You not cant rob the same player again!");
}
       if ( !strlen( tmp ) ) SendClientMessage( playerid, 0xFFFF00AA, "Write: /c rob [Nick/ID]" );
   else{
   if(Wallet[plr] == 0) {
    new Float:XR, Float:YR, Float:ZR;
   GetPlayerPos(playerid,XR,YR,ZR);
   if(PlayerToPoint(3.0,plr,XR,YR,ZR)){
   if ( GetPlayerMoney( plr ) > 199 ) {
       format( szMsg, sizeof( szMsg ), "%s steal the wallet of %s", gPlayers[playerid],gPlayers[plr]);
        SendClientMessageToAll( 0xFFFF00AA, szMsg );
       format( szMsg, sizeof( szMsg ),"You steal $ 200 of the player %s",gPlayers[plr]);
        SendClientMessage(playerid, 0xFFFF00AA, szMsg );
        SetPlayerMoney(plr,GetPlayerMoney(plr) - 200);
        SetPlayerMoney(playerid,GetPlayerMoney(playerid) + 200);
        Wallet[plr] = 1;
        }
        if ( GetPlayerMoney( plr ) < 199 ){
      SendClientMessage(playerid,0xFFFF00AA,"This player not have money to rob");
       SetPlayerMarker(playerid,15);
       Wallet[plr] = 0;
       }
       }
      else SendClientMessage(playerid,0xAA3333AA,"Need to be closer for rob");
      }
  }
}

      return 1;
}[/pawn]

is better now sseebbyy??
Title: Re: NOW!! You can't rob the players in the server, like cops and robers!
Post by: .ElBoyz on March 23, 2013, 06:43:20 am
(http://images.cooltext.com/3001961.png)