26.09.2015, 20:06
I am creating checkpoint:
Check if other player enter in the checkpoint
I wanna make /steal command to steal the drugs but i don't know how to check if other player is in the checkpoint.
Код:
CMD:plant(playerid, params[]) { if(planted_weed[playerid] == false) { if(PlayerInfo[playerid][WeedSeeds] >= 1) { if(!IsPlayerInAnyVehicle(playerid)) { switch(random(2)) { case 1: { planted_weed[playerid] = true; weedid[playerid] = playerid; PlayerInfo[playerid][WeedSeeds]--; SendClientMessage(playerid, GREEN, "Weed seeds were planted successfully."); weedtimer[playerid] = SetTimerEx("GrowingWeed", 18000, true, "i", playerid); GetPlayerPos(playerid, wX[playerid], wY[playerid], wZ[playerid]); GetPlayerName(playerid, weedname[playerid], MAX_PLAYERS); CheckPointplantweed[playerid] = CreateDynamicCP(wX[playerid], wY[playerid], wZ[playerid], 1.2, -1, -1, -1, 50.0); weedtext[playerid] = CreateDynamic3DTextLabel(weedname[playerid], WHITE, wX[playerid], wY[playerid], wZ[playerid], 20); } default: { PlayerInfo[playerid][WeedSeeds]--; SendClientMessage(playerid, RED, "Failed to plant the weed seeds."); } } } else SendClientMessage(playerid,RED,"You can't plant your seeds while you're in a vehicle!"); } else SendClientMessage(playerid, RED, "You don't have enough weed seeds!"); } else SendClientMessage(playerid, RED, "You already have a growing seeds. You can have only 1 growing seeds from each plant!"); return 1; }
Код:
if(checkpointid == CheckPointplantweed[playerid]) { if(weedid[playerid] == playerid) { SendClientMessage(playerid, YELLOW, "SERVER: Use /harvest to take your planted weed."); new strr[128]; format(strr, sizeof(strr), "%d grams weed", growingweed[playerid]); GameTextForPlayer(playerid, strr, 200, 0); } else SendClientMessage(playerid, YELLOW, "SERVER: Use /steal to steal someone's weed."); // this doesn't work i don't know why. When other player enter nothing happens. return 1; }