Vice City Multiplayer
VC:MP 0.3 => mIRC/pawn Scripting => Topic started 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
-
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
-
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]
-
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
-
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
-
remember that you died for something
mKay lol, but sometimes I do stop
-
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];
-
If i rejoin from the server,i can pickup it again, and simultaneously make me a richman -_-.