Hello, I go back again lol.
(http://fotos.subefotos.com/a5d155e7ea72b347874039027f874e13o.png)
> First copy this lines and paste on "onScriptLoad()" db <- ConnectSQL( "Spawnwep.db" );
QuerySQL( db,"CREATE TABLE IF NOT EXISTS Spawnwep( Nick TEXT, Weps TEXT)");
SpawnwepPlayer <- array( GetMaxPlayers(), null );
> Now copy this line and paste on "onPlayerJoin( player )"LoadSpawnwep(player);
> Paste this on "onPlayerSpawn( player )"GiveSpawnwep(player);
> And now paste this on "onPlayerPart( player, reason )"if (SpawnwepPlayer[ player.ID ] != null)
{
if(!CheckTableSpawnwep( player )) QuerySQL( db, "REPLACE INTO Spawnwep( Nick, Weps ) VALUES ( '" + player.Name + "','"+ SpawnwepPlayer[ player.ID ] + "' ) ");
else QuerySQL( db, "UPDATE Spawnwep SET Weps='"+ SpawnwepPlayer[ player.ID ] +"' WHERE Nick='" + player.Name + "'" );
SpawnwepPlayer[ player.ID ] = null; print( player.Name +"'s Spawnwep Saved!" );
}
(http://fotos.subefotos.com/85af601f8e1ccf4c7f6ba08a2f04617co.png)
//=================================SPAWNWEP STSTEM BY MACK==========================================================
function CheckTableSpawnwep( player )
{
local si = GetSQLColumnData( QuerySQL( db, "SELECT Weps FROM Spawnwep WHERE Nick='" + player.Name + "'" ), 0 );
if ( si ) return si;
else return 0;
}
//-------------------------------------------------------------------------------------------------------------------
function LoadSpawnwep(player)
{
if(CheckTableSpawnwep( player )) SpawnwepPlayer[ player.ID ] = CheckTableSpawnwep( player );
else SpawnwepPlayer[ player.ID ] = null;
}
//-------------------------------------------------------------------------------------------------------------------
function GiveSpawnwep(player)
{
if (SpawnwepPlayer[ player.ID ] != null)
{
local i = 1, khe = SpawnwepPlayer[ player.ID ], Nweps = NumTok( khe," ");
while ( i < (Nweps.tointeger()+1))
{
local ID = GetTok( khe," ", i);
player.SetWeapon( ID.tointeger(), 99999 ); i++;
}
ClientMessage("-> [#83bab3][SPAWNWEP] Weapons setting in spawn, Completed successfully.",player,255,0,102);
}
}
//=================================SPAWNWEP STSTEM BY MACK==========================================================
> Credits to original creator of this functions.//-------------------------------------------------------------------------------------------------------------------
function NumTok(string, separator)
{
local tokenized = split(string, separator);
return tokenized.len();
}
//-------------------------------------------------------------------------------------------------------------------
function GetPlayer( target )
{
local target1 = target.tostring();
if ( IsNum( target ) )
{
target = target.tointeger();
if ( FindPlayer( target) ) return FindPlayer( target );
else return null;
}
else if ( FindPlayer( target ) ) return FindPlayer( target );
else return null;
}
//-------------------------------------------------------------------------------------------------------------------
(http://fotos.subefotos.com/1d94a994f515360a746a96067c11cb62o.png)
> Commands: /spawnwep, /spawnwepdel. <
if ( cmd == "spawnwep" )
{
if ( !text ) ClientMessage( "[#ea4335]-> Error: [#fbbc05]Type /spawnwep <Wep1> <Wep2> <Wep3> <Wep4> <Wep5> <Wep6>...", player,0,0,0 );
else
{
local weps = split( text, " " ),ID, wepsset = null;
for( local i = 0; i < weps.len(); i++ )
{
( IsNum( weps[ i ] ) ) ? ID = weps[ i ].tointeger() : ID = GetWeaponID( weps[ i ] );
if ( ID >= 33 ) ClientMessage( "[#ea4335]-> Error: [#c0c0c0]Invalid Weapon ID/Name.", player,0,0,0 );
else
{
player.SetWeapon( ID, 99999 );
ClientMessage( "-> [#daff00]Saving " + GetWeaponName( ID ) + " to your spawn.",player,255,0,102);
if (wepsset == null) wepsset = " "+ ID;
else wepsset += (" " + ID);
}
}
if (wepsset) SpawnwepPlayer[ player.ID ] = wepsset;
}
}
else if ( cmd == "spawnwepdel")
{
if ( CheckTableSpawnwep( player ) )
{
QuerySQL( db, "DELETE FROM SpawnWep WHERE Nick='" + player.Name + "' COLLATE NOCASE" );
ClientMessage( "-> Your Spawnwep have been deleted.",player,255,0,102); SpawnwepPlayer[ player.ID ] = null;
}
else ClientMessage( "-> Error: You not have spawnwep.",player,255,0,102);
}
And the end would look like this.
(http://fotos.subefotos.com/4117517e3e9db94c6e5ef5d08aff1722o.png)
(http://fotos.subefotos.com/deb65e962a3cec7992ae24909ce03e40o.png)
(http://fotos.subefotos.com/2aad2c864cec9a086b94bd80b10efbado.png)
(http://fotos.subefotos.com/0455aca5911fba8f20a5c35ab28e2df9o.png)
I tested this script and work :)
Dowload Script: Mediafire (http://www.mediafire.com/download/n4jzzcn3vz5qfcx/Spawnwep+System+-+by+Mack.rar)
Virus Total: Link (https://www.virustotal.com/es/file/ffa6d6b635962ae73619f0493390d4eaf7d86ab8b664780b22c50e86f5a9bd75/analysis/1452911628/)
This topic already posted. Btw great! :)
Quote from: Williams on Jan 16, 2016, 04:17 AMThis topic already posted. Btw great! :)
This is different. :)
Quote from: Mack on Jan 16, 2016, 04:23 AMQuote from: Williams on Jan 16, 2016, 04:17 AMThis topic already posted. Btw great! :)
This is different. :)
Yeah, at-least on 0.4
Oh well, it looks like you're new to this forum. Great work mate!
Well done.
Off:- Which SOftware are u using for editing scripts?? Can u give me Download Link??
Quote from: [DS]Anik on Jan 16, 2016, 10:14 AMOff:- Which SOftware are u using for editing scripts?? Can u give me Download Link??
The software's name is clearly written in one of the images,
Hint: title ;D
Quote from: [DS]Anik on Jan 16, 2016, 10:14 AMOff:- Which SOftware are u using for editing scripts?? Can u give me Download Link??
Subline.
http://www.sublimetext.com/
/me likes very much the presentation of script.
ps: you could still add some more info about how the script works.
Quote from: Mack on Jan 16, 2016, 04:32 PMQuote from: [DS]Anik on Jan 16, 2016, 10:14 AMOff:- Which SOftware are u using for editing scripts?? Can u give me Download Link??
Subline.
http://www.sublimetext.com/
Off:- I use that too, which syntax( language ) you use? Try using 'D'
I can not use it on 04rel006
im getting bug
AN ERROR HAS OCCURED [cannot convert the string]
CALLSTACK
*FUNCTION [GiveSpawnwep()] scripts/main.nut line [124]
*FUNCTION [onPlayerSpawn()] scripts/main.nut line [370]
LOCALS
[ID] ""
[Nweps] 3
[khe] " 26 20"
1
[player] INSTANCE
[this] TABLE
[player] INSTANCE
try changing to
while ( i < (Nweps.tointeger()))
not working. cannt convert to string
why not u share more details, when having errors.
I'm sorry for bumping old topic, but i need some help, I'm getting this error in console and the cmd is not working.
AN ERROR HAS OCCURED [cannot convert the string]
EDIT: FIXED
Quote from: Arshh on Sep 14, 2020, 02:31 PMI'm sorry for bumping old topic, but i need some help, I'm getting this error in console and the cmd is not working.
AN ERROR HAS OCCURED [cannot convert the string]
Hi, would you like to input the error line given below below the error? I suggest you to post not one line and atleast 5 lines(above & down the error line) and make a new topic instead of bumping :)