26.09.2015, 15:12
How to do this?
How to check if player2 or player3..... is in player1 checkpoint?
How to check if player2 or player3..... is in player1 checkpoint?
IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
#include <a_samp> #include <zcmd> #include <streamer> #include <sscanf2> new PlayerName[MAX_PLAYERS][MAX_PLAYER_NAME]; new CP_Maker[MAX_PLAYERS][30]; new CheckPoint; CMD:createcp(playerid,params[]) { new pID, pTYPE; if(sscanf(params, "dd", pID, pTYPE)) return SendClientMessage(playerid, -1, "USAGE: {999999}/createcp"); new Float:pos[3]; GetPlayerPos(playerid,pos[0],pos[1],pos[2]); new pVW = GetPlayerVirtualWorld(playerid); new pIntID = GetPlayerInterior(playerid); CheckPoint = CreateDynamicCP(pos[0],pos[1],pos[2],10, pVW, pIntID, -1, 100); format(CP_Maker[playerid],MAX_PLAYER_NAME,"%s",Name(playerid)); return 1; } public OnPlayerEnterDynamicCP(playerid, checkpointid) { if(checkpointid == CheckPoint) { new str[100]; format(str,sizeof(str),"{999999}This Checkpoint was created by {CBACBA}%s",CP_Maker[playerid]); SendClientMessage(playerid, -1, str); } return 1; } stock Name(playerid) { GetPlayerName(playerid,PlayerName[playerid],MAX_PLAYER_NAME); new string[64]; format(string, 64, "%s[%d]", PlayerName[playerid],playerid); return string; }
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; }
if(checkpointid == CheckPointplantweed[playerid]) { if(weedid[playerid] == playerid) { if(planted_weed[playerid] == true)// added { 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. } }