Prop System

Started by Finch, Apr 10, 2015, 10:40 AM

Previous topic - Next topic

Finch

Hi Guys
Well i have prop system i test it but it give me error on ShareProp command
There is ShareProp Command


else if ( cmd == "shareprop" )
{
  if ( !text ) MessagePlayer( "Use /shareprop  <Nick/ID> <Prop>", player );
    local id = player.ID
if ( !stats[ id ].Logged ) ePrivMessage( "[Error] - You're Not logged in..", player );
else if ( !player.IsSpawned ) ePrivMessage( "[Error] - You haven't spawned yet..", player );
else if ( !text ) ePrivMessage( "[Syntax] - !" + cmd + " <ID> <Nick>", player );
else if ( !IsNum( GetTok( text, " ", 1 ) ) ) ePrivMessage( "[Error] - ID must be Number..", player );
else if ( !PropExists( GetTok( text, " ", 1 ).tointeger() ) ) ePrivMessage( "[Error] - Invalid Prop ID", player );
[color=teal]It always give error here ( q does not exist ) [/color] if ( GetSQLColumnData( q, 3 ) != player.Name ) ePrivMessage( "[Error] - You don't own this Property", player );
else
{
    local plr = GetPlayer( GetTok( text, " ", 2 ) );
if ( !plr ) ePrivMessage( "[Error] - Invalid Nick / ID", player );
else
{
    QuerySQL( sqliteDB, "UPDATE Props SET Shared='" + plr.Name + "' WHERE rowid='" + GetTok( text, " ", 1 ) + "'" );
rPrivMessage( "You shared your Prop:[ " + GetSQLColumnData( q, 0 ) + " ] with: " + plr.Name + ".", player );
rPrivMessage( "Player " + player.Name + " shared Prop ID:[ " + GetTok( text, " ", 1 ) + " ] with you.", plr );
}
}

}

Beztone is a scripter but he is too stupid

.

Could you people stop posting sh!tty code like this where you use all kinds of private functions that other people can't use and a bunch of sqlite queries that have no information attached to them, like a table structure or something, no description, no guarantee that is safe, nothing, absolutely nothing.

So, please, stop posting your code thinking that it would help someone. Any decent scripter can make a 20+ lines of code, function if they need one. Just keep your sh!t to yourself.
.

DizzasTeR

Finch please stop scripting because if you can't write the error line and show it how can you code? Just stop you are wasting your time with ours.

Finch

I have already mention check command there is error posted
Beztone is a scripter but he is too stupid

.

#4
Quote from: Finch on Apr 10, 2015, 02:46 PMI have already mention check command there is error posted

You just don't get it. These things are meant to be part of a larger system. And you're posting just a tiny bit of that system which doesn't make any sense. Oh, I know, why don't we all make a topic for every sh!tty command that we can think about. I'll begin:
else if (cmd == "hello")
{
    SendMessageToFriends(player, player.Name + " said hello!");
}

And another one:
else if (cmd == "suck")
{
    if (IsPlayerStaff(player))
    {
        SendMessageToEnemies(player, player.Name + " said you suck!");
    }
}

I worked so much to create them. I doubt any one of you could make something like that. Try them, and tell me what you think. Also, make sure to credit me somewhere very visible, so people think I'm cool and I can program. And don't worry about the unknown functions, they'll appear, magically, somewhere in your code as well and it'll work somehow.
.

Finch

dont post shitty S.L.C
I also make command
if ( cmd == "slc" )
{
 Message( "Oh Yes SLC Just Sucks." );
}




Function of ShareProp

function IsPropOwnerOrSharer( id, player )
{
       local q = QuerySQL( sqliteDB, "SELECT * FROM Props WHERE rowid='" + id + "'" );
      local owner = GetSQLColumnData( q, 2 ), shared = GetSQLColumnData( q, 3 );
      if ( ( owner == player.Name ) || ( shared == player.Name ) ) return 1;
      else return 0;
   
}

function IsPropShared( id )
{
   local q = QuerySQL( sqliteDB, "SELECT Owner FROM Props WHERE rowid='" + id + "'" );
   local share = GetSQLColumnData( q, 3 );
   if ( share == "None" ) return 0;
   else return 1;
}
function GetPropShare( id )
{
    local get = GetSQLColumnData( QuerySQL( sqliteDB, "SELECT Shared FROM Props WHERE rowid='" + id + "'" ), 0 );
   if ( get ) return get;
   else return 0;
}
Beztone is a scripter but he is too stupid

Thijn

First of all, your IsPropShared is bugged. You select only one column, and then try to get the 3rd. Not gonna happen.

Second, POST THE ERROR. There's an error log for a freaking reason.

.

#7
Crap, I thought this was in the snippet section :-\ Mind tagging your topic next time.

Also, you're so stupid you didn't even realized the error message is giving you the exact details:
GetSQLColumnData( q, 3 )If you look closer you realize there's no "q" :D

And this doesn't belong embedded in the code:
[color=teal]It always give error here ( q does not exist ) [/color]
I'm just curious, and I'm really sorry to ask this because I usually don't do it. But you force me to ask you because I have no explanation at all :-\

So here's my question: Are you a retarded person?

Don't take that as a joke or offence, that's a serious question that I need to know in order to have an idea how to answer next time.
.

Street Killer

Try To Use This...

Quoteelse if ( cmd == "shareprop" )
{
local id = player.ID
if ( !player.IsSpawned ) MessagePlayer( RED+"** >> Error: "+ORANGE+"First Spawned And Then Use It.", player );
else if ( !text ) {
MessagePlayer(ORANGE+"Usage: /" + cmd + " [Prop/ID] [Nick/ID]", player );
return;
}
else if ( NumTok( text, " " ) < 2 ) MessagePlayer(ORANGE+"Usage: /" + cmd + " [Prop/ID] [Nick/ID]", player );
else if ( !IsNum( GetTok( text, " ", 1 ) ) ) MessagePlayer(RED+"** >> Error: "+ORANGE+"Prop/ID Must Be In Number.", player );
else {
local q = QuerySQL(sqliteDB, "SELECT * FROM Props WHERE rowid LIKE '" + GetTok( text, " ", 1 ).tointeger() + "'" );
if ( !PropExists( GetTok( text, " ", 1 ).tointeger() ) ) MessagePlayer(RED+"** >> Error: "+ORANGE+"Invalid Prop/ID.", player );
else if ( GetSQLColumnData( q, 2 ) != player.Name ) MessagePlayer(RED+"** >> Error: "+ORANGE+"You Don't Own This Property.", player );
else {
local plr = GetPlayer( GetTok( text, " ", 2 ) );
if ( !plr ) MessagePlayer(RED+"** >> Error: "+ORANGE+"Invalid Player.", player );
else {
QuerySQL(sqliteDB, "UPDATE Props SET Shared='" + plr.Name + "' WHERE rowid='" + GetTok( text, " ", 1 ) + "'" );
MessagePlayer(YELLOW+"** >> You Shared Your Prop:[ "+GetSQLColumnData( q, 0 )+" ] With:[ "+plr.Name+" ].", player );
MessagePlayer(GREEN+"Player:[ "+player.Name+" ] Shared Prop/ID:[ "+GetTok( text, " ", 1 )+" ] With You.", plr );
}
}
}
}

EK.IceFlake

btw you arent freeing your query
function GetPropShare( id )
{
    local get = GetSQLColumnData( QuerySQL( sqliteDB, "SELECT Shared FROM Props WHERE rowid='" + id + "'" ), 0 );//!!! How will it become freed! It will leak your memory! Beware! !!!
   if ( get ) return get;
   else return 0;
}

Thijn

He's also not checking if the query actually succeeded. If it fails, it will create another error...