Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: [VSS]Shawn on Jun 27, 2015, 08:55 AM

Title: LoadPIckups
Post by: [VSS]Shawn on Jun 27, 2015, 08:55 AM
Hello :D

I am facing one problem i dont know what is error i add many rows like this in db

5890 Cherry Popper 30000000 None None 407 -864.17883 -572.18151 11.10813
80000 Warehouse 40000000 None None 407 -692.734 -1577.16 12.544
30000 Bank 100000000 None None 407 -894.08514 -341.23468 13.47533
1000 Biker Bar 35000000 None None 407 -597.53094 652.93548 11.07121
4000 Pizza Shop 25000000 None None 407 -882.35906 796.40411 11.10740
4500 Junk Yard 45000000 None None 407 -1054.90014 319.43301 11.26303
2500 Kaufman Cabs 65000000 None None 407 -1012.16070 199.37254 11.26526
1900 Print works 55000000 None None 407 -1058.45178 -261.43157 11.44641
2000 Sunshine Autos 70000000 None None 407 -1010.82250 -871.11132 13.05085
2300 Cherry Popper 75000000 None None 407 491.23086 -79.93425 11.48376
1950 Cherry Popper 200000 None None 408 -884.30242 -578.26556 15.05117
3000 Pizza House 200000 None None 408 -908.00854 798.34558 11.41105

and add this function
function LoadPickups()
{
local query = QuerySQL( db, "SELECT Pos FROM Properties" ),splitPos, x, y, z ,cpType;   
if( query )
{
while( GetSQLColumnData( query, 0 ) != null )
{
splitPos = split( GetSQLColumnData( query, 0 ), " " );
x = splitPos[ 1 ];
y = splitPos[ 2 ];
z = splitPos[ 3 ];
cpType = splitPos[ 0 ];
CreatePickup( cpType.tointeger(), Vector( x.tofloat(), y.tofloat(), z.tofloat() ) );
GetSQLNextRow( query );
}
CreatePickup( 380,Vector(-65.0178,-1482.7504,11.4940));
CreatePickup( 380,Vector(362.1243,1061.6443,19.2101));
CreatePickup( 380,Vector(-675.0,1204.6,11.0));
CreatePickup( 508,Vector(367.127,-473.099,13.8172));
CreatePickup( 380,Vector(201.7,-471.1,11.1));

}
FreeSQLQuery( query );
}

and add this in OnScriptLoad

NewTimer( "LoadPickups", 5000, 1 );
but when i rob any place it does not give correct name like if i rob Cherry Popper it say u rob Pizza shop or something
What is Problem?
Title: Re: LoadPIckups
Post by: Thijn on Jun 27, 2015, 09:27 AM
Post your rob command then.
Title: Re: LoadPIckups
Post by: [VSS]Shawn on Jun 27, 2015, 09:29 AM
Lol Dude RobComand Just Rob Player But onPickupPickup there is function of rob
Title: Re: LoadPIckups
Post by: DizzasTeR on Jun 27, 2015, 09:36 AM
Quote from: [VSS]Shawn on Jun 27, 2015, 09:29 AMLol Dude RobComand Just Rob Player But onPickupPickup there is function of rob

Whats so funny? then just post that 'rob' function.
Title: Re: LoadPIckups
Post by: [VSS]Shawn on Jun 27, 2015, 09:45 AM
K
This is

function onPickupPickedUp( player, pickup )
{
if ( binfo[player.ID].registered==true )
{
if ( binfo[player.ID].logged==true )
{
if (pickup.Model == 408)
{
if(pickup.ID==18)
{
if(GetRobskills(player)>0)
{
    if (GetJob(player)==1)
{
if(pinfo[player.ID].C4==1)
{
local t=pinfo[player.ID].btime+600;
print("t="+t+" gettime="+GetTime());
if(t<GetTime().tointeger())
{
pinfo[player.ID].btime=GetTime().tointeger();
local q = QuerySQL( db, "SELECT Name, Robcash FROM Properties WHERE rowid LIKE '" + pickup.ID + "'");
pinfo[player.ID].C4=0;
ClientMessage( "Starting robbery at [ " + GetSQLColumnData( q, 0 ) + " ]", player,255,255,0);
ClientMessageToAll( "* " + player.Name + " is robbing the " + GetSQLColumnData( q, 0 ) + ".", 255, 255, 0 );
EchoMessage( ICOL_BOLD+ICOL_CYAN + "> " + player.Name + " is robbing  the " + GetSQLColumnData(q,0) + "." );
player.IsFrozen = true;
pinfo[player.ID].robbing=1;
pinfo[player.ID].Robbedcash=GetSQLColumnData( q, 1 ).tointeger();
NewTimer( "LittleHavana", 10100 , 1, player.ID,GetSQLColumnData( q, 1 ).tointeger(),6);
NewTimer( "Count1", 1000, 1, 10, player.ID );
NewTimer( "Count1", 2000, 1, 9, player.ID );
NewTimer( "Count1", 3000, 1, 8, player.ID );
NewTimer( "Count1", 4000, 1, 7, player.ID );
NewTimer( "Count1", 5000, 1, 6, player.ID );
NewTimer( "Count1", 6000, 1, 5, player.ID );
NewTimer( "Count1", 7000, 1, 4, player.ID );
NewTimer( "Count1", 8000, 1, 3, player.ID );
NewTimer( "Count1", 9000, 1, 2, player.ID );
NewTimer( "Count1", 10000, 1, 1, player.ID );
player.WantedLevel = 30;
pinfo[ player.ID ].Robskills ++;
SetRobskills(player,GetRobskills(player)+22 );
SetWantedLevel(player,GetWantedLevel(player)+1);
pinfo[ player.ID ].WantedLevel ++;
player.Score = Robskills(player);
messagez.push({name = player.Name,
team = player.Team,
       reason= GetSQLColumnData( q, 0 ),
       type = 8
});
player.Score=player.Score+2;
if(messagez.len() > 20) messagez.remove(0);
}
else MessagePlayer( "Error - You can only rob the bank once in 10 mins!",player);
}
else MessagePlayer( "Error - You need a bomb to break the locker, Go to the ammunation shop in downtown!",player);
}
else MessagePlayer( "Error - You need to have minimum 500 robskills in order to rob bank!",player);
}
else MessagePlayer( "Error - You need to be robber",player);
}
else
{
local Robskill = random(1,4);
switch ( Robskill )
{
case 1:
{
                    SetWantedLevel(player,GetWantedLevel(player)+1);
pickup.RespawnTime = 60000;
                    ClientMessage( "Robbery failed and wanted level increased. The police is on the way.",player,255,0,0);
            }
break;
default:
{
if( GetJob(player) == 2 ) MessagePlayer( "Error - You must be Robber.",player);
else
{
local q = QuerySQL( db, "SELECT Name, Robcash FROM Properties WHERE rowid LIKE '" + pickup.ID + "'");
ClientMessage( "Starting robbery at " + GetSQLColumnData( q, 0 ) + ".", player,255,255,0);
ClientMessageToAll( "* " + player.Name + " is robbing the " + GetSQLColumnData( q, 0 ) + ".", 255, 255, 0 );
                                player.IsFrozen = true;
pinfo[player.ID].robbing=1;
NewTimer( "LittleHavana", 10100 , 1, player.ID,GetSQLColumnData( q, 1 ).tointeger(),1);
NewTimer( "Count1", 1000, 1, 10, player.ID );
NewTimer( "Count1", 2000, 1, 9, player.ID );
NewTimer( "Count1", 3000, 1, 8, player.ID );
NewTimer( "Count1", 4000, 1, 7, player.ID );
NewTimer( "Count1", 5000, 1, 6, player.ID );
NewTimer( "Count1", 6000, 1, 5, player.ID );
NewTimer( "Count1", 7000, 1, 4, player.ID );
NewTimer( "Count1", 8000, 1, 3, player.ID );
NewTimer( "Count1", 9000, 1, 2, player.ID );
NewTimer( "Count1", 10000, 1, 1, player.ID );
if ( robscash == 1)
                        {
  local reward = Random(4000,400000);
                                          local happy=   RandomCash[player.ID]*reward;
  ClientMessageToAll( "> " +player.Name+ "Has Won The Happy One Minute And Got "+happy+".",255,255,0);
    EchoMessage( ICOL_BOLD+ ICOL_BLUE  + ">  " +player.Name+ " Has Won The Happy One Minute And Got "+happy+"." );
                SetCash( player, GetCash( player )+ happy.tointeger());
                                                                                erc();
                                                                                  }
SetRobskills(player,GetRobskills(player)+5);
pinfo[ player.ID ].WantedLevel ++;
QuerySQL( db, "UPDATE Accounts SET WantedLevel= '" + pinfo[ player.ID ].WantedLevel + "' WHERE Name='" + player.Name.tolower() + "'" );
SetWantedLevel(player,GetWantedLevel(player)+10);
pickup.RespawnTime = 60000;
player.Score++;
}
}
break;
}
}
}
}
Title: Re: LoadPIckups
Post by: Danix on Jun 27, 2015, 10:48 AM
I thought there is no support for leaked scripts on the VC:MP forum.
Title: Re: LoadPIckups
Post by: [VSS]Shawn on Jun 27, 2015, 11:31 AM
i am just using this function not whole script
Title: Re: LoadPIckups
Post by: DeViL_JiN on Jun 27, 2015, 01:05 PM
Shawn I already told you stop using others script.
You are wasting your time, because the time and effort you are spending to convert vccnr you can create a decent script and can also learn scripting, and believe me we all are here to help you as long as your questions makes sense.
Title: Re: LoadPIckups
Post by: [VSS]Shawn on Jun 27, 2015, 03:26 PM
Devil i told you many time i am not modifying script i a making new from start i wanna add rob system so i get it from vccnr and then this error come that if i rob Malibu club it say u rob Bank
I just want to debug it
Anyone can help?
Title: Re: LoadPIckups
Post by: Awesome_Boy on Jun 27, 2015, 03:33 PM
Quote from: [VSS]Shawn on Jun 27, 2015, 03:26 PMDevil i told you many time i am not modifying script i a making new from start i wanna add rob system so i get it from vccnr and then this error come that if i rob Malibu club it say u rob Bank
I just want to debug it
Anyone can help?
i have given u this at fb because we can not change it lol dont  waste u r time.
Title: Re: LoadPIckups
Post by: [VSS]Shawn on Jun 27, 2015, 04:40 PM
ok it does not work you say then how crast properties work?
Title: Re: LoadPIckups
Post by: DizzasTeR on Jun 27, 2015, 05:43 PM
Quote from: [VSS]Shawn on Jun 27, 2015, 04:40 PMok it does not work you say then how crast properties work?

Because he made it himself.
Title: Re: LoadPIckups
Post by: [VSS]Shawn on Jun 27, 2015, 06:03 PM
dude is this not possible to debug it?
Title: Re: LoadPIckups
Post by: Thijn on Jun 27, 2015, 06:32 PM
Quote from: [VSS]Shawn on Jun 27, 2015, 06:03 PMdude is this not possible to debug it?
If you actually knew how to script you would've already fixed it by now.

Add some print statements in your onPickupPickedUp to see what each variable contains, and debug from there.
Title: Re: LoadPIckups
Post by: . on Jun 27, 2015, 06:38 PM
@Thijn What is print? Where do I use it? (this is a quick preview of the next post)
Title: Re: LoadPIckups
Post by: Murdock on Jun 27, 2015, 08:45 PM
Quote from: [VSS]Shawn on Jun 27, 2015, 09:45 AMif ( binfo[player.ID].registered==true )
if ( binfo[player.ID].logged==true )
if (pickup.Model == 408)
if(pickup.ID==18)
if(GetRobskills(player)>0)
    if (GetJob(player)==1)
if(pinfo[player.ID].C4==1)

NewTimer( "Count1", 1000, 1, 10, player.ID );
NewTimer( "Count1", 2000, 1, 9, player.ID );
NewTimer( "Count1", 3000, 1, 8, player.ID );
NewTimer( "Count1", 4000, 1, 7, player.ID );
NewTimer( "Count1", 5000, 1, 6, player.ID );
NewTimer( "Count1", 6000, 1, 5, player.ID );
NewTimer( "Count1", 7000, 1, 4, player.ID );
NewTimer( "Count1", 8000, 1, 3, player.ID );
NewTimer( "Count1", 9000, 1, 2, player.ID );
NewTimer( "Count1", 10000, 1, 1, player.ID );
}

Why did you have to do this to my eyes?
Title: Re: LoadPIckups
Post by: Stormeus on Jun 27, 2015, 10:37 PM
Did you really just give us a 100+ line function and ask us to solve it while giving us almost no relevant information?

Think logically. Your pickup ID obviously does not match the property ID. You could probably print the ID from the pickup and figure it out from there.

Also,
function onPickupPickedUp( player, pickup )
{
 if ( binfo[player.ID].registered==true )
  {
   if ( binfo[player.ID].logged==true )
   {
    if (pickup.Model == 408)
    {
      if(pickup.ID==18)
      {
       if(GetRobskills(player)>0)
       {
           if (GetJob(player)==1)
        {
        if(pinfo[player.ID].C4==1)
        {

What the fuck?
Title: Re: LoadPIckups
Post by: DizzasTeR on Jun 27, 2015, 10:43 PM
@Stormeus, "if", you get what I mean huh?
Title: Re: LoadPIckups
Post by: [VSS]Shawn on Jun 28, 2015, 08:15 AM
I cant understand what u r saying stormeus
Title: Re: LoadPIckups
Post by: Thijn on Jun 28, 2015, 08:54 AM
Quote from: [VSS]Shawn on Jun 28, 2015, 08:15 AMI cant understand what u r saying stormeus
Then for the love of god stop scripting. Please, just play 0.4...
Title: Re: LoadPIckups
Post by: [VSS]Shawn on Jun 28, 2015, 10:13 AM
Just help me in here i will not post again
Title: Re: LoadPIckups
Post by: Sebastian on Jun 28, 2015, 11:47 AM
Quote from: [VSS]Shawn on Jun 28, 2015, 10:13 AMJust help me in here i will not post again

"until I create a new account."
Title: Re: LoadPIckups
Post by: [VSS]Shawn on Jun 28, 2015, 02:46 PM
i dont wanna create account just help here
Title: Re: LoadPIckups
Post by: Thijn on Jun 28, 2015, 02:50 PM
Quote from: [VSS]Shawn on Jun 28, 2015, 02:46 PMi dont wanna create account just help here
We tried the best we can, you just have to admit you're too stupid to script.

Locked.