//Edit
So das mit den floatstr habe ich hingekriegt ich glaube das ist jetzt so richtig wenn nicht sagt bescheid!
2. So jetzt fehlt mir nur noch das bei /remap und /copymap die Zeile auf der zuletzt was stand ersetzt wird also in Objects.txt... Und bei /delmap die letzte gelösht wird!
//IngameObjectEditor
new OID[MAX_PLAYERS], Float:OX[MAX_PLAYERS], Float:OY[MAX_PLAYERS], Float:OZ[MAX_PLAYERS], Float:ORX[MAX_PLAYERS], Float:ORY[MAX_PLAYERS], Float:ORZ[MAX_PLAYERS], ONAME[128][MAX_PLAYERS],obj[MAX_PLAYERS];
if(strcmp(cmdtext, "/mypos", true) == 0)
{
new Float:X, Float:Y, Float:Z, str[128];
GetPlayerPos(playerid,X,Y,Z);
format(str,sizeof(str),"Your position is: %f %f %f",X,Y,Z);
SendClientMessage(playerid,COLOR_RED,str);
return 1;
}
if(strcmp(cmdtext, "/mappos", true) == 0)
{
if (!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid,COLOR_RED,"You aren`t logged in as an Admin!");
}
else
{
if (!floatsqroot(OID[playerid]+OX[playerid]+OY[playerid]+OZ[playerid]+ORX[playerid]+ORY[playerid]+ORZ[playerid]))
{
return SendClientMessage(playerid, COLOR_BASIC, "Use /map first!");
}
else
{
new tmp[128];
tmp = strtok(cmdtext, index);
format(tmp, sizeof(tmp), "CreateObject(%d, %f, %f, %f, %f, %f, %f); //%s",OID[playerid], OX[playerid], OY[playerid], OZ[playerid], ORX[playerid], ORY[playerid], ORZ[playerid], ONAME[playerid]);
SendClientMessage(playerid,COLOR_RED,tmp);
}
}
return 1;
}
if(strcmp(cmd, "/map", true) == 0)
{
if (!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid,COLOR_RED,"You aren`t logged in as an Admin!");
}
else
{
new tmp[128];
tmp = strtok(cmdtext,index),OID[playerid] = strval(tmp);
tmp = strtok(cmdtext,index),OX[playerid] = floatstr(tmp);
tmp = strtok(cmdtext,index),OY[playerid] = floatstr(tmp);
tmp = strtok(cmdtext,index),OZ[playerid] = floatstr(tmp);
tmp = strtok(cmdtext,index),ORX[playerid] = floatstr(tmp);
tmp = strtok(cmdtext,index),ORY[playerid] = floatstr(tmp);
tmp = strtok(cmdtext,index),ORZ[playerid] = floatstr(tmp);
ONAME[playerid] = strtok(cmdtext,index);
obj[playerid] = CreateObject(OID[playerid], OX[playerid], OY[playerid], OZ[playerid], ORX[playerid], ORY[playerid], ORZ[playerid]);
format(tmp, sizeof(tmp), "CreateObject(%d, %f, %f, %f, %f, %f, %f); //%s",OID[playerid], OX[playerid], OY[playerid], OZ[playerid], ORX[playerid], ORY[playerid], ORZ[playerid], ONAME[playerid]);
SendClientMessage(playerid,COLOR_RED,tmp);
O(tmp);
}
return 1;
}
if(strcmp(cmd, "/copymap", true) == 0)
{
if (!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid,COLOR_RED,"You aren`t logged in as an Admin!");
}
else
{
if (!floatsqroot(OID[playerid]+OX[playerid]+OY[playerid]+OZ[playerid]+ORX[playerid]+ORY[playerid]+ORZ[playerid]))
{
return SendClientMessage(playerid, COLOR_BASIC, "Use /map first!");
}
else
{
new tmp[128];
ONAME[playerid] = strtok(cmdtext,index);
obj[playerid] = CreateObject(OID[playerid], OX[playerid], OY[playerid], OZ[playerid], ORX[playerid], ORY[playerid], ORZ[playerid]);
tmp = strtok(cmdtext, index);
format(tmp, sizeof(tmp), "CreateObject(%d, %f, %f, %f, %f, %f, %f); //%s",OID[playerid], OX[playerid], OY[playerid], OZ[playerid], ORX[playerid], ORY[playerid], ORZ[playerid], ONAME[playerid]);
SendClientMessage(playerid,COLOR_RED,tmp);
O(tmp);
}
}
return 1;
}
if(strcmp(cmd, "/remap", true) == 0)
{
if (!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid,COLOR_RED,"You aren`t logged in as an Admin!");
}
else
{
if (!floatsqroot(OID[playerid]+OX[playerid]+OY[playerid]+OZ[playerid]+ORX[playerid]+ORY[playerid]+ORZ[playerid]))
{
return SendClientMessage(playerid, COLOR_BASIC, "Use /map first!");
}
else
{
new tmp[128];
tmp = strtok(cmdtext,index),OX[playerid] = floatstr(tmp);
tmp = strtok(cmdtext,index),OY[playerid] = floatstr(tmp);
tmp = strtok(cmdtext,index),OZ[playerid] = floatstr(tmp);
tmp = strtok(cmdtext,index),ORX[playerid] = floatstr(tmp);
tmp = strtok(cmdtext,index),ORY[playerid] = floatstr(tmp);
tmp = strtok(cmdtext,index),ORZ[playerid] = floatstr(tmp);
SetObjectPos(obj[playerid], OX[playerid], OY[playerid], OZ[playerid]);
SetObjectRot(obj[playerid], ORX[playerid], ORY[playerid], ORZ[playerid]);
format(tmp, sizeof(tmp), "CreateObject(%d, %f, %f, %f, %f, %f, %f); //%s wurde verschoben! ",OID[playerid], OX[playerid], OY[playerid], OZ[playerid], ORX[playerid], ORY[playerid], ORZ[playerid], ONAME[playerid]);
SendClientMessage(playerid,COLOR_RED,tmp);
O(tmp);
}
}
return 1;
}
if(strcmp(cmd, "/delmap", true) == 0)
{
if (!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid,COLOR_RED,"You aren`t logged in as an Admin!");
}
else
{
if (!floatsqroot(OID[playerid]+OX[playerid]+OY[playerid]+OZ[playerid]+ORX[playerid]+ORY[playerid]+ORZ[playerid]))
{
return SendClientMessage(playerid, COLOR_BASIC, "Use /map first!");
}
else
{
new tmp[128];
DestroyObject(obj[playerid]);
format(tmp, sizeof(tmp), "%s wurde gelöscht!",ONAME[playerid]);
SendClientMessage(playerid,COLOR_RED,tmp);
O(tmp);
}
}
return 1;
}
//Objects
O(string[])
{
new tmp[128];
format(tmp, sizeof(tmp), "%s \r\n",string);
new File:hFile;
hFile = fopen("/Objects.txt", io_append);
fwrite(hFile, tmp);
fclose(hFile);
}