#1

hi i was looking for a timer for a pickup. so like if they walk into the pickup only that 1 person can have that pickup and evrey 30sec they get $1000 here is the code im useing

Код:
new Pickup;
public OnGameModeInit()
{
Pickup = CreatePickup(1210, 2 ,2019.7742,1344.4839,10.8203);
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == Pickup)
{
GivePlayerMoney(playerid,100000);
SendClientMessage(playerid,0x33AA33AA,"You Better Run They Gonna Whant That Money");
return 1;
}
return 1;
}
thx for ur time
Reply
#2

https://sampwiki.blast.hk/wiki/setTimerEx
Reply
#3

i looked at that it dont help me at all
Reply
#4

pawn Код:
#include <a_samp>

new Pickup;

public OnGameModeInit()
{
Pickup = CreatePickup(1210, 2 ,2019.7742, 1344.4839, 10.8203);
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == Pickup)
{
GivePlayerMoney(playerid, 100000);
SendClientMessage(playerid, 0x33AA33AA, "You Better Run They Gonna Whant That Money");
SetTimerEx("Timer", 30000, 0, "i", playerid);
return 1;
}
return 1;
}

forward Timer(playerid);
public Timer(playerid)
{
GivePlayerMoney(playerid, 100000);
SetTimerEx("Timer", 30000, 0, "i", playerid);
return 1;
}
Reply
#5

thx for the help man you wouldent happen to know how to make it so when the player picks it up no 1 can get the case and when that play dies the case drops and after like 1min it respawns at its location would you thx for the help
Reply
#6

eddy: You made the timer work everywhere,not only in the pickup. So,basically,if they leave the pickup they still get money every 30 sec.
You have to use variables or the PlayerToPoint function to do that.

Why did you add 2 timers? Just put one under a rotation.
Like this:
pawn Код:
SetTimerEx("Timer", 30000, 1, "i", playerid);
//-------------------------^ (rotation = true(1))
sggassasin: Use a variable to check if the player has the briefcase and use it on OnPlayerDeath with CreatePickup.
Reply
#7

karlip thats what i whant so that you can run around with the case but when the person with the case dies it go back to its point :P


Reply
#8

Quote:
Originally Posted by sggassasin
karlip thats what i whant so that you can run around with the case but when the person with the case dies it go back to its point :P
Ok,the 30 sec timer was to give money to the guy as a reward for holding the briefcase.
That's all good then.
pawn Код:
#include <a_samp>

#define MAX_PLAYERS 200

new briefcase[MAX_PLAYERS]

//other stuff here(OnGameModeInit n' stuff)

public OnPlayerPickUpPickup(playerid, pickupid)
{
   if(pickupid == Pickup)
   {
     GivePlayerMoney(playerid, 100000);
     SendClientMessage(playerid, 0x33AA33AA, "You Better Run They Gonna Whant That Money");
     SetTimerEx("Timer", 30000, 0, "i", playerid);
     briefcase[playerid] = 1;
     return 1;
   }
   return 1;
}

public OnPlayerDeath(playerid, reason)
{
   if(briefcase[playerid] == 1)
   {
     new Float:X,Float:Y,Float:Z;
     GetPlayerPos(playerid,X,Y,Z);
     Pickup = CreatePickup(1210, 2 ,X,Y,Z);
     briefcase[playerid] = 0;
   }
   return 1;
}
Reply
#9

how do i do the check vribale thing
Reply
#10

Quote:
Originally Posted by sggassasin
thx for the help man you wouldent happen to know how to make it so when the player picks it up no 1 can get the case and when that play dies the case drops and after like 1min it respawns at its location would you thx for the help
pawn Код:
#include <a_samp>

new Pickup;

new PlayerMoney;

new PlayerMoneyPickup;

public OnGameModeInit()
{
Pickup = CreatePickup(1212, 2, Float:x, Float:y, Float:z);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
PlayerMoney = GetPlayerMoney(playerid);
PlayerMoneyPickup = CreatePickup(1212, 2, Float:x, Float:y, Float:z);
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == Pickup)
{
GivePlayerMoney(playerid, amount);
DestroyPickup(Pickup);
return 1;
}
if(pickupid == PlayerMoneyPickup)
{
GivePlayerMoney(playerid, PlayerMoney);
DestroyPickup(PlayerMoneyPickup);
return 1;
}
return 1;
}
EDIT: Just put it into your filterscript. I didn't include everything, like I didn't include the timer.

@Karlip: Oh, I forgot that. :S
Reply
#11

eddy: Erm,check my post.
Reply
#12

I already did that... Had to edit my post.
Reply
#13

ok edde with ur script came up with these errors /warnings


C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(835) : warning 209: function "OnPlayerPickUpPickup" should return a value
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(835) : error 010: invalid function or declaration
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(839) : error 010: invalid function or declaration
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(841) : error 010: invalid function or declaration
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(461) : warning 204: symbol is assigned a value that is never used: "PlayerMoney"
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(462) : warning 204: symbol is assigned a value that is never used: "PlayerMoneyPickup"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#14

and with urs karlip came these warnings / errors



C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(33) : warning 201: redefinition of constant/macro (symbol "MAX_PLAYERS")
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(344) : error 017: undefined symbol "Pickup"
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(463) : error 017: undefined symbol "briefcase"
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(463) : warning 215: expression has no effect
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(463) : error 001: expected token: ";", but found "]"
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(463) : error 029: invalid expression, assumed zero
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(463) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.






EDITk now after that post iv got these errors (from edde)


C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(827) : error 010: invalid function or declaration
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(833) : error 010: invalid function or declaration
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(835) : error 010: invalid function or declaration
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(839) : error 010: invalid function or declaration
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(841) : error 010: invalid function or declaration
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(344) : warning 204: symbol is assigned a value that is never used: "Pickup"
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(461) : warning 204: symbol is assigned a value that is never used: "PlayerMoney"
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\asfr.pwn(462) : warning 204: symbol is assigned a value that is never used: "PlayerMoneyPickup"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#15

Use the 'Modify' button...

pawn Код:
#include <a_samp>

new Pickup;

new PlayerMoney;

new PlayerMoneyPickup;

public OnGameModeInit()
{
Pickup = CreatePickup(1212, 2, 2019.7742,1344.4839,10.8203);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
PlayerMoney = GetPlayerMoney(playerid);
PlayerMoneyPickup = CreatePickup(1212, 2, Float:x, Float:y, Float:z);
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == Pickup)
{
GivePlayerMoney(playerid, 100000);
SendClientMessage(playerid, 0x33AA33AA, "You Better Run They Gonna Whant That Money");
SetTimerEx("Timer", 30000, 0, "i", playerid);
DestroyPickup(Pickup);
return 1;
}
if(pickupid == PlayerMoneyPickup)
{
GivePlayerMoney(playerid, PlayerMoney);
DestroyPickup(PlayerMoneyPickup);
return 1;
}
return 1;
}

forward Timer(playerid);
public Timer(playerid)
{
GivePlayerMoney(playerid, 100000);
SetTimerEx("Timer", 30000, 0, "i", playerid);
return 1;
}
@Karlip: If you got any suggestions, then spit out...
Reply
#16

im still getting those errors a little help
Reply
#17

You placed it wrong in your gamemode/filterscript, because there's nothing wrong. Try compiling it as a seperate filterscript.
Reply
#18

ah ok i got it working some how i deleted this line

public OnPlayerPickUpPickup(playerid, pickupid)
{


so like lol now it works thx for the help man
Reply
#19

um eddy when the person dides he still gain money
Reply
#20

I can only suggest you to read some guides, start with wiki.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)