MySpawnWep Command

Started by Finch, Mar 12, 2015, 04:46 PM

Previous topic - Next topic

Finch

Hello Can Any oNE Can Give me exmaple how to make Myspawnwep command?
Beztone is a scripter but he is too stupid

Thijn


Finch

else if ( cmd == "myspawnwep" )
  {
ePrivMessage( player.Name + "'s Spawnwep:[ " + GetSpawnwep(player) + " ]", player );
  }






Function


function GetSpawnwep( player )
{
QuerySQL(db, "SELECT Name FROM Spawnwep WHERE rowid LIKE '" + text + "'" );
}
Beztone is a scripter but he is too stupid

Kratos_

#3
Post the query creating the table . You're selecting just player name in function GetSpawnwep .
In the middle of chaos , lies opportunity.

Finch

function tablespawn()
       {
       QuerySQL( db, "CREATE TABLE IF NOT EXISTS Spawnwep ( Name TEXT, Wep NUMERIC, Wep2 NUMERIC, Wep3 NUMERIC, Wep4 NUMERIC )" );
   }
Beztone is a scripter but he is too stupid

Finch

Beztone is a scripter but he is too stupid

BigcaT_

Do not add more than 1 blanks for weps. Just use GetTok( if you have) , like this:

else if ( cmd == "spawnwep" )
{
local q = QuerySQL( MainDatabase, "SELECT * FROM Account WHERE Name='" + player.Name.tolower() + "'" );
local wp = GetSQLColumnData( q, 0 );
if ( !text ) QuerySQL( MainDatabase, "UPDATE Account SET Wep='' WHERE Name='" + player.Name.tolower() + "'" );
else
{
RM( "You Bought "+text+" For Your Spawn.", player );
player.Cash -= 10000;
local i = 0, wep = "";
for ( i = 1; i <= NumTok( text, " " ); i++ )
{
local wep1 = GetWeaponID( text );
wep = GetTok( text, " ", i );
}
local wep = GetTok(text, " ", 1, NumTok(text, " "));
QuerySQL( MainDatabase, "UPDATE Account SET Wep='" + wep + "' WHERE Name='" + player.Name.tolower() + "'")
}
}

and create just 1 blank for weps ,
weps:
py stu roc

Finch

i dont want spawnwep command i want help in myspawnwep
Beztone is a scripter but he is too stupid

BigcaT_

//try this
function GetSpawnwep( player )
{
QuerySQL(db, "SELECT Name FROM Spawnwep WHERE rowid LIKE '" + text + "'" );
local a = GetSQLColumnData( q, 1 ),b=GetSQLColumnData( q, 2 ),c=GetSQLColumnData( q, 3 ),d=GetSQLColumnData( q, 4 );

return a+b+c+d;
}
//Untested

Thijn

You should've tested it because it's wrong.
1) text is undefined
2) a+b+c+d will just add the weapon IDs with eachother. You will never get the real weaponsIDs that way. You should return an array.

Finch

so what i have to do thijn?
Beztone is a scripter but he is too stupid