PDA

View Full Version : Help with objects saving system. Dosent work, or something i do wrong. Need a solution!


gnoomen2
02/08/2012, 04:36 PM
Ok, so I got this filterscript

/*
////////////////////////////////////////////////////////////////////////////////

____ _ __
/ _/__ ___ ___ ____ (_) /___ __
_/ // _ \(_-</ _ `/ _ \/ / __/ // /
/___/_//_/___/\_,_/_//_/_/\__/\_, /
/___/

_ __ __ _ __
| | / /__ / / (_)___/ /__
| |/ / -_) _ \/ / __/ / -_)
|___/\__/_//_/_/\__/_/\__/

___ __ __ __ __
/ _ |/ /_/ /____ _____/ / __ _ ___ ___ / /_
/ __ / __/ __/ _ `/ __/ _ \/ ' \/ -_) _ \/ __/
/_/ |_\__/\__/\_,_/\__/_//_/_/_/_/\__/_//_/\__/

____ ___ __
/ __/__/ (_) /____ ____
/ _// _ / / __/ _ \/ __/
/___/\_,_/_/\__/\___/_/





- Description

It allows you to edit the offsets of any object to attach in any vehicle,
the functions will be saved in the file scriptfiles/editions.pwn.

- Author

Allan Jader (CyNiC)


- Note

You can change how much you want the filterscript, leaving the credit to creator.

////////////////////////////////////////////////////////////////////////////////////
*/

#include "a_samp"

#define CBLUE ( 0x4E76B1FF )
#define CRED ( 0xF40B74FF )
#define MAX_OBJECTS_PER_EDIT ( 10 )

forward GetKeys(playerid);

enum playerSets
{
Float:OffSetX[MAX_OBJECTS_PER_EDIT],
Float:OffSetY[MAX_OBJECTS_PER_EDIT],
Float:OffSetZ[MAX_OBJECTS_PER_EDIT],
Float:OffSetRX[MAX_OBJECTS_PER_EDIT],
Float:OffSetRY[MAX_OBJECTS_PER_EDIT],
Float:OffSetRZ[MAX_OBJECTS_PER_EDIT],
ObjectID[MAX_OBJECTS_PER_EDIT],
EditionID,
ViewingID,
EditStatus[MAX_OBJECTS_PER_EDIT],
LeftRight,
VehicleID,
ObjectModel[MAX_OBJECTS_PER_EDIT],
TimerID
}

new PlayerData[MAX_PLAYERS][playerSets];

const FloatX = 1;
const FloatY = 2;
const FloatZ = 3;
const FloatRX = 4;
const FloatRY = 5;
const FloatRZ = 6;

public OnPlayerConnect(playerid)
{
PlayerData[playerid][TimerID] = -1;
for(new i = 0; i < MAX_OBJECTS_PER_EDIT; i++) PlayerData[playerid][ObjectID][i] = -1;
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], tmp[128], idx;
cmd = strtok(cmdtext, idx);

if(!strcmp("/edit", cmd, true))
{
tmp = strtok(cmdtext, idx);

if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You are not in any vehicle. -|");

if(!strlen(tmp)) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) Use: /edit [objectid] -|");

new i, bool:OtherObject;

for(i = 0; i < MAX_OBJECTS_PER_EDIT; i++)
{
if(PlayerData[playerid][ObjectID][i] == -1) break;
OtherObject = true;
if(i == (MAX_OBJECTS_PER_EDIT - 1)) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You're editing the maximum of objects defined. -|");
}

new Obj = CreateObject(strval(tmp), 0.0, 0.0, -10.0, 0.0, 0.0, 0.0),
vId = GetPlayerVehicleID(playerid), str[148];

if(OtherObject)
{
PlayerData[playerid][ObjectModel][i] = strval(tmp);
PlayerData[playerid][EditionID] = i;
PlayerData[playerid][ObjectID][i] = Obj;
format(str, sizeof str, "|- Editing the object {F40B74}%d{4E76B1}, edition id {F40B74}%d{4E76B1}. Use KEY_LEFT, KEY_RIGHT and KEY_FIRE to adjust the offset's -|", strval(tmp), i);
SendClientMessage(playerid, CBLUE, str);
SendClientMessage(playerid, CBLUE, "|- Use {F40B74}/X /Y or /Z{4E76B1} to adjust the linear offsets -|");
SendClientMessage(playerid, CBLUE, "|- Use {F40B74}/RX /RY or /RZ{4E76B1} to adjust the rotational offsets -|");
SendClientMessage(playerid, CBLUE, "|- Use {F40B74}/EDITION{4E76B1} to switch between objects editions -|");
SendClientMessage(playerid, CBLUE, "|- Use {F40B74}/FREEZE{4E76B1} and {F40B74}/UNFREEZE{4E76B1} to freeze and unfreeze yourself -|");
SendClientMessage(playerid, CBLUE, "|- Use {F40B74}/STOP{4E76B1} to stop some edition. -|");
SendClientMessage(playerid, CBLUE, "|- Use {F40B74}/SAVEOBJ{4E76B1} to save the object to file \"editions.pwn\". -|");
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Information", "Do you wish create a object in the same position of the last?", "Yes", "No");
return true;
}
PlayerData[playerid][VehicleID] = vId;
PlayerData[playerid][ObjectModel][i] = strval(tmp);
PlayerData[playerid][EditionID] = i;
PlayerData[playerid][OffSetX][PlayerData[playerid][EditionID]] = 0.0;
PlayerData[playerid][OffSetY][PlayerData[playerid][EditionID]] = 0.0;
PlayerData[playerid][OffSetZ][PlayerData[playerid][EditionID]] = 0.0;
PlayerData[playerid][OffSetRX][PlayerData[playerid][EditionID]] = 0.0;
PlayerData[playerid][OffSetRY][PlayerData[playerid][EditionID]] = 0.0;
PlayerData[playerid][OffSetRZ][PlayerData[playerid][EditionID]] = 0.0;
PlayerData[playerid][ObjectID][i] = Obj;
PlayerData[playerid][TimerID] = SetTimerEx("GetKeys", 30, true, "i", playerid);
format(str, sizeof str, "|- Editing the object {F40B74}%d{4E76B1}, edition id {F40B74}%d{4E76B1}. Use KEY_LEFT, KEY_RIGHT and KEY_FIRE to adjust the offset's -|", strval(tmp), i);
SendClientMessage(playerid, CBLUE, str);
SendClientMessage(playerid, CBLUE, "|- Use {F40B74}/X /Y or /Z{4E76B1} to adjust the linear offsets -|");
SendClientMessage(playerid, CBLUE, "|- Use {F40B74}/RX /RY or /RZ{4E76B1} to adjust the rotational offsets -|");
SendClientMessage(playerid, CBLUE, "|- Use {F40B74}/EDITION and /EDITIONS{4E76B1} to switch between objects editions -|");
SendClientMessage(playerid, CBLUE, "|- Use {F40B74}/FREEZE{4E76B1} and {F40B74}/UNFREEZE{4E76B1} to freeze and unfreeze yourself -|");
SendClientMessage(playerid, CBLUE, "|- Use {F40B74}/STOP{4E76B1} to stop some edition. -|");
SendClientMessage(playerid, CBLUE, "|- Use {F40B74}/SAVEOBJ{4E76B1} to save the object to file \"editions.pwn\". -|");
return true;
}
if(!strcmp("/edition", cmd, true))
{
tmp = strtok(cmdtext, idx);

if(!strlen(tmp) || strval(tmp) > MAX_OBJECTS_PER_EDIT || strval(tmp) < 0) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) Use: /edition [valid edition id] -|");

if(!IsValidObject(PlayerData[playerid][ObjectID][strval(tmp)])) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You're not editing an object attachment in this edition id. -|");

PlayerData[playerid][EditionID] = strval(tmp);
format(tmp, sizeof tmp, "|- Edition changed for id [%d]. -|", strval(tmp));
return SendClientMessage(playerid, CBLUE, tmp);
}
if(!strcmp("/editions", cmd, true))
{
for(new i = 0; i < MAX_OBJECTS_PER_EDIT; i++)
{
if(IsValidObject(PlayerData[playerid][ObjectID][i]))
{
new str[128];
format(str, sizeof str, "{0090ff}Edition id: {7ce01a}[%d]\n\n{0090ff}Object Model: {7ce01a}%d", i, PlayerData[playerid][ObjectModel][i]);
PlayerData[playerid][EditionID] = i;
PlayerData[playerid][ViewingID] = i;
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Editions Viewer", str, "Select", "Advance");
return true;
}
}
return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You do no not have no one edition to see.");
}
if(!strcmp("/stop", cmd, true))
{
tmp = strtok(cmdtext, idx);

if(!strlen(tmp) || strval(tmp) > MAX_OBJECTS_PER_EDIT || strval(tmp) < 0) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) Use: /stop [valid edition id] -|");

if(!IsValidObject(PlayerData[playerid][ObjectID][strval(tmp)])) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You're not editing an object attachment in this edition id. -|");

PlayerData[playerid][ObjectID][strval(tmp)] = -1;

new j = -1;

for(new i = (MAX_OBJECTS_PER_EDIT - 1); i >= 0; i--)
{
if(IsValidObject(PlayerData[playerid][ObjectID][i]))
{
PlayerData[playerid][EditionID] = i;
j = i;
break;
}
}
if(j != -1) format(tmp, sizeof tmp, "|- Edition [%d] stoped, now you're editing the edition: [%d]. -|", strval(tmp), j);
else
{
format(tmp, sizeof tmp, "|- Edition [%d] stoped, now you do not have no one edition. -|", strval(tmp));
KillTimer(PlayerData[playerid][TimerID]);
PlayerData[playerid][TimerID] = -1;
PlayerData[playerid][EditionID] = -1;
}
return SendClientMessage(playerid, CBLUE, tmp);
}
if(!strcmp("/pause", cmd, true))
{
if(PlayerData[playerid][TimerID] == -1) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You're not editing an object attachment. -|");

KillTimer(PlayerData[playerid][TimerID]);
PlayerData[playerid][TimerID] = -1;
SendClientMessage(playerid, CBLUE, "Edition paused.");
TogglePlayerControllable(playerid, true);
return 1;
}
if(!strcmp("/back", cmd, true))
{
if(PlayerData[playerid][EditionID] == -1) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You're not editing an object attachment. -|");

else if(PlayerData[playerid][TimerID] != -1) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You was not paused the edition. -|");

PlayerData[playerid][TimerID] = SetTimerEx("GetKeys", 30, true, "i", playerid);
SendClientMessage(playerid, CBLUE, "Back to editing");
return 1;
}
if(!strcmp("/saveobj", cmd, true))
{
if(PlayerData[playerid][EditionID] == -1) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You're not editing an object attachment. -|");

new File: file = fopen("editions.pwn", io_append);

new str[256];

for(new i = 0; i < MAX_OBJECTS_PER_EDIT; i++)
{
if(IsValidObject(PlayerData[playerid][ObjectID][i]))
{
format
(
str,
256,
"AttachObjectToVehicle(objectid, vehicleid, %f, %f, %f, %f, %f, %f); //Object Model: %d | %s\r\n",
PlayerData[playerid][OffSetX][i],
PlayerData[playerid][OffSetY][i],
PlayerData[playerid][OffSetZ][i],
PlayerData[playerid][OffSetRX][i],
PlayerData[playerid][OffSetRY][i],
PlayerData[playerid][OffSetRZ][i],
PlayerData[playerid][ObjectModel][i],
cmdtext[8]
);
fwrite(file, str);
}
}
fclose(file);
return SendClientMessage(playerid, CBLUE, "|- Edition saved to file \"editions.pwn\". -|");
}
if(!strcmp("/x", cmd, true))
{
if(PlayerData[playerid][EditionID] == -1) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You're not editing an object attachment. -|");

PlayerData[playerid][EditStatus] = FloatX;
return SendClientMessage(playerid, CBLUE, "|- Editing Float X. -|");
}
if(!strcmp("/y", cmd, true))
{
if(PlayerData[playerid][EditionID] == -1) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You're not editing an object attachment. -|");

PlayerData[playerid][EditStatus] = FloatY;
return SendClientMessage(playerid, CBLUE, "|- Editing Float Y. -|");
}
if(!strcmp("/z", cmd, true))
{
if(PlayerData[playerid][EditionID] == -1) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You're not editing an object attachment. -|");

PlayerData[playerid][EditStatus] = FloatZ;
return SendClientMessage(playerid, CBLUE, "|- Editing Float Z. -|");
}
if(!strcmp("/rx", cmd, true))
{
if(PlayerData[playerid][EditionID] == -1) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You're not editing an object attachment. -|");

PlayerData[playerid][EditStatus] = FloatRX;
return SendClientMessage(playerid, CBLUE, "|- Editing Float RX. -|");
}
if(!strcmp("/ry", cmd, true))
{
if(PlayerData[playerid][EditionID] == -1) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You're not editing an object attachment. -|");

PlayerData[playerid][EditStatus] = FloatRY;
return SendClientMessage(playerid, CBLUE, "|- Editing Float RY. -|");
}
if(!strcmp("/rz", cmd, true))
{
if(PlayerData[playerid][EditionID] == -1) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You're not editing an object attachment. -|");

PlayerData[playerid][EditStatus] = FloatRZ;
return SendClientMessage(playerid, CBLUE, "|- Editing Float RZ. -|");
}

if(!strcmp("/freeze", cmd, true))
{
if(PlayerData[playerid][EditionID] == -1) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You're not editing an object attachment. -|");

TogglePlayerControllable(playerid, false);
SendClientMessage(playerid, CBLUE, "|- You're freezed, use /unfreeze to unfreeze yourself. -|");
return 1;
}
if(!strcmp("/unfreeze", cmd, true))
{
if(PlayerData[playerid][EditionID] == -1) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) You're not editing an object attachment. -|");

TogglePlayerControllable(playerid, true);
SendClientMessage(playerid, CBLUE, "|- You're unfreezed. -|");
return 1;
}
return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 0:
{
if(response)
{
PlayerData[playerid][OffSetX][PlayerData[playerid][EditionID]] = PlayerData[playerid][OffSetX][PlayerData[playerid][EditionID] - 1];
PlayerData[playerid][OffSetY][PlayerData[playerid][EditionID]] = PlayerData[playerid][OffSetY][PlayerData[playerid][EditionID] - 1];
PlayerData[playerid][OffSetZ][PlayerData[playerid][EditionID]] = PlayerData[playerid][OffSetZ][PlayerData[playerid][EditionID] - 1];
PlayerData[playerid][OffSetRX][PlayerData[playerid][EditionID]] = PlayerData[playerid][OffSetRX][PlayerData[playerid][EditionID] - 1];
PlayerData[playerid][OffSetRY][PlayerData[playerid][EditionID]] = PlayerData[playerid][OffSetRY][PlayerData[playerid][EditionID] - 1];
PlayerData[playerid][OffSetRZ][PlayerData[playerid][EditionID]] = PlayerData[playerid][OffSetRZ][PlayerData[playerid][EditionID] - 1];
return 1;
}
}
case 1:
{
if(response)
{
new str[64];
format(str, sizeof str, "|- Edition changed for id [%d]. -|", PlayerData[playerid][EditionID]);
SendClientMessage(playerid, CBLUE, str);
return 1;
}
else
{
new str[128], HighID;
for(new i = 0; i < MAX_OBJECTS_PER_EDIT; i++) if(IsValidObject(PlayerData[playerid][ObjectID][i])) HighID++;

new NextView = GetAValidObject(playerid, PlayerData[playerid][ViewingID]);

if(NextView != -1)
{
PlayerData[playerid][EditionID] = NextView;
PlayerData[playerid][ViewingID] = GetAValidObject(playerid, NextView + 1);
if(GetAValidObject(playerid, NextView + 1) == -1) PlayerData[playerid][ViewingID] = 0;
format(str, sizeof str, "{0090ff}Edition id: {7ce01a}[%d]\n\n{0090ff}Object Model: {7ce01a}%d", NextView, PlayerData[playerid][ObjectModel][NextView]);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Editions Viewer", str, "Select", "Advance");
return 1;
}
}
}
}
return 1;
}

public OnFilterScriptInit()
{
for(new i = 0, j = GetMaxPlayers(); i < j; ++i)
{
PlayerData[i][TimerID] = -1;
for(new k = 0; k < MAX_OBJECTS_PER_EDIT; k++) PlayerData[i][ObjectID][k] = -1;
}
return true;
}

public OnFilterScriptExit()
{
for(new i = 0, j = GetMaxPlayers(); i < j; ++i)
{
for(new k = 0; k < MAX_OBJECTS_PER_EDIT; k++) DestroyObject(PlayerData[i][ObjectID][k]);
}
return 1;
}

public GetKeys(playerid)
{
new Keys, ud, gametext[36], Float: toAdd;

GetPlayerKeys(playerid,Keys,ud,PlayerData[playerid][LeftRight]);
switch(Keys)
{
case KEY_FIRE: toAdd = 0.000500;
default: toAdd = 0.005000;
}
if(PlayerData[playerid][LeftRight] == 128)
{
switch(PlayerData[playerid][EditStatus])
{
case FloatX:
{
PlayerData[playerid][OffSetX][PlayerData[playerid][EditionID]] = floatadd(PlayerData[playerid][OffSetX][PlayerData[playerid][EditionID]], toAdd);
format(gametext, 36, "offsetx: ~w~%f", PlayerData[playerid][OffSetX][PlayerData[playerid][EditionID]]);
GameTextForPlayer(playerid, gametext, 1000, 3);
}
case FloatY:
{
PlayerData[playerid][OffSetY][PlayerData[playerid][EditionID]] = floatadd(PlayerData[playerid][OffSetY][PlayerData[playerid][EditionID]], toAdd);
format(gametext, 36, "offsety: ~w~%f", PlayerData[playerid][OffSetY][PlayerData[playerid][EditionID]]);
GameTextForPlayer(playerid, gametext, 1000, 3);
}
case FloatZ:
{
PlayerData[playerid][OffSetZ][PlayerData[playerid][EditionID]] = floatadd(PlayerData[playerid][OffSetZ][PlayerData[playerid][EditionID]], toAdd);
format(gametext, 36, "offsetz: ~w~%f", PlayerData[playerid][OffSetZ][PlayerData[playerid][EditionID]]);
GameTextForPlayer(playerid, gametext, 1000, 3);
}
case FloatRX:
{
if(Keys == 0) PlayerData[playerid][OffSetRX][PlayerData[playerid][EditionID]] = floatadd(PlayerData[playerid][OffSetRX][PlayerData[playerid][EditionID]], floatadd(toAdd, 1.000000));
else PlayerData[playerid][OffSetRX][PlayerData[playerid][EditionID]] = floatadd(PlayerData[playerid][OffSetRX], floatadd(toAdd,0.100000));
format(gametext, 36, "offsetrx: ~w~%f", PlayerData[playerid][OffSetRX][PlayerData[playerid][EditionID]]);
GameTextForPlayer(playerid, gametext, 1000, 3);
}
case FloatRY:
{
if(Keys == 0) PlayerData[playerid][OffSetRY][PlayerData[playerid][EditionID]] = floatadd(PlayerData[playerid][OffSetRY][PlayerData[playerid][EditionID]], floatadd(toAdd, 1.000000));
else PlayerData[playerid][OffSetRY][PlayerData[playerid][EditionID]] = floatadd(PlayerData[playerid][OffSetRY][PlayerData[playerid][EditionID]], floatadd(toAdd,0.100000));
format(gametext, 36, "offsetry: ~w~%f", PlayerData[playerid][OffSetRY][PlayerData[playerid][EditionID]]);
GameTextForPlayer(playerid, gametext, 1000, 3);
}
case FloatRZ:
{
if(Keys == 0) PlayerData[playerid][OffSetRZ][PlayerData[playerid][EditionID]] = floatadd(PlayerData[playerid][OffSetRZ][PlayerData[playerid][EditionID]], floatadd(toAdd, 1.000000));
else PlayerData[playerid][OffSetRZ][PlayerData[playerid][EditionID]] = floatadd(PlayerData[playerid][OffSetRZ][PlayerData[playerid][EditionID]], floatadd(toAdd,0.100000));
format(gametext, 36, "offsetrz: ~w~%f", PlayerData[playerid][OffSetRZ][PlayerData[playerid][EditionID]]);
GameTextForPlayer(playerid, gametext, 1000, 3);
}
}
}
else if(PlayerData[playerid][LeftRight] == -128)
{
switch(PlayerData[playerid][EditStatus])
{
case FloatX:
{
PlayerData[playerid][OffSetX][PlayerData[playerid][EditionID]] = floatsub(PlayerData[playerid][OffSetX][PlayerData[playerid][EditionID]], toAdd);
format(gametext, 36, "offsetx: ~w~%f", PlayerData[playerid][OffSetX][PlayerData[playerid][EditionID]]);
GameTextForPlayer(playerid, gametext, 1000, 3);
}
case FloatY:
{
PlayerData[playerid][OffSetY][PlayerData[playerid][EditionID]] = floatsub(PlayerData[playerid][OffSetY][PlayerData[playerid][EditionID]], toAdd);
format(gametext, 36, "offsety: ~w~%f", PlayerData[playerid][OffSetY][PlayerData[playerid][EditionID]]);
GameTextForPlayer(playerid, gametext, 1000, 3);
}
case FloatZ:
{
PlayerData[playerid][OffSetZ][PlayerData[playerid][EditionID]] = floatsub(PlayerData[playerid][OffSetZ][PlayerData[playerid][EditionID]], toAdd);
format(gametext, 36, "offsetz: ~w~%f", PlayerData[playerid][OffSetZ][PlayerData[playerid][EditionID]]);
GameTextForPlayer(playerid, gametext, 1000, 3);
}
case FloatRX:
{
if(Keys == 0) PlayerData[playerid][OffSetRX][PlayerData[playerid][EditionID]] = floatsub(PlayerData[playerid][OffSetRX][PlayerData[playerid][EditionID]], floatadd(toAdd, 1.000000));
else PlayerData[playerid][OffSetRX][PlayerData[playerid][EditionID]] = floatsub(PlayerData[playerid][OffSetRX][PlayerData[playerid][EditionID]], floatadd(toAdd,0.100000));
format(gametext, 36, "offsetrx: ~w~%f", PlayerData[playerid][OffSetRX][PlayerData[playerid][EditionID]]);
GameTextForPlayer(playerid, gametext, 1000, 3);
}
case FloatRY:
{
if(Keys == 0) PlayerData[playerid][OffSetRY][PlayerData[playerid][EditionID]] = floatsub(PlayerData[playerid][OffSetRY][PlayerData[playerid][EditionID]], floatadd(toAdd, 1.000000));
else PlayerData[playerid][OffSetRY][PlayerData[playerid][EditionID]] = floatsub(PlayerData[playerid][OffSetRY][PlayerData[playerid][EditionID]], floatadd(toAdd,0.100000));
format(gametext, 36, "offsetry: ~w~%f", PlayerData[playerid][OffSetRY][PlayerData[playerid][EditionID]]);
GameTextForPlayer(playerid, gametext, 1000, 3);
}
case FloatRZ:
{
if(Keys == 0) PlayerData[playerid][OffSetRZ][PlayerData[playerid][EditionID]] = floatsub(PlayerData[playerid][OffSetRZ][PlayerData[playerid][EditionID]], floatadd(toAdd, 1.000000));
else PlayerData[playerid][OffSetRZ][PlayerData[playerid][EditionID]] = floatsub(PlayerData[playerid][OffSetRZ][PlayerData[playerid][EditionID]], floatadd(toAdd,0.100000));
format(gametext, 36, "offsetrz: ~w~%f", PlayerData[playerid][OffSetRZ][PlayerData[playerid][EditionID]]);
GameTextForPlayer(playerid, gametext, 1000, 3);
}
}
}
AttachObjectToVehicle(PlayerData[playerid][ObjectID][PlayerData[playerid][EditionID]], PlayerData[playerid][VehicleID], PlayerData[playerid][OffSetX][PlayerData[playerid][EditionID]], PlayerData[playerid][OffSetY][PlayerData[playerid][EditionID]], PlayerData[playerid][OffSetZ][PlayerData[playerid][EditionID]], PlayerData[playerid][OffSetRX][PlayerData[playerid][EditionID]], PlayerData[playerid][OffSetRY][PlayerData[playerid][EditionID]], PlayerData[playerid][OffSetRZ][PlayerData[playerid][EditionID]]);
return true;
}


strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}

new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}

GetAValidObject(playerid, index)
{
if(index > MAX_OBJECTS_PER_EDIT) return -1;
for(new i = index; i < MAX_OBJECTS_PER_EDIT; i++) if(IsValidObject(PlayerData[playerid][ObjectID][i])) return i;
return -1;
}

By Allan Jader, but the objects dosen't load when i start the gamemode and Rcon load the filterscript that runs a filterscript, that runs this filterscript. I know that works, but how can i make them save? there is a file called editions.pwn, where all the "saved" objects are:

AttachObjectToVehicle(objectid, vehicleid, -0.579999, -1.964998, 0.294999, 0.000000, 0.000000, 0.000000); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, -0.579999, -1.964998, 0.289999, 0.000000, 0.000000, 0.000000); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, -0.999999, -0.969999, -0.005000, -511.546691, -88.439956, 5.025000); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, -0.794999, -1.634998, 0.304999, -546.721862, -175.875076, 89.444953); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, -0.794999, -1.709998, 0.304999, -546.721862, -175.875076, 89.444953); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, 0.794999, -1.729998, 0.324999, -8.039999, 10.050001, -89.444953); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, -0.419999, -2.044999, 0.304999, 16.080001, -0.000000, 0.000000); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, -0.049999, -1.789998, 0.000000, 0.000000, 0.000000, 0.000000); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, -0.049999, -1.789998, 0.000000, 0.000000, 0.000000, 0.000000); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, -0.049999, -1.789998, 0.000000, 0.000000, 0.000000, 0.000000); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, -0.049999, -1.794998, 0.000000, 0.000000, 0.000000, 0.000000); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, -0.049999, -1.789998, 0.000000, 0.000000, 0.000000, 0.000000); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, -0.049999, -1.764998, 0.000000, 0.000000, 0.000000, 0.000000); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, -0.049999, -1.789998, 0.000000, 0.000000, 0.000000, 0.000000); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, -0.049999, -1.789998, 0.000000, 0.000000, 0.000000, 0.000000); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, -0.015000, -2.225003, 0.279999, 0.000000, 0.000000, 0.000000); //Object Model: 1001 |
AttachObjectToVehicle(objectid, vehicleid, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000); //Object Model: 0 |
AttachObjectToVehicle(objectid, vehicleid, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000); //Object Model: 0 |
AttachObjectToVehicle(objectid, vehicleid, 0.000000, -2.475009, 0.154999, 0.000000, 0.000000, 0.000000); //Object Model: 1001 |
AttachObjectToVehicle(objectid, vehicleid, 0.000000, -2.220003, 0.279999, 0.000000, 0.000000, 0.000000); //Object Model: 1001 |
AttachObjectToVehicle(objectid, vehicleid, 0.000000, -2.955020, 0.044999, 0.000000, 0.000000, 0.000000); //Object Model: 1001 |
AttachObjectToVehicle(objectid, vehicleid, -0.049999, -1.729998, 0.029999, 0.000000, 0.000000, 0.000000); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, -0.069999, -1.659998, 0.049999, 0.000000, 0.000000, 0.000000); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, -1.169999, -4.970066, 0.864999, 0.000000, 0.000000, 0.000000); //Object Model: 1001 |
AttachObjectToVehicle(objectid, vehicleid, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000); //Object Model: 1001 |
AttachObjectToVehicle(objectid, vehicleid, -0.459999, -1.484998, 0.869999, 2.010000, 179.895095, -92.459945); //Object Model: 1010 |
AttachObjectToVehicle(objectid, vehicleid, 0.444999, -0.249999, 0.564999, 0.000000, 0.000000, 0.000000); //Object Model: 1006 |

This followed with the filterscript, but still the saved objects dosent load up when i load this filterscript.

Help guys! How can i make it load or another save objects method.. i am new to scripting, just saying.