buy weed command help please. -
jueix - 28.05.2012
Okay so im making a drug system where a player can buy drugs and like plant and make them. Basicly this is my code.
Код:
COMMAND:buydrugs(playerid, params[]) // or CMD:mycommand(playerid, params[])
{
if(pInfo[playerid][HASDRUGS] == 0 && IsPlayerInRangeOfPoint(playerid, 1.0, -1136.4224,-2861.4194,270.5641))
{
pInfo[playerid][HASWEED] = 1;
pInfo[playerid][PLANTID] = 1759;
}
if(pInfo[playerid][HASDRUGS] == 0 && IsPlayerInRangeOfPoint(playerid, 1.0, -1140.2141,-2862.9775,270.5641))
{
pInfo[playerid][HASCRACK] = 1;
pInfo[playerid][PLANTID] = 1712;
}
else {
SendClientMessage(playerid, 0xFFFFFF,"you all ready own some drugs");
}
return 1;
}
When i use the following code and go to the area the drugs are ment t be buyable at and type the code nothing happens and when i do the /plantdrug command it says i have no drugs. Okay noow if i have this code
Код:
COMMAND:buydrugs(playerid, params[]) // or CMD:mycommand(playerid, params[])
{
IsPlayerInRangeOfPoint(playerid, 1.0, -1136.4224,-2861.4194,270.5641))
if(pInfo[playerid][HASDRUGS] == 0)
{
pInfo[playerid][HASWEED] = 1;
pInfo[playerid][PLANTID] = 1759;
}
IsPlayerInRangeOfPoint(playerid, 1.0, -1140.2141,-2862.9775,270.5641))
if(pInfo[playerid][HASDRUGS] == 0)
{
pInfo[playerid][HASCRACK] = 1;
pInfo[playerid][OBJECTID] = 1712;
}
else {
SendClientMessage(playerid, 0xFFFFFF,"you all ready own some drugs");
}
return 1;
}
and type /plantdrugs it only makes a weed plant. This is my code for /plantdrugs
Код:
COMMAND:placechair(playerid, params[]) // or CMD:mycommand(playerid, params[])
{
if(pInfo[playerid][HASDRUGS] == 1 && pInfo[playerid][PLANTID] == 1712)
{
new Float:x;
new Float:y;
new Float:z;
GetPlayerPos(playerid,x,y,z);
DX = x;
DY = y;
DZ = z - 5;
CreateDynamicObject(pInfo[playerid][PLANTID], DX, DY, DZ, 0, 0, 0, pInfo[playerid][Dworld], pInfo[playerid][Dint], -1, 200.0);
}
if(pInfo[playerid][HASDRUGS] == 1 && pInfo[playerid][PLANTID] == 1759)
{
new Float:x;
new Float:y;
new Float:z;
GetPlayerPos(playerid,x,y,z);
DX = x;
DY = y;
DZ = z - 5;
CreateDynamicObject(pInfo[playerid][PLANTID], DX, DY, DZ, 0, 0, 0, pInfo[playerid][Dworld], pInfo[playerid][Dint], -1, 200.0);
}
else {
SendClientMessage(playerid, 0xFFFFFF,"you do not own any drugs.");
}
return 1;
}
Re: buy weed command help please. -
jueix - 28.05.2012
fixed never mind.
Re: buy weed command help please. -
niels44 - 28.05.2012
hmm as far as i see you every time check if the player HASDRUGS, but i dont see ANYwhere that it actually sets teh HASDRUGS to 1, i only see pInfo[playerid][HASWEED] = 1;
pInfo[playerid][PLANTID] = 1759;
so the HASDRUGS stays 0, maybe you should do this:
pawn Код:
COMMAND:buydrugs(playerid, params[]) // or CMD:mycommand(playerid, params[])
{
if(pInfo[playerid][HASDRUGS] == 0 && IsPlayerInRangeOfPoint(playerid, 1.0, -1136.4224,-2861.4194,270.5641))
{
pInfo[playerid][HASWEED] = 1;
pInfo[playerid][PLANTID] = 1759;
pInfo[playerid][HASDRUGS] = 1;
}
if(pInfo[playerid][HASDRUGS] == 0 && IsPlayerInRangeOfPoint(playerid, 1.0, -1140.2141,-2862.9775,270.5641))
{
pInfo[playerid][HASCRACK] = 1;
pInfo[playerid][PLANTID] = 1712;
pInfo[playerid][HASDRUGS] = 1;
}
else
{
SendClientMessage(playerid, 0xFFFFFF,"you all ready own some drugs");
}
return 1;
}
that should work i think, also if this isnt the point you wanna fix then explain what you want to fix