Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum E_ATTACH{
- Float: E_OFFSETX,
- Float: E_OFFSETY,
- Float: E_OFFSETZ,
- Float: E_SCALEX,
- Float: E_SCALEY,
- Float: E_SCALEZ,
- Float: E_ROTX,
- Float: E_ROTY,
- Float: E_ROTZ,
- E_COLOR1,
- E_COLOR2,
- E_MODEL,
- E_BONE
- };
- stock
- Attach[MAX_PLAYERS][10][E_ATTACH]
- ;
- forward OnPlayerAttachUpdate(playerid, index, modelid, bone, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ, color1, color2);
- stock _SetPlayerAttachedObject(playerid, index, modelid, bone, Float:fOffsetX = 0.0,Float:fOffsetY = 0.0, Float:fOffsetZ = 0.0, Float:fRotX = 0.0, Float:fRotY = 0.0, Float:fRotZ = 0.0,Float:fScaleX = 1.0, Float:fScaleY = 1.0, Float:fScaleZ = 1.0, color1 = 0, color2 = 0){
- Attach[playerid][index][E_OFFSETX] = fOffsetX;
- Attach[playerid][index][E_OFFSETY] = fOffsetY;
- Attach[playerid][index][E_OFFSETZ] = fOffsetZ;
- Attach[playerid][index][E_SCALEX] = fScaleX;
- Attach[playerid][index][E_SCALEY] = fScaleY;
- Attach[playerid][index][E_SCALEZ] = fScaleZ;
- Attach[playerid][index][E_ROTX] = fRotX;
- Attach[playerid][index][E_ROTY] = fRotY;
- Attach[playerid][index][E_ROTZ] = fRotZ;
- Attach[playerid][index][E_MODEL] = modelid;
- Attach[playerid][index][E_COLOR1] = color1;
- Attach[playerid][index][E_COLOR2] = color2;
- Attach[playerid][index][E_BONE] = bone;
- return SetPlayerAttachedObject(playerid, index, modelid, bone, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ, color1, color2);
- }
- stock SaveAttached(pid){
- static _file[100];
- static _fr[100];
- static _n[24];
- static File:_f;
- for(new i; i != 10; ++i){
- if(Attach[pid][i][E_MODEL] != 0){
- format(_file, 100, "Pached_%s_%d.ini", (GetPlayerName(pid, _n, 24), _n), i);
- _f = fopen(_file, io_write);
- format(_fr, 100,"E_OFFSETX=%f\r\n", Attach[pid][i][E_OFFSETX]); fwrite(_f, _fr);
- format(_fr, 100,"E_OFFSETY=%f\r\n", Attach[pid][i][E_OFFSETY]); fwrite(_f, _fr);
- format(_fr, 100,"E_OFFSETZ=%f\r\n", Attach[pid][i][E_OFFSETZ]); fwrite(_f, _fr);
- format(_fr, 100,"E_SCALEX=%f\r\n", Attach[pid][i][E_SCALEX]); fwrite(_f, _fr);
- format(_fr, 100,"E_SCALEY=%f\r\n", Attach[pid][i][E_SCALEX]); fwrite(_f, _fr);
- format(_fr, 100,"E_SCALEZ=%f\r\n", Attach[pid][i][E_SCALEX]); fwrite(_f, _fr);
- format(_fr, 100,"E_ROTX=%f\r\n", Attach[pid][i][E_ROTX]); fwrite(_f, _fr);
- format(_fr, 100,"E_ROTY=%f\r\n", Attach[pid][i][E_ROTY]); fwrite(_f, _fr);
- format(_fr, 100,"E_ROTY=%f\r\n", Attach[pid][i][E_ROTZ]); fwrite(_f, _fr);
- format(_fr, 100,"E_COLOR1=%d\r\n", Attach[pid][i][E_COLOR1]); fwrite(_f, _fr);
- format(_fr, 100,"E_COLOR2=%d\r\n", Attach[pid][i][E_COLOR2]); fwrite(_f, _fr);
- format(_fr, 100,"E_MODEL=%d\r\n", Attach[pid][i][E_MODEL]); fwrite(_f, _fr);
- format(_fr, 100,"E_BONE=%d\r\n", Attach[pid][i][E_BONE]); fwrite(_f, _fr);
- fclose(_f);
- }
- }
- }
- stock LoadAttached(pid){
- static
- _file[100],
- _n[24]
- ;
- for(new i; i != 10; ++i){
- format(_file, 100, "Pached_%s_%d.ini", (GetPlayerName(pid, _n, 24), _n), i);
- if(fexist(_file))
- {
- Attach[pid][i][E_OFFSETX] = floatstr( _get(_file, "E_OFFSETX") );
- Attach[pid][i][E_OFFSETY] = floatstr( _get(_file, "E_OFFSETY") );
- Attach[pid][i][E_OFFSETZ] = floatstr( _get(_file, "E_OFFSETZ") );
- Attach[pid][i][E_SCALEX] = floatstr( _get(_file, "E_SCALEX") );
- Attach[pid][i][E_SCALEY] = floatstr( _get(_file, "E_SCALEY") );
- Attach[pid][i][E_SCALEZ] = floatstr( _get(_file, "E_SCALEZ") );
- Attach[pid][i][E_ROTX] = floatstr( _get(_file, "E_ROTX") );
- Attach[pid][i][E_ROTY] = floatstr( _get(_file, "E_ROTY") );
- Attach[pid][i][E_ROTZ] = floatstr( _get(_file, "E_ROTZ") );
- Attach[pid][i][E_MODEL] = strval( _get(_file, "E_MODEL") );
- Attach[pid][i][E_COLOR1] = strval( _get(_file, "E_COLOR1") );
- Attach[pid][i][E_COLOR2] = strval( _get(_file, "E_COLOR2") );
- Attach[pid][i][E_BONE] = strval( _get(_file, "E_BONE") );
- SetPlayerAttachedObject(pid, i, Attach[pid][i][E_MODEL], Attach[pid][i][E_BONE],
- Attach[pid][i][E_OFFSETX], Attach[pid][i][E_OFFSETY], Attach[pid][i][E_OFFSETZ], Attach[pid][i][E_ROTX],
- Attach[pid][i][E_ROTY], Attach[pid][i][E_ROTZ],
- Attach[pid][i][E_SCALEX], Attach[pid][i][E_SCALEY], Attach[pid][i][E_SCALEZ], Attach[pid][i][E_COLOR1], Attach[pid][i][E_COLOR2]);
- }
- }
- }
- stock _get(filename[], line[]){
- static
- _buffer[128],
- File: _file,
- _size
- ;
- _file = fopen(filename, io_read);
- while(fread(_file, _buffer)){
- if(!strfind(_buffer, line)){
- _size = strfind(_buffer, "=");
- strdel(_buffer, 0, _size + 1);
- _size = strlen(_buffer);
- strdel(_buffer, _size-2, _size);
- return _buffer;
- }
- }
- return _buffer;
- }
- stock _RemovePlayerAttachedObject(playerid, index){
- Attach[playerid][index][E_OFFSETX] = 0.0;
- Attach[playerid][index][E_OFFSETY] = 0.0;
- Attach[playerid][index][E_OFFSETZ] = 0.0;
- Attach[playerid][index][E_SCALEX] = 0.0;
- Attach[playerid][index][E_SCALEY] = 0.0;
- Attach[playerid][index][E_SCALEZ] = 0.0;
- Attach[playerid][index][E_ROTX] = 0.0;
- Attach[playerid][index][E_ROTY] = 0.0;
- Attach[playerid][index][E_ROTZ] = 0.0;
- Attach[playerid][index][E_MODEL] = 0;
- Attach[playerid][index][E_COLOR1] = 0;
- Attach[playerid][index][E_COLOR2] = 0;
- Attach[playerid][index][E_BONE] = 0;
- RemovePlayerAttachedObject(playerid, index);
- }
- stock GetAttachedObjectPos(playerid, index, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ){
- fOffsetX = Attach[playerid][index][E_OFFSETX];
- fOffsetY = Attach[playerid][index][E_OFFSETY];
- fOffsetZ = Attach[playerid][index][E_OFFSETZ];
- fScaleX = Attach[playerid][index][E_SCALEX];
- fScaleY = Attach[playerid][index][E_SCALEY];
- fScaleZ = Attach[playerid][index][E_SCALEZ];
- fRotX = Attach[playerid][index][E_ROTX];
- fRotY = Attach[playerid][index][E_ROTY];
- fRotZ = Attach[playerid][index][E_ROTZ];
- }
- stock GetAttachedInfo(playerid, modelid, bone, color, color2){
- modelid = Attach[playerid][index][E_MODEL];
- color = Attach[playerid][index][E_COLOR1];
- color2 = Attach[playerid][index][E_COLOR2];
- bone = Attach[playerid][index][E_BONE];
- }
- saveAttach(playerid){
- // if(IsPlayerAttachedObjectSlotUsed(if(IsPlayerAttachedObjectSlotUsed(playerid, i))
- new
- _Nm[ 45 ],
- _st[ 32 ]
- ;
- // "Acessorios/Nome.ini"
- strcat(_Nm, "Acessorios/");
- GetPlayerName(playerid, _Nm, 24);
- strcat(_Nm, ".ini");
- for(
- new i; i != 9; ++i
- )
- {
- if(IsPlayerAttachedObjectSlotUsed(playerid, i)){ //
- }
- }
- }
- #define SetPlayerAttachedObject _SetPlayerAttachedObject
- #define RemovePlayerAttachedObject _RemovePlayerAttachedObject
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement