Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: SOMAAN on July 06, 2013, 01:46:19 pm

Title: help me
Post by: SOMAAN on July 06, 2013, 01:46:19 pm
plz give me function for a pickup from it we are freezed for 10 sec and then we got 1000$.
my code is gups
Title: Re: help me
Post by: NeskWriter on July 06, 2013, 05:39:11 pm
Lol

in the beginning (behind OnGameModeInit):
[pawn]
forward frztmr();
new pickedup[MAX_PLAYERS];
[/pawn]

now paste the code in public OnPickedUp (I'll paste the code with public, if it doesn't exist in ur .pwn file):
[pawn]
public OnPickedUp(pickupid, playerid)
{
   if(pickupid == 1)//replace "1" with the pickupid u wish to pass functions typed behind
   {
        SetTimer("frztmr", 10000, 0);
        TogglePlayerControllable(playerid, 0);
        pickedup[playerid]=1;
   }
   return 1;
}
[/pawn]

Now the public:
[pawn]
public frztmr()
{
   for(new p=0; p<MAX_PLAYERS; p++)
   {
      if(pickedup[p]==1)
      {
          TogglePlayerControllable(p, 1);
                    SetPlayerMoney(p, GetPlayerMoney(p) + 1000);
                    pickedup[playerid]=0;
      }
   }
   return 1;
}
[/pawn]

it's beta, I hope aledark (or someone else) will fix the mistakes I made
Title: Re: help me
Post by: aledark24 on July 06, 2013, 06:58:12 pm

Put this behind of another new in the top of the script
[pawn]new PickCash[MAX_PLAYERS];[/pawn]

Put this in OngameModeInit

[pawn]AddStaticPickup(120,501,-944.65417,-343.91436,7.22693); // this is the location of the bank vault[/pawn]

Add this in OnPickedUp


[pawn]    if(pickupid == 120) {
          format(string, sizeof(string), "%s take $ 1000 from the Bank", gPlayers[playerid]);
    SendClientMessageToAll(AMARILLO, string);
IncPlayerHandCash(playerid,1000);
TogglePlayerControllable(playerid,0);
SetTimer( "Cash", 10000,false);
PickCash[playerid] = 1;
 }[/pawn]
Put this in the end of the script
[pawn]//================================================================
public Cash() {
    for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
       if(PickCash == 1) {
          SendClientMessage(i,0xFFFF00AA,"You picked up $1000!");
         TogglePlayerControllable(i,1);
           PickCash = 0;
      }
  }
      }
}
//==============================================================================[/pawn]


Title: Re: help me
Post by: NeskWriter on July 07, 2013, 08:51:38 pm

Put this behind of another new in the top of the script
[pawn]new PickCash[MAX_PLAYERS];[/pawn]

Put this in OngameModeInit

[pawn]AddStaticPickup(120,501,-944.65417,-343.91436,7.22693); // this is the location of the bank vault[/pawn]

Add this in OnPickedUp


[pawn]    if(pickupid == 120) {
          format(string, sizeof(string), "%s take $ 1000 from the Bank", gPlayers[playerid]);
    SendClientMessageToAll(AMARILLO, string);
IncPlayerHandCash(playerid,1000);
TogglePlayerControllable(playerid,0);
SetTimer( "Cash", 10000,false);
PickCash[playerid] = 1;
 }[/pawn]
Put this in the end of the script
[pawn]//================================================================
public Cash() {
    for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
       if(PickCash == 1) {
          SendClientMessage(i,0xFFFF00AA,"You picked up $1000!");
         TogglePlayerControllable(i,1);
           PickCash = 0;
      }
  }
      }
}
//==============================================================================[/pawn]

All the public functions must be forwarded, if my memory serves me. So, else:
[pawn]forward Cash();[/pawn]
in the top
Title: Re: help me
Post by: aledark24 on July 07, 2013, 08:55:37 pm

Put this behind of another new in the top of the script
[pawn]new PickCash[MAX_PLAYERS];[/pawn]

Put this in OngameModeInit

[pawn]AddStaticPickup(120,501,-944.65417,-343.91436,7.22693); // this is the location of the bank vault[/pawn]

Add this in OnPickedUp


[pawn]    if(pickupid == 120) {
          format(string, sizeof(string), "%s take $ 1000 from the Bank", gPlayers[playerid]);
    SendClientMessageToAll(AMARILLO, string);
IncPlayerHandCash(playerid,1000);
TogglePlayerControllable(playerid,0);
SetTimer( "Cash", 10000,false);
PickCash[playerid] = 1;
 }[/pawn]
Put this in the end of the script
[pawn]//================================================================
public Cash() {
    for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
       if(PickCash == 1) {
          SendClientMessage(i,0xFFFF00AA,"You picked up $1000!");
         TogglePlayerControllable(i,1);
           PickCash = 0;
      }
  }
      }
}
//==============================================================================[/pawn]

All the public functions must be forwarded, if my memory serves me. So, else:
[pawn]forward Cash();[/pawn]
in the top

I think your memory failure, as the settimer I use is "false" only works once, and starts at the pick the pickup if I remember correctly takes more than 30 seconds to appear

remember that you died for something
Title: Re: help me
Post by: NeskWriter on July 07, 2013, 08:57:11 pm

remember that you died for something


mKay lol, but sometimes I do stop
Title: Re: help me
Post by: vinesh on August 05, 2013, 08:52:59 am

Put this behind of another new in the top of the script
[pawn]new PickCash[MAX_PLAYERS];[/pawn]

Put this in OngameModeInit

[pawn]AddStaticPickup(120,501,-944.65417,-343.91436,7.22693); // this is the location of the bank vault[/pawn]

Add this in OnPickedUp


[pawn]    if(pickupid == 120) {
        new string[128];
          format(string, sizeof(string), "%s take $ 1000 from the Bank", gPlayers[playerid]);
    SendClientMessageToAll(AMARILLO, string);
IncPlayerHandCash(playerid,1000);
TogglePlayerControllable(playerid,0);
SetTimer( "Cash", 10000,false);
PickCash[playerid] = 1;
 }[/pawn]
Put this in the end of the script
[pawn]//================================================================
public Cash() {
    for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
       if(PickCash == 1) {
          SendClientMessage(i,0xFFFF00AA,"You picked up $1000!");
         TogglePlayerControllable(i,1);
           PickCash = 0;
      }
  }
      }
}
//==============================================================================[/pawn]

All the public functions must be forwarded, if my memory serves me. So, else:
[pawn]forward Cash();[/pawn]
in the top

I think your memory failure, as the settimer I use is "false" only works once, and starts at the pick the pickup if I remember correctly takes more than 30 seconds to appear

remember that you died for something

I think u forgot to put new string[128];
Title: Re: help me
Post by: DilsonTB on August 11, 2013, 11:02:32 pm
If i rejoin from the server,i can pickup it again, and simultaneously make me a richman -_-.