rendered paste body if (strcmp(cmd, "/create", true)==0)
{
new string[256];
new tmp[256];
new string3[256];
new steps[MAX_PLAYERS];
new Float:BCx;
new Float:BCy;
new Float:BCz;
new strx[256],stry[256],strz[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
format(string,sizeof(string),"***Welcome to the Battle Creathion System.");
SendClientMessage(playerid,COLOR_YELLOW,string);
format(string,sizeof(string),"***Type /create [start] to begin the creation.");
SendClientMessage(playerid,COLOR_YELLOW,string);
steps[playerid] = 0;
}else{
if(strcmp(tmp, "start", true) == 0){
if(steps[playerid] == 0){
format(string,sizeof(string),"***Type /create [battle id] to create a battle.");
SendClientMessage(playerid,COLOR_YELLOW,string);
steps[playerid] = 1;
}
}
if(strval(steps[playerid]) == 1){
if(IsNumeric(tmp)){
format(string3,sizeof(string3),"ShadowDM Files/Battles/%s.txt",tmp);
//format(string3,sizeof(string3),"battles/%s.txt",tmp);
if(!fexist(string3)){
dini_Create(string3);
steps[playerid] = 2;
format(string,sizeof(string),"***Type /create [name] to give a name to the battle.");
SendClientMessage(playerid,COLOR_YELLOW,string);
}else{
SendClientMessage(playerid,COLOR_YELLOW,"***Battle already exist");
}
}
}
//}
if(steps[playerid] == 2){
dini_Set(string3, "Name", tmp);
format(string,sizeof(string),"***Battles name: %s.",tmp);
SendClientMessage(playerid,COLOR_YELLOW,string);
format(string,sizeof(string),"***Go to the battle`s checkpoint position and type /create [save]");
SendClientMessage(playerid,COLOR_YELLOW,string);
steps[playerid] = 3;
}
if(strcmp(tmp, "save", true) == 0){
if(steps[playerid] == 3){
GetPlayerPos(playerid, BCx, BCy, BCz);
format(strx,sizeof(strx),"%f",BCx);
format(stry,sizeof(stry),"%f",BCy);
format(strz,sizeof(strz),"%f",BCz);
dini_Set(string3, "StartX", strx);
dini_Set(string3, "StartY", stry);
dini_Set(string3, "StartZ", strz);
format(string,sizeof(string),"***The checkpoints cordinats: %f %f %f",BCx,BCy,BCz);
SendClientMessage(playerid,COLOR_YELLOW,string);
format(string,sizeof(string),"***Go to the 1st team spawn position and type /create [save]");
SendClientMessage(playerid,COLOR_YELLOW,string);
steps[playerid] = 4;
}
if(steps[playerid] == 4){
GetPlayerPos(playerid, BCx, BCy, BCz);
format(strx,sizeof(strx),"%f",BCx);
format(stry,sizeof(stry),"%f",BCy);
format(strz,sizeof(strz),"%f",BCz);
dini_Set(string3, "Team1X", strx);
dini_Set(string3, "Team1Y", stry);
dini_Set(string3, "Team1Z", strz);
format(string,sizeof(string),"***The 1st team spawn cordinats: %f %f %f",BCx,BCy,BCz);
SendClientMessage(playerid,COLOR_YELLOW,string);
format(string,sizeof(string),"***Go to the 2st team spawn position and type /create [save]");
SendClientMessage(playerid,COLOR_YELLOW,string);
steps[playerid] = 5;
}
if(steps[playerid] == 5){
GetPlayerPos(playerid, BCx, BCy, BCz);
format(strx,sizeof(strx),"%f",BCx);
format(stry,sizeof(stry),"%f",BCy);
format(strz,sizeof(strz),"%f",BCz);
dini_Set(string3, "Team2X", strx);
dini_Set(string3, "Team2Y", stry);
dini_Set(string3, "Team2Z", strz);
format(string,sizeof(string),"***The 2st team spawn cordinats: %f %f %f",BCx,BCy,BCz);
SendClientMessage(playerid,COLOR_YELLOW,string);
format(string,sizeof(string),"***Type /create [Weapon 1 ID] [Weapon 2 ID] [Weapon 3 ID]");
SendClientMessage(playerid,COLOR_YELLOW,string);
steps[playerid] = 6;
}
if(steps[playerid] == 10){
//Bounds
steps[playerid] = 11;
}
}
if(IsNumeric(tmp)){
if(steps[playerid] == 6){
//Weapons1
steps[playerid] = 7;
}
}
if(IsNumeric(tmp)){
if(steps[playerid] == 7){
//Weapons2
steps[playerid] = 8;
}
}
if(IsNumeric(tmp)){
if(steps[playerid] == 8){
//Ammo1
steps[playerid] = 9;
}
}
if(IsNumeric(tmp)){
if(steps[playerid] == 9){
//Ammo2
steps[playerid] = 10;
}
}
if(IsNumeric(tmp)){
if(steps[playerid] == 11){
dini_Set(string3, "Max", tmp);
format(string,sizeof(string),"***Battle`s max players limit: %s.",tmp);
SendClientMessage(playerid,COLOR_YELLOW,string);
format(string,sizeof(string),"***Type /create [time limit] to set the battle time limit.");
SendClientMessage(playerid,COLOR_YELLOW,string);
steps[playerid] = 12;
}
}
if(IsNumeric(tmp)){
if(steps[playerid] == 12){
dini_Set(string3, "Limit", tmp);
format(string,sizeof(string),"***Battle`s time limit: %s.",tmp);
SendClientMessage(playerid,COLOR_YELLOW,string);
format(string,sizeof(string),"***Type /create [end] to end the battle creation.");
SendClientMessage(playerid,COLOR_YELLOW,string);
steps[playerid] = 13;
}
}
if(strcmp(tmp, "end", true) == 0){
if(steps[playerid] == 13){
format(string,sizeof(string),"***Battle creation is over.");
SendClientMessage(playerid,COLOR_YELLOW,string);
steps[playerid] = 14;
}
}
}
return 1;
}