spawnwep prob

Started by kokia, Jul 23, 2015, 08:39 AM

Previous topic - Next topic

kokia

hello guys i have spawnwep problem in my script
//*functionspawnwep
function savespawnwep( player, weps )
{
    local we = split(weps," " );
local z;
    for ( local i = 0; i < we.len(); i ++ )
{
    local weid = we[ i ];
    if ( !IsNum( weid ) ) weid = GetWeaponID( we[ i ] );
    if ( !IsValidWeap( weid.tointeger() ) ) weid = 255;

if ( !z ) z = weid;
else z = z +" "+ weid;
}
QuerySQL(db,"DELETE FROM Spawnwep WHERE Name='"+ player.Name +"'");
QuerySQL( db, "INSERT INTO Spawnwep ( Name, Weapons ) VALUES ( '" + player.Name + "', '" + z + "' )" );
    PrivMessage("Spawnwep loaded.",player);
}
function IsValidWeap( id )
{
    if ( id >= 33 && id < 100|| id >= 102) return false;
    switch( id )
    {
    case 13:
case 14:
return false;
break;

default:
return true;
break;
    }
}
function getspawnwep( player )
{
    local q = QuerySQL(db,"SELECT * FROM Spawnwep WHERE Name='"+ player.Name +"'");
local human = GetSQLColumnData(q, 1);
FreeSQLQuery( q );
if ( human )
{    
    local human2 = split(human," ");
        for ( local i = 0; i < human2.len(); i ++ )
    {
            if ( human2[i] != "255" ) player.SetWeapon( human2[i].tointeger(), 9999 );
    }
    PrivMessage( player, "You've received your spawn weapons.");
    }
}
function CreateTables()
{
    QuerySQL( db, "CREATE TABLE IF NOT EXISTS Spawnwep ( Name TEXT, Wep NUMERIC, Wep2 NUMERIC, Wep3 NUMERIC, Wep4 NUMERIC, Wep5 NUMERIC, Wep6 NUMERIC, Wep7 NUMERIC, Wep8 NUMERIC )" );
}
function onPlayerSpawn( player )
{
getspawnwep( player );
}
cmds
else if ( cmd == "spawnwep" )
{
if ( status[ player.ID ].IsReg == false ) PrivMessage( "You must be a registered user.", player );
else if ( status[ player.ID ].IsLogged == false ) PrivMessage "Please login to use this cmd.", player );
    else if ( !text ) PrivMessage( "Syntax, /spawnwep <weapon name/del>", player );
else if ( text == "del" )
{
            QuerySQL( db, "DELETE FROM Spawnwep WHERE Name='" + player.Name + "'" );
            Client_Rojo( "You have deleted all the weapons from your spawnwep list.", player );
}
else if ( GetTok( text, " ", 7 ) )  PrivMessage( "The max slot for spawnwep is only 6.", player );
else savespawnwep( player, text );
}

Ksna

You know you have posted in Snippets ,  better use spawnwep without database i have already released it in snippets

KAKAN

Use this cmd:-
else if ( cmd == "spawnwep" )
{
if ( status[ player.ID ].IsReg == false ) PrivMessage( player,"You must be a registered user." );
else if ( status[ player.ID ].IsLogged == false ) PrivMessage (player, "Please login to use this cmd." );
    else if ( !text ) PrivMessage( player, "Syntax, /spawnwep <weapon name/del>" );
else if ( text == "del" )
{
            QuerySQL( db, "DELETE FROM Spawnwep WHERE Name='" + player.Name + "'" );
             Privmessage( player, "You have deleted all the weapons from your spawnwep list." );
}
else if ( GetTok( text, " ", 7 ) )  PrivMessage( player,"The max slot for spawnwep is only 6." );
else savespawnwep( player, text );
}

and this functions:-
//*functionspawnwep
function savespawnwep( player, weps )
{
    local we = split(weps," " );
local z;
    for ( local i = 0; i < we.len(); i ++ )
{
    local weid = we[ i ];
    if ( !IsNum( weid ) ) weid = GetWeaponID( we[ i ] );
    if ( !IsValidWeap( weid.tointeger() ) ) weid = 255;
if ( !z ) z = weid;
else z = z +" "+ weid;
}
QuerySQL(db,"DELETE FROM Spawnwep WHERE Name='"+ player.Name +"'");
QuerySQL( db, "INSERT INTO Spawnwep ( Name, Weapons ) VALUES ( '" + player.Name + "', '" + z + "' )" );
    PrivMessage(player,"Spawnwep loaded.");
}
function IsValidWeap( id )
{
    if ( id >= 33 && id < 100|| id >= 102) return false;
    switch( id )
    {
    case 13:
case 14:
return false;
break;
default:
return true;
break;
    }
}
function getspawnwep( player )
{
    local q = QuerySQL(db,"SELECT * FROM Spawnwep WHERE Name='"+ player.Name +"'");
local human = GetSQLColumnData(q, 1);
FreeSQLQuery( q );
if ( human )
{   
    local human2 = split(human," ");
        for ( local i = 0; i < human2.len(); i ++ )
    {
            if ( human2[i] != "255" ) player.SetWeapon( human2[i].tointeger(), 9999 );
    }
    PrivMessage( player, "You've received your spawn weapons.");
    }
}
function CreateTables()
{
    QuerySQL( db, "CREATE TABLE IF NOT EXISTS Spawnwep ( Name TEXT, Wep NUMERIC, Wep2 NUMERIC, Wep3 NUMERIC, Wep4 NUMERIC, Wep5 NUMERIC, Wep6 NUMERIC, Wep7 NUMERIC, Wep8 NUMERIC )" );
}
function onPlayerSpawn( player )
{
getspawnwep( player );
}

Btw it is a wrong place for posting this
oh no

kokia

Quote from: Ksna on Jul 23, 2015, 08:42 AMYou know you have posted in Snippets ,  better use spawnwep without database i have already released it in snippets
Quote from: KAKAN on Jul 23, 2015, 08:56 AMUse this cmd:-
else if ( cmd == "spawnwep" )
{
if ( status[ player.ID ].IsReg == false ) PrivMessage( player,"You must be a registered user." );
else if ( status[ player.ID ].IsLogged == false ) PrivMessage (player, "Please login to use this cmd." );
    else if ( !text ) PrivMessage( player, "Syntax, /spawnwep <weapon name/del>" );
else if ( text == "del" )
{
            QuerySQL( db, "DELETE FROM Spawnwep WHERE Name='" + player.Name + "'" );
             Privmessage( player, "You have deleted all the weapons from your spawnwep list." );
}
else if ( GetTok( text, " ", 7 ) )  PrivMessage( player,"The max slot for spawnwep is only 6." );
else savespawnwep( player, text );
}

and this functions:-
//*functionspawnwep
function savespawnwep( player, weps )
{
    local we = split(weps," " );
local z;
    for ( local i = 0; i < we.len(); i ++ )
{
    local weid = we[ i ];
    if ( !IsNum( weid ) ) weid = GetWeaponID( we[ i ] );
    if ( !IsValidWeap( weid.tointeger() ) ) weid = 255;
if ( !z ) z = weid;
else z = z +" "+ weid;
}
QuerySQL(db,"DELETE FROM Spawnwep WHERE Name='"+ player.Name +"'");
QuerySQL( db, "INSERT INTO Spawnwep ( Name, Weapons ) VALUES ( '" + player.Name + "', '" + z + "' )" );
    PrivMessage(player,"Spawnwep loaded.");
}
function IsValidWeap( id )
{
    if ( id >= 33 && id < 100|| id >= 102) return false;
    switch( id )
    {
    case 13:
case 14:
return false;
break;
default:
return true;
break;
    }
}
function getspawnwep( player )
{
    local q = QuerySQL(db,"SELECT * FROM Spawnwep WHERE Name='"+ player.Name +"'");
local human = GetSQLColumnData(q, 1);
FreeSQLQuery( q );
if ( human )
{   
    local human2 = split(human," ");
        for ( local i = 0; i < human2.len(); i ++ )
    {
            if ( human2[i] != "255" ) player.SetWeapon( human2[i].tointeger(), 9999 );
    }
    PrivMessage( player, "You've received your spawn weapons.");
    }
}
function CreateTables()
{
    QuerySQL( db, "CREATE TABLE IF NOT EXISTS Spawnwep ( Name TEXT, Wep NUMERIC, Wep2 NUMERIC, Wep3 NUMERIC, Wep4 NUMERIC, Wep5 NUMERIC, Wep6 NUMERIC, Wep7 NUMERIC, Wep8 NUMERIC )" );
}
function onPlayerSpawn( player )
{
getspawnwep( player );
}

Btw it is a wrong place for posting this

Quote from: KAKAN on Jul 23, 2015, 08:56 AMUse this cmd:-
else if ( cmd == "spawnwep" )
{
if ( status[ player.ID ].IsReg == false ) PrivMessage( player,"You must be a registered user." );
else if ( status[ player.ID ].IsLogged == false ) PrivMessage (player, "Please login to use this cmd." );
    else if ( !text ) PrivMessage( player, "Syntax, /spawnwep <weapon name/del>" );
else if ( text == "del" )
{
            QuerySQL( db, "DELETE FROM Spawnwep WHERE Name='" + player.Name + "'" );
             Privmessage( player, "You have deleted all the weapons from your spawnwep list." );
}
else if ( GetTok( text, " ", 7 ) )  PrivMessage( player,"The max slot for spawnwep is only 6." );
else savespawnwep( player, text );
}

and this functions:-
//*functionspawnwep
function savespawnwep( player, weps )
{
    local we = split(weps," " );
local z;
    for ( local i = 0; i < we.len(); i ++ )
{
    local weid = we[ i ];
    if ( !IsNum( weid ) ) weid = GetWeaponID( we[ i ] );
    if ( !IsValidWeap( weid.tointeger() ) ) weid = 255;
if ( !z ) z = weid;
else z = z +" "+ weid;
}
QuerySQL(db,"DELETE FROM Spawnwep WHERE Name='"+ player.Name +"'");
QuerySQL( db, "INSERT INTO Spawnwep ( Name, Weapons ) VALUES ( '" + player.Name + "', '" + z + "' )" );
    PrivMessage(player,"Spawnwep loaded.");
}
function IsValidWeap( id )
{
    if ( id >= 33 && id < 100|| id >= 102) return false;
    switch( id )
    {
    case 13:
case 14:
return false;
break;
default:
return true;
break;
    }
}
function getspawnwep( player )
{
    local q = QuerySQL(db,"SELECT * FROM Spawnwep WHERE Name='"+ player.Name +"'");
local human = GetSQLColumnData(q, 1);
FreeSQLQuery( q );
if ( human )
{   
    local human2 = split(human," ");
        for ( local i = 0; i < human2.len(); i ++ )
    {
            if ( human2[i] != "255" ) player.SetWeapon( human2[i].tointeger(), 9999 );
    }
    PrivMessage( player, "You've received your spawn weapons.");
    }
}
function CreateTables()
{
    QuerySQL( db, "CREATE TABLE IF NOT EXISTS Spawnwep ( Name TEXT, Wep NUMERIC, Wep2 NUMERIC, Wep3 NUMERIC, Wep4 NUMERIC, Wep5 NUMERIC, Wep6 NUMERIC, Wep7 NUMERIC, Wep8 NUMERIC )" );
}
function onPlayerSpawn( player )
{
getspawnwep( player );
}

Btw it is a wrong place for posting this

both not work for me! and no error!

KAKAN

I have a spawnwep system but its only for 4 weps
oh no

kokia


KAKAN

@kokia see ur PM, I sended the script to u
oh no