Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: [VSS]Shawn on Jun 26, 2015, 03:41 PM

Title: WantedLevel
Post by: [VSS]Shawn on Jun 26, 2015, 03:41 PM
Hello Friends i am making Roleplay server but i am facing problem I have WantedLevel Row in Table of Accounts i add this onPickupPickup
pinfo[ player.ID ].WantedLevel ++;
QuerySQL( db, "UPDATE Accounts SET WantedLevel= '" + pinfo[ player.ID ].WantedLevel + "' WHERE Name='" + player.Name.tolower() + "'" );
SetWantedLevel(player,GetWantedLevel(player)+10);
But when i rob store it give me robskills but not give me wantedlevel
What is Problem?
Title: Re: WantedLevel
Post by: Thijn on Jun 26, 2015, 04:07 PM
The correct syntax is player.WantedLevel = int
Title: Re: WantedLevel
Post by: [VSS]Shawn on Jun 26, 2015, 04:43 PM
I know Thijn but i made Row for it in Accounts and this is My GetWantedLevel and SetWantedLevel Function


function SetWantedLevel( player, amount )
{
      QuerySQL(db, "UPDATE WantedLevel SET WantedLevel='" +  amount.tointeger() + "' WHERE Name='" + player.Name + "'");   
}


function GetWantedLevel( player )
{
   local want =  GetSQLColumnData( QuerySQL( db, "SELECT WantedLevel FROM Accounts WHERE Name='" + player.Name+"'" ), 0 );
   if ( want ) return want.tointeger();
   else return 0;
}
Title: Re: WantedLevel
Post by: Stormeus on Jun 26, 2015, 04:47 PM
So is the problem that you don't get wanted stars or that the wanted level doesn't save?
Title: Re: WantedLevel
Post by: [VSS]Shawn on Jun 26, 2015, 04:51 PM
No i am not talking about wanted stars i am saying as u my pickuppickup there is Update Accounts and setwantedlevel + 1 but db show there is 0 wanted level
Title: Re: WantedLevel
Post by: EK.IceFlake on Jun 26, 2015, 05:16 PM
Quote from: [VSS]Shawn on Jun 26, 2015, 04:43 PMI know Thijn but i made Row for it in Accounts and this is My GetWantedLevel and SetWantedLevel Function


function SetWantedLevel( player, amount )
{
      QuerySQL(db, "UPDATE WantedLevel SET WantedLevel='" +  amount.tointeger() + "' WHERE Name='" + player.Name + "'");   
}


function GetWantedLevel( player )
{
   local want =  GetSQLColumnData( QuerySQL( db, "SELECT WantedLevel FROM Accounts WHERE Name='" + player.Name+"'" ), 0 );
   if ( want ) return want.tointeger();
   else return 0;
}
1. Why do you convert it to an integer when it will be converted back to a string anyways?
2. Which is the query you make table Accounts
Title: Re: WantedLevel
Post by: [VSS]Shawn on Jun 26, 2015, 05:19 PM
its db
Title: Re: WantedLevel
Post by: [VSS]Shawn on Jun 26, 2015, 05:22 PM
Thanks I Found Problem I Set Wanted Level in Wnated Level Table
Problem Solved