28.04.2009, 16:46
Hey I put a code together thanks to a few other codes:
I want it so the player can only plant 1 Weed Plant. After he/she used it (walked into it), he/she needs to be able to plant another Weed Plant again so people don't spam Weed Plants on the road.
Also when I planted it my drugs don't decrease, this is my public function:
Help please
Код:
if(strcmp(cmdtext, "/plantweed", true) == 0) { if(PlayerInfo[playerid][pDrugs] > 1) { new Float:x, Float:y, Float:z, Float:Angle, msg[256]; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, Angle); x += (5 * floatsin(-Angle, degrees)); y += (5 * floatcos(-Angle, degrees)); weedplant = CreatePickup(3409, 3, x, y, z - 1.5); format(msg, sizeof(msg), "You have planted a Weed Plant!"); SendClientMessage(playerid, COLOR_WHITE, msg); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s takes some seeds out of his/her pocket and plants a weed plant.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); } else { SendClientMessage(playerid, COLOR_GREY, "You do not have any Drug Grams left!"); } }
Also when I planted it my drugs don't decrease, this is my public function:
Код:
public OnPlayerPickUpPickup(playerid, pickupid) { if(pickupid == weedplant) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); ApplyAnimation(playerid,"SMOKING", "M_smklean_loop", 4.0, 1, 0, 0, 0, 0); PlayerStoned[playerid] += 1; if(PlayerStoned[playerid] >= 3) { GameTextForPlayer(playerid, "~w~You are~n~~p~Stoned", 4000, 1); } new Float:PlayersArmour; GetPlayerArmour(playerid, PlayersArmour); if(PlayerInfo[playerid][pDrugPerk] > 0) { SetPlayerArmour(playerid, PlayersArmour + 10.0); } PlayerInfo[playerid][pDrugs] -= 2; SetPlayerArmour(playerid, PlayersArmour + 10.0); SetPlayerWeather(playerid, -68); UsingDrugs[playerid] = 1; SetTimerEx("DrugEffectGone", 25000, false, "i", playerid); } }