Maximum plant slots (drug system)
#3

Quote:
Originally Posted by Babul
Посмотреть сообщение
assuming you already prepared your script for holding some variables, like
Код:
new PlantObject[MAX_PLAYERS][5];//5 plants per player
new PlantPosition[MAX_PLAYERS][5][4];//0,1 and 2= position, 3=rotation(angle)
new PlantGrams[MAX_PLAYERS][5];//not to forget the growed stuff
hence the [], theres a 5 dimensional array storing 5 plants objects&positions in another [3] extra dimensions/per 5 player plants/per player.
i would start with a simple command to plant a seed:
Код:
CMD:plant(playerid,params[]){
SendClientMessage(playerid,-1,"plant command working");
for(new p=0;p<5;p++)
{
if(PlantObject[playerid][p]==0)
{
new Float:pX,Float:pY,Float:pZ,Float:pA;
GetPlayerPos(playerid,pX,pY,pZ);
GetPlayerFacingangle(playerid,pA);
PlantObject[playerid][p]=CreateObject(...,pX,pY,pZ,pA);
PlantPosition[playerid][0]=pX;
PlantPosition[playerid][1]=pY;
PlantPosition[playerid][2]=pZ;
PlantPosition[playerid][3]=pA;
}
}
return 1;
}
...i think no commenting above is required?
anyways, when you think about any limitations like "5 plants per player", its a good idea to prepare for scripting an "endless plants as much the streamer can process".
each plant can be planted by ONE player - pretty obvious. why assign each plant to a player (that [5] limitation), when you can rather assign a player to each plant?
Код:
const PlantsMax=20000;
PlantedByPlayerID[MAX_PLANTS]=playerid;
this got the disadvantage that yuo need to search through all plants, incase you intent to script a /plantGPS...
you got the idea? good. now youll be busy hehe
Thanks Alot !

You explained pretty well, and thanks!
Reply


Messages In This Thread
Maximum plant slots (drug system) - by denNorske - 14.02.2013, 06:01
Re: Maximum plant slots (drug system) - by Babul - 14.02.2013, 10:04
Re: Maximum plant slots (drug system) - by denNorske - 14.02.2013, 10:46

Forum Jump:


Users browsing this thread: 1 Guest(s)