SA-MP Forums Archive
Only id 0 getting drugs - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Only id 0 getting drugs (/showthread.php?tid=568209)



Only id 0 getting drugs - ilijas - 20.03.2015

after players harvest the drugs they should get 50 grams of drugs, but instead of players that actually harvested it, only player id 0 is getting drugs.
this is the command

if(strcmp(cmd, "/harvest1", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 10,-1073.7500,-1095.6509,129.218 && PlayerInfo[playerid][pJob] == 4 && plant1 == 1 && PlayerInfo[playerid][pHarvest] == 1)
{
plant1 = 0;
DestroyDynamicObject(bigplant1);
PlayerInfo[playerid][pHarvest] = 0;
PlayerInfo[giveplayerid][pDrugs] += 50;
SCM(playerid, COLOR_WHITE, "+ 50 drugs!");
}
else
{
SCM(playerid, COLOR_WHITE, "Error!");
}
return 1;
}


Re: Only id 0 getting drugs - SickAttack - 20.03.2015

Change this:
Код:
PlayerInfo[giveplayerid][pDrugs] += 50;
To:
Код:
PlayerInfo[playerid][pDrugs] += 50;



Re: Only id 0 getting drugs - EiresJason - 20.03.2015

Change:
pawn Код:
PlayerInfo[playerid][pHarvest] = 0;
PlayerInfo[giveplayerid][pDrugs] += 50;
to:
pawn Код:
PlayerInfo[playerid][pHarvest] = 0;
PlayerInfo[playerid][pDrugs] += 50;
You were giving the drugs to ID 'giveplayerid' which would be 0 by default.


Re: Only id 0 getting drugs - ilijas - 20.03.2015

Thanks, works now ^^