Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ////////////////////////////////////////////////////////////////////////////////
- CREADOR ALEJANDRO KARDONA
- - Commands:
- Type /Editar to edit a model and create a edition id.
- Type /Edicion to switch between editions.
- Type /X /Y or /Z to adjust the linear offsets.
- Type /RX /RY or /RZ to adjust the rotational offsets.
- Type /Freeze and /Unfreeze to freeze and unfreeze yourself.
- Type /Parar to stop an edition id and destroy the object.
- Type /Guardarobjeto to save the object offsets to the file "editions.pwn".
- Type /Ediciones to switch between editions seeing the objects with a indication arrow.
- Type /Materiales to see a list of materials available.
- Type /Material [model/txd name/texture name] to set a specific material. The material only will be set when you choise the trhee params!
- ////////////////////////////////////////////////////////////////////////////////////
- */
- #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],
- Arrow,
- 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;
- PlayerData[playerid][Arrow] = -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("/editar", cmd, true))
- {
- tmp = strtok(cmdtext, idx);
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) No estas en un vehiculo. -|");
- if(!strlen(tmp)) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) Usa: /editar [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)) Está editando el máximo de objetos definidos. -|");
- }
- 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, "|- Usa {F40B74}/X /Y or /Z{4E76B1} to adjust the linear offsets -|");
- SendClientMessage(playerid, CBLUE, "|- Usa {F40B74}/RX /RY or /RZ{4E76B1} to adjust the rotational offsets -|");
- SendClientMessage(playerid, CBLUE, "|- Usa {F40B74}/EDITION{4E76B1} to switch between objects editions -|");
- SendClientMessage(playerid, CBLUE, "|- Usa {F40B74}/FREEZE{4E76B1} and {F40B74}/UNFREEZE{4E76B1} to freeze and unfreeze yourself -|");
- SendClientMessage(playerid, CBLUE, "|- Usa {F40B74}/STOP{4E76B1} to stop some edition. -|");
- SendClientMessage(playerid, CBLUE, "|- Usa {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, "|- Usa {F40B74}/X /Y or /Z{4E76B1} to adjust the linear offsets -|");
- SendClientMessage(playerid, CBLUE, "|- Usa {F40B74}/RX /RY or /RZ{4E76B1} to adjust the rotational offsets -|");
- SendClientMessage(playerid, CBLUE, "|- Usa {F40B74}/EDITION and /EDITIONS{4E76B1} to switch between objects editions -|");
- SendClientMessage(playerid, CBLUE, "|- Usa {F40B74}/FREEZE{4E76B1} and {F40B74}/UNFREEZE{4E76B1} to freeze and unfreeze yourself -|");
- SendClientMessage(playerid, CBLUE, "|- Usa {F40B74}/STOP{4E76B1} to stop some edition. -|");
- SendClientMessage(playerid, CBLUE, "|- Usa {F40B74}/SAVEOBJ{4E76B1} to save the object to file \"editions.pwn\". -|");
- return true;
- }
- if(!strcmp("/edicion", cmd, true))
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp) || strval(tmp) > MAX_OBJECTS_PER_EDIT || strval(tmp) < 0) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) Use: /edicion [valid edition id] -|");
- if(!IsValidObject(PlayerData[playerid][ObjectID][strval(tmp)])) return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) No está editando un archivo adjunto objeto en esta edición de id. -|");
- PlayerData[playerid][EditionID] = strval(tmp);
- format(tmp, sizeof tmp, "|- Edition changed for id [%d]. -|", strval(tmp));
- return SendClientMessage(playerid, CBLUE, tmp);
- }
- if(!strcmp("/ediciones", cmd, true))
- {
- for(new i = 0; i < MAX_OBJECTS_PER_EDIT; i++)
- {
- if(IsValidObject(PlayerData[playerid][ObjectID][i]))
- {
- new str[128];
- PlayerData[playerid][Arrow] = CreateObject(19133, 0.0, 0.0, -10.0, 0.0, 0.0, 0.0);
- AttachObjectToVehicle(PlayerData[playerid][Arrow], PlayerData[playerid][VehicleID], PlayerData[playerid][OffSetX][i], PlayerData[playerid][OffSetY][i], PlayerData[playerid][OffSetZ][i] + 1.3, 0.0, 0.0, 0.0);
- 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, "Seleccionar", "Avanzado");
- return true;
- }
- }
- return SendClientMessage(playerid, CBLUE, "|- ((ERROR)) No tienes ediciones para ver.");
- }
- if(!strcmp("/parar", 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. -|");
- DestroyObject(PlayerData[playerid][ObjectID][strval(tmp)]);
- 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("/guardarobjeto", 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);
- DestroyObject(PlayerData[playerid][Arrow]);
- PlayerData[playerid][Arrow] = -1;
- 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;
- AttachObjectToVehicle(PlayerData[playerid][Arrow], PlayerData[playerid][VehicleID], PlayerData[playerid][OffSetX][NextView], PlayerData[playerid][OffSetY][NextView], PlayerData[playerid][OffSetZ][NextView] + 1.3, 0.0, 0.0, 0.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;
- PlayerData[i][Arrow] = -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]);
- if(PlayerData[i][Arrow] != -1) DestroyObject(PlayerData[i][Arrow]);
- }
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment