PDA

View Full Version : problem with pickups


Stefans94
09/10/2011, 12:38 PM
Hello all,
i got the problem with pickups
i will first post my code and then explain it
so here's the code

public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new i; i < MAX_ENTERS; i++) {
if(Enters[i] == pickupid) {
GameTextForPlayer(playerid, "~g~/enter~g~ to enter", 2000, 3);
}
if(Exits[i] == pickupid) {
GameTextForPlayer(playerid, "~g~/exit~g~ to exit", 2000, 3);
}
}
for(new b; b < MAX_BANK; b++) {
if(Banks[b] == pickupid) {
GameTextForPlayer(playerid, "/balance /deposit /withdraw /transfer", 2000, 3);
}
}
return 1;
}


in my gamemode init i have this:
LoadEnters();
LoadBankP();

at the top of my script:

enum EnterInfo {
Pickup1,
Pickup2,
Float:PosX,
Float:PosY,
Float:PosZ,
Float:TeleX,
Float:TeleY,
Float:TeleZ,
Interior,
vw,
bool:Official
}
new Enter[MAX_ENTERS][EnterInfo] = {
{1275, 1318, -176.4418, 1112.0864, 19.7422, 207.5793, -110.6434, 1005.1328, 15, 1, true}, //binco
{1318, 1318, -207.7078, 1119.1892, 20.4297, 390.2964, 173.7713, 1008.3828, 3, 2, true}, //townhall
{1274, 1318, -179.5288, 1133.0720, 19.7422, 2305.2292, -16.1469, 26.7422, 0, 3, true} //bank
};

new Enters[MAX_ENTERS];
new Exits[MAX_ENTERS];

enum BankInfo {
Float:bPosX,
Float:bPosY,
Float:bPosZ
}

new Bank[MAX_BANK][BankInfo] = {
{2316.5, -12.5389, 26.7422},
{2316.5, -9.8624, 26.7422},
{2316.5, -7.3837, 26.7422},
{2316.5, -15.5140, 26.7422}
};

new Banks[MAX_BANK];
stock LoadBankP() {
for(new i; i < MAX_BANK; i++) {
Banks[i] = CreateDynamicPickup(1239, 1, Bank[i][bPosX], Bank[i][bPosY], Bank[i][bPosZ], -1, 0, -1, 100);
}
}

stock LoadEnters() {
for(new i; i < MAX_ENTERS; i++) {
Enters[i] = CreateDynamicPickup(Enter[i][Pickup1], 1, Enter[i][PosX], Enter[i][PosY], Enter[i][PosZ], 0, 0, -1, 40.0);
Exits[i] = CreateDynamicPickup(Enter[i][Pickup2], 1, Enter[i][TeleX], Enter[i][TeleY], Enter[i][TeleZ], Enter[i][vw], Enter[i][Interior], -1, 40.0);
}
}

and at the top:
#define MAX_ENTERS 3
#define MAX_BANK 4


so the pickups work, they are at the right position and i can do
/enter & /exit
but when i enter the bankpickups
it also says "/enter to enter" or "/exit to exit"
it doesn't say /balance /withdraw /deposit /transfer
so that's the weird thing
can anyone help me please?
thanks

Stefans94
09/10/2011, 02:21 PM
nobody can help me? =p

aRoach
09/10/2011, 02:22 PM
Give us the '/enter' Command

Stefans94
09/10/2011, 02:50 PM
Give us the '/enter' Command

why?
/enter works perfectly..
the problem is the gametext on playerpickup

Crystyan12
09/10/2011, 03:01 PM
try this way

for(new i; i < MAX_ENTERS; i++) {
if(pickupid ==Enters[i]) {
GameTextForPlayer(playerid, "~g~/enter~g~ to enter", 2000, 3);
}
if(pickupid ==Exits[i]) {
GameTextForPlayer(playerid, "~g~/exit~g~ to exit", 2000, 3);
}
}
and

if(pickupid == Banks[b])

Stefans94
09/10/2011, 03:20 PM
try this way

for(new i; i < MAX_ENTERS; i++) {
if(pickupid ==Enters[i]) {
GameTextForPlayer(playerid, "~g~/enter~g~ to enter", 2000, 3);
}
if(pickupid ==Exits[i]) {
GameTextForPlayer(playerid, "~g~/exit~g~ to exit", 2000, 3);
}
}
and

if(pickupid == Banks[b])

nope found the answer.. XD
because i use streamer, i had to use the callback:
OnPlayerPickUpDynamicPickup(playerid, pickupid);