18.09.2012, 23:51
aquн hay uno https://sampforum.blast.hk/showthread.php?tid=168052
No sй, pero tengo un comando que me hizo Otacon, y estб bien, y todo, estб adaptado al sistema de maleteros del GM, ya que estб muy bueno, sуlo que faltaba comando para abrir y cerrar el mismo.. El problema es que cualquiera puede abrir el maletero de cualquiera..
pawn Код:
Код:
format(AutoInfo[tmpidcar][aOwner], MAX_PLAYER_NAME, "%s", cmd); aOwner, : El comprador del vehнculo. aOwned,: En 0, no tiene dueсo, en 1, lo tiene. aCarkey,: El slot del vehнculo, hay slot 1, 2, 3, 4 y 5, es el mбximo de vehнculos por persona. |
if(strcmp(cmd,"/llavesmaletero", true) == 0)
{
new counter = 0;
new result;
new plyName[MAX_PLAYER_NAME];
GetPlayerName(playerid, plyName, MAX_PLAYER_NAME);
for(new i; i != MAX_VEHICLES; i++)
{
new dist = CheckPlayerDistanceToVehicle(5.0, playerid, i);
if(dist)
{
result = i;
counter++;
}
}
switch(counter)
{
case 0:
{
SendClientMessage(playerid, ROJO_OSCURO, " No hay ningъn vehнculo cerca tuyo !");
}
case 1:
{
if(AutoInfo[tmpidcar][aOwner] =! 1 && AutoInfo[tmpidcar][aCarkey] >= 1) return SendClientMessage(playerid, -1, " Usted no Tiene Vehiculo o Este Vehiculo No Es Tuyo!");
if(MaleteroAbierto[result] == 0)
{
MaleteroAbierto[result] = 1;
SendClientMessage(playerid, ROJO_OSCURO, " Has abierto el maletero de tu vehнculo!");
new Motor, Luces, Alarma, Puertas, Capo, Maletero2, Objetivos;
GetVehicleParamsEx(result, Motor, Luces, Alarma, Puertas, Capo, Maletero2, Objetivos);
SetVehicleParamsEx(result, Motor, Luces, Alarma, Puertas, Capo, true, Objetivos);
}
else if(MaleteroAbierto[result] == 1)
{
MaleteroAbierto[result] = 0;
SendClientMessage(playerid, ROJO_OSCURO, " Has cerrado el maletero de tu vehнculo!");
new Motor, Luces, Alarma, Puertas, Capo, Maletero2, Objetivos;
GetVehicleParamsEx(result, Motor, Luces, Alarma, Puertas, Capo, Maletero2, Objetivos);
SetVehicleParamsEx(result, Motor, Luces, Alarma, Puertas, Capo, false, Objetivos);
}
}
default:
{
SendClientMessage(playerid, ROJO_OSCURO, " Mбs de un vehнculo detectado cerca, por favor aleje los demбs.");
}
}
return 1;
}
if(strcmp(cmd,"/maletero", true) == 0)
{
new counter = 0;
new result;
new plyName[MAX_PLAYER_NAME];
GetPlayerName(playerid, plyName, MAX_PLAYER_NAME);
for(new i; i != MAX_VEHICLES; i++)
{
new dist = CheckPlayerDistanceToVehicle(5.0, playerid, i);
if(dist)
{
result = i;
counter++;
}
}
switch(counter)
{
case 0:
{
SendClientMessage(playerid, ROJO_OSCURO, " No hay vehiculo cerca de ti !");
}
case 1:
{
if(MaleteroAbierto[result] == 1)
{
new buffer[512];
SendClientMessage(playerid, AMARILLO, "Maletero: ");
for(new slot = 1; slot != MAX_TRUNK_SLOTS; slot++)
{
new gunname[100];
if(vehTrunk[result][slot] != 0)
{
GetWeaponName(vehTrunk[result][slot], gunname, sizeof(gunname));
format(buffer, sizeof(buffer), " Espacio %i: %s (BALAS: %i)", slot, gunname, vehTrunkAmmo[result][slot]);
SendClientMessage(playerid, BLANCO, buffer);
}else
{
format(buffer, sizeof(buffer), " Espacio %i: Vacio (BALAS: N/A)", slot);
SendClientMessage(playerid, BLANCO, buffer);
}
}
}
else
{
SendClientMessage(playerid, ROJO_OSCURO, " El maletero estб cerrado!");
}
}
default:
{
SendClientMessage(playerid, ROJO_OSCURO, " Mбs de un vehнculo detectado cerca, por favor aleje los demбs.");
}
}
return 1;
}
if(strcmp(cmd,"/tomararma", true) == 0)
{
new counter = 0;
new result;
new plyName[MAX_PLAYER_NAME];
GetPlayerName(playerid, plyName, MAX_PLAYER_NAME);
for(new i; i != MAX_VEHICLES; i++)
{
new dist = CheckPlayerDistanceToVehicle(5.0, playerid, i);
if(dist)
{
result = i;
counter++;
}
}
if(JugadorInfo[playerid][jNivel] == 1)
{
SendClientMessage(playerid, ROJO_OSCURO, "No puedes retirar un arma siendo nivel 1!.");
}
switch(counter)
{
case 0:
{
SendClientMessage(playerid, ROJO_OSCURO, " No hay vehiculo cerca de ti !");
}
case 1:
{
if(vehTrunkCounter[result] != 0)
{
if(MaleteroAbierto[result] == 1)
{
if(MaleteroTimer[playerid] == 0)
{
new buffer[512];
new gunName[100];
EntregarArma(playerid, vehTrunk[result][vehTrunkCounter[result]], vehTrunkAmmo[result][vehTrunkCounter[result]]);
GetWeaponName(vehTrunk[result][vehTrunkCounter[result]], gunName, sizeof(gunName));
format(buffer, sizeof(buffer), "* Has tomado una %s (BALAS: %i) del Maletero del Vehiculo.", gunName, vehTrunkAmmo[result][vehTrunkCounter[result]]);
SendClientMessage(playerid, AMARILLO, buffer);
vehTrunk[result][vehTrunkCounter[result]] = '\0';
vehTrunkAmmo[result][vehTrunkCounter[result]] = '\0';
vehTrunkCounter[result]--;
GuardarMaleteros();
MaleteroTimer[playerid] = 1;
SetTimerEx("Maletero", 5000, false, "d", playerid);
format(string,sizeof(string), "* %s Toma un arma del maletero.", NombreJugador(playerid));
MandarMensajeCercano(30,playerid,string,ROSA,ROSA,ROSA,ROSA,ROSA);
}
else
{
SendClientMessage(playerid, ROJO_OSCURO, " Espera 5 segundos para guardar un arma denuevo!");
return 1;
}
}
else
{
SendClientMessage(playerid, ROJO_OSCURO, " El maletero estб cerrado o este coche no tiene maletero!.");
return 1;
}
}
else
{
SendClientMessage(playerid, ROJO_OSCURO, " El maletero estб Vacio!");
return 1;
}
}
default:
{
SendClientMessage(playerid, ROJO_OSCURO, " Mбs de un vehнculo detectado cerca, por favor aleje los demбs.");
return 1;
}
}
return 1;
}
if(strcmp(cmd,"/guardararma", true) == 0)
{
new counter = 0;
new result;
new plyName[MAX_PLAYER_NAME];
GetPlayerName(playerid, plyName, MAX_PLAYER_NAME);
for(new i; i != MAX_VEHICLES; i++)
{
new dist = CheckPlayerDistanceToVehicle(5.0, playerid, i);
if(dist)
{
result = i;
counter++;
}
}
switch(counter)
{
case 0:
{
SendClientMessage(playerid, ROJO_OSCURO, "No hay coches cerca de ti.");
}
case 1:
{
if(vehTrunkCounter[result] != (MAX_TRUNK_SLOTS-1))
{
if(MaleteroAbierto[result] == 1)
{
if(MaleteroTimer[playerid] == 0)
{
new buffer[512];
new gunname[100];
new gunID = GetPlayerWeapon(playerid);
new gunAmmo = GetPlayerAmmo(playerid);
new plyWeapons[12];
new plyAmmo[12];
if(gunID != 0)
{
GetWeaponName(gunID, gunname, sizeof(gunname));
for(new slot = 0; slot != 12; slot++)
{
new wep, ammo;
GetPlayerWeaponData(playerid, slot, wep, ammo);
if(wep != gunID)
{
GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
}
}
vehTrunkCounter[result]++;
vehTrunk[result][vehTrunkCounter[result]] = gunID;
vehTrunkAmmo[result][vehTrunkCounter[result]] = gunAmmo;
format(buffer, sizeof(buffer), "[Maletero] Pusiste tu %s (BALAS: %i) en el Maletero del Auto.", gunname, gunAmmo);
SendClientMessage(playerid, AMARILLO, buffer);
ResetearArmas(playerid);
for(new slot = 0; slot != 12; slot++)
{
EntregarArma(playerid, plyWeapons[slot], plyAmmo[slot]);
}
MaleteroTimer[playerid] = 1;
SetTimerEx("Maletero", 5000, false, "d", playerid);
GuardarMaleteros();
format(string,sizeof(string), "* %s Guarda un arma del maletero.", NombreJugador(playerid));
MandarMensajeCercano(30,playerid,string,ROSA,ROSA,ROSA,ROSA,ROSA);
}
else
{
SendClientMessage(playerid, ROJO_OSCURO, " No tienes arma para guardar!");
}
}
else
{
SendClientMessage(playerid, ROJO_OSCURO, " Espera 5 segundos para guardar un arma denuevo!");
}
}
else
{
SendClientMessage(playerid, ROJO_OSCURO, " El maletero estб cerrado o este coche no tiene maletero!");
}
}
else
{
SendClientMessage(playerid, ROJO_OSCURO, " Este maletero esta lleno.");
}
}
default:
{
SendClientMessage(playerid, ROJO_OSCURO, " Mбs de un vehнculo detectado cerca, por favor aleje los demбs.");
}
}
return 1;
}
if(AutoInfo[tmpidcar][aOwner] =! 1 && AutoInfo[tmpidcar][aCarkey] >= 1) return SendClientMessage(playerid, -1, " Usted no Tiene Vehiculo o Este Vehiculo No Es Tuyo!");
aquн hay uno https://sampforum.blast.hk/showthread.php?tid=168052
|
aquн hay uno https://sampforum.blast.hk/showthread.php?tid=168052
|
hola gracias pero hay uno que solo sea el fs de clanes es que he buscado por todos lados y no me han servidor llegue a encontrar uno que podrian seleccionar 1 arma para todo el clan podian invitar al clan expulsar aumentar rango declinar me podran dar uno haci gracias!
|
Necesito un sistema de guardado de armas, que cuando te desconectes con cieras armas, al volver a conectarte las sigas teniendo .
Un saludo y gracias |
#define IsNull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#define DLOGIN 1
#define DREGISTER 2
forward OnPlayerRegister(playerid, password[]);
forward OnPlayerLogin(playerid, password[]);
//----
enum pInfo
{
pAdmin,
pKey,
pNivel,
pScore,
pTeam,
pKills,
pDeaths,
pRegister,
pMoney,
pSkin,
pBanned,
pAdvers,
pVip,
pRank,
pFacc
};
new PlayerInfo[MAX_PLAYERS][pInfo];
//-----
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, plname, sizeof(plname));
format(string, sizeof(string), "cuentas/%s.ini", plname);
if(fexist(string))
{
ShowPlayerDialog(playerid, DLOGIN, DIALOG_STYLE_PASSWORD, "Bienvenido", "Pon aquн tu contraseсa para loggearte", "Aceptar", "Cancelar");
}
else
{
ShowPlayerDialog(playerid, DREGISTER, DIALOG_STYLE_INPUT, "Bienvenido", "Pon aquн tu contraseсa para registrarte", "Registrarse", "Cancelar");
}
return 1;
}
//----
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DREGISTER)
{
if(response)
{
PlayerInfo[playerid][pKey] = strval(inputtext);
OnPlayerRegister(playerid, inputtext);
}
else
{
Message(playerid, -1, "Debes ingresar una contraseсa para registrarte!");
Kick(playerid);
}
}
if(dialogid == DLOGIN)
{
if(response)
{
if(IsNull(inputtext))
{
ShowPlayerDialog(playerid, DLOGIN, DIALOG_STYLE_PASSWORD, "Bienvenido","ingresa tu contraseсa para entrar", "Aceptar", "Cancelar");
return 1;
}
OnPlayerLogin(playerid, inputtext);
}
else
{
Message(playerid, -1, "Debes loggearte para entrar");
Kick(playerid);
}
}
return 1;
}
//----
public OnPlayerRegister(playerid, password[])
{
if(IsPlayerConnected(playerid))
{
new string3[64];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), "cuentas/%s.ini", playername3);
new File: hFile = fopen(string3, io_write);
if (hFile)
{
strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 24);
new var[32];
PlayerInfo[playerid][pRank] = 1;
PlayerInfo[playerid][pKills] = 0;
PlayerInfo[playerid][pDeaths] = 0;
PlayerInfo[playerid][pAdmin] = 0;
PlayerInfo[playerid][pVip] = 0;
PlayerInfo[playerid][pBanned] = 0;
PlayerInfo[playerid][pScore] = 0;
PlayerInfo[playerid][pNivel] = 0;
format(var, 32, "Key=%s\n", PlayerInfo[playerid][pKey]);fwrite(hFile, var);
format(var, 32, "Dinero=%d\n", PlayerInfo[playerid][pMoney]);fwrite(hFile, var);
format(var, 32, "Admin=%d\n", PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
format(var, 32, "Nivel=%d\n", PlayerInfo[playerid][pNivel]);fwrite(hFile, var);
format(var, 32, "Score=%d\n", PlayerInfo[playerid][pScore]);fwrite(hFile, var);
format(var, 32, "Kills=%d\n", PlayerInfo[playerid][pKills]);fwrite(hFile, var);
format(var, 32, "Deaths=%d\n", PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
format(var, 32, "Vip=%d\n", PlayerInfo[playerid][pVip]);fwrite(hFile, var);
format(var, 32, "Advers=%d\n", PlayerInfo[playerid][pAdvers]);fwrite(hFile, var);
format(var, 32, "Skin = %d\n", PlayerInfo[playerid][pSkin]);fwrite(hFile, var);
format(var, 32, "Banned = %d\n", PlayerInfo[playerid][pBanned]);fwrite(hFile, var);
format(var, 32, "Rank = %d", PlayerInfo[playerid][pRank]);fwrite(hFile, var);
fclose(hFile);
}
}
return 1;
}
//----
public OnPlayerLogin(playerid, password[])
{
new string2[128];
new playername2[MAX_PLAYER_NAME];
new playernamesplit[3][MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
split(playername2, playernamesplit, '_');
format(string2, sizeof(string2), "cuentas/%s.ini", playername2);
new File: UserFile = fopen(string2, io_read);
if ( UserFile )
{
new PassData[128];
new keytmp[128], valtmp[128];
fread( UserFile , PassData , sizeof( PassData ) );
keytmp = ini_GetKey( PassData );
if( strcmp( keytmp , "Key" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 24);
}
if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
{
new key[ 128 ] , val[ 128 ];
new Data[ 128 ];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
if( strcmp( key , "Dinero" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMoney] = strval( val ); }
if( strcmp( key , "Nivel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pNivel] = strval( val ); }
if( strcmp( key , "Score" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pScore] = strval( val ); }
if( strcmp( key , "Kills" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKills] = strval( val ); }
if( strcmp( key , "Deaths" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDeaths] = strval( val ); }
if( strcmp( key , "Admin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
if( strcmp( key , "Vip" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pVip] = strval( val ); }
if( strcmp( key , "Advers" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdvers] = strval( val ); }
if( strcmp( key , "Skin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSkin] = strval( val ); }
if( strcmp( key , "Banned" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBanned] = strval( val ); }
if( strcmp( key , "Rank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pRank] = strval( val ); }
}
fclose(UserFile);
}
else
{
ShowPlayerDialog(playerid, DLOGIN, DIALOG_STYLE_PASSWORD, "Bienvenido","ingresa tu contraseсa para entrar", "Aceptar", "Cancelar");
SendClientMessage(playerid, -1, "Contraseсa erronea");
fclose(UserFile);
return 1;
}
}
return 1;
}
stock ini_GetKey( line[] )
{
new keyRes[128];
keyRes[0] = 0;
if ( strfind( line , "=" , true ) == -1 ) return keyRes;
strmid( keyRes , line , 0 , strfind( line , "=" , true ) , sizeof( keyRes) );
return keyRes;
}
stock ini_GetValue( line[] )
{
new valRes[128];
valRes[0]=0;
if ( strfind( line , "=" , true ) == -1 ) return valRes;
strmid( valRes , line , strfind( line , "=" , true )+1 , strlen( line ) , sizeof( valRes ) );
return valRes;
}
stock split(const strsrc[], strdest[][], delimiter)
{
new i, li;
new aNum;
new len;
while(i <= strlen(strsrc)){
if(strsrc[i]==delimiter || i==strlen(strsrc)){
len = strmid(strdest[aNum], strsrc, li, i, 128);
strdest[aNum][len] = 0;
li = i+1;
aNum++;
}
i++;
}
return 1;
}
pawn Код:
|
Failed (plugins/streamer.so: ELF file OS ABI invalid) |