Pickups -
karakana7 - 26.10.2010
So i was trying to learn, how to create several pickups in my test server, but I don't know what's wrong...There's no errors when compiled, but when i'm in server, these pickups aren't do things like i wrote in the script.So This is the code for first pickup under OnGameModeInit:
Код:
CreatePickup(355, 2, -2402.0496,-2174.4465,33.2891, -1);
As you see it's only simple pickup and when i take it, i have automaticaly get a gun-AK47.But there is second pickup, which have some more code:
(top-this is a variable in which i will store the pickup)
Then command /iwantpickup:
Код:
{
if(strcmp("/iwantpickup", cmdtext, true) == 0)
{
mypickup = CreatePickup(1274, 0, -2334.7681,-2179.3489,35.1945, -1);
return 1;
}
And under the OnPlayerPickUpPickup:
Код:
{
if(pickupid == mypickup)
GivePlayerMoney(playerid, 100);
SendClientMessage(playerid, 0xFFFFFFFF, "You are very lucky buddy, because you the one who found 100$!")
return 1;
}
return 0;
}
}
So the main problem is when i take the first pickup, so the 355, which is a gun like i sayed, i get a message in the chatbox: You are very lucky buddy, because you the one who found 100$!, which is only assigned for mypickup variable, and in this variable there is no 355 model pickup there is 1274-cash icon pickup.So wtf is that?!Why when i take first pickup, which doesn't have any message in the code, it displays message which assigned only for 1274 pickup-I don't understand this!I aprreciate every help from community!
Re: Pickups -
MadeMan - 26.10.2010
It happens because you haven't created the second pickup, so it hasn't stored the pickupid to mypickup.
mypickup is 0 and the first pickupid might be 0 too, so they match.
Re: Pickups -
karakana7 - 26.10.2010
Quote:
Originally Posted by MadeMan
It happens because you haven't created the second pickup, so it hasn't stored the pickupid to mypickup.
mypickup is 0 and the first pickupid might be 0 too, so they match.
|
But isn't it created pickup: mypickup = CreatePickup(1274, 0, -2334.7681,-2179.3489,35.1945, -1);

Does it only must be under GameModeInit callback, that it be created?So than that is mean, that i need write it two times, under GameModeInit and OnPlayerCommandText callbacks-yes?
Re: Pickups -
MadeMan - 26.10.2010
Write it only to OnGameModeInit.
Re: Pickups -
karakana7 - 26.10.2010
Quote:
Originally Posted by MadeMan
Write it only to OnGameModeInit.
|
Ok, but i want that only when you write command "/iwantpickup" it will spawn in the position which i wrote using coordinates.So how to do this than?I know this is very simple.

Can't i delete function CreatePickup, which is under the OnPlayerCommandText?But than what i will write instead of this function?
Re: Pickups -
MadeMan - 26.10.2010
You can check if the pickup is created before sending the message.
pawn Код:
if(strcmp("/iwantpickup", cmdtext, true) == 0)
{
mypickup = CreatePickup(1274, 0, -2334.7681,-2179.3489,35.1945, -1);
mypickupcreated = 1;
return 1;
}
pawn Код:
if(pickupid == mypickup && mypickupcreated == 1)
{
GivePlayerMoney(playerid, 100);
SendClientMessage(playerid, 0xFFFFFFFF, "You are very lucky buddy, because you the one who found 100$!")
return 1;
}
Re: Pickups -
karakana7 - 26.10.2010
So I need to write this line or i need to write there something else?
Код:
if(strcmp("/iwantpickup", cmdtext, true) == 0)
{
mypickup = CreatePickup(1274, 0, -2334.7681,-2179.3489,35.1945, -1);
mypickupcreated = 1;
return 1;
}
Re: Pickups -
MadeMan - 26.10.2010
Write this line.
Re: Pickups -
karakana7 - 26.10.2010
Quote:
Originally Posted by MadeMan
Write this line. 
|
But, can you say, why we write viariable and assign number to him?How it can check if pickup is created?And one thing, why cash pickup(1274) iis showing when i enter into server, i don't write any command, but it is at position without my command!Sorry for my bad english...
Re: Pickups -
karakana7 - 26.10.2010
So can you help me with this problem?