LoadPIckups

Started by [VSS]Shawn, Jun 27, 2015, 08:55 AM

Previous topic - Next topic

[VSS]Shawn

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?

Thijn

Post your rob command then.

[VSS]Shawn

Lol Dude RobComand Just Rob Player But onPickupPickup there is function of rob

DizzasTeR

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.

[VSS]Shawn

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;
}
}
}
}

Danix

I thought there is no support for leaked scripts on the VC:MP forum.

[VSS]Shawn

i am just using this function not whole script

DeViL_JiN

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.

[VSS]Shawn

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?

Awesome_Boy

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.

[VSS]Shawn

ok it does not work you say then how crast properties work?

DizzasTeR

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.

[VSS]Shawn

dude is this not possible to debug it?

Thijn

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.

.

@Thijn What is print? Where do I use it? (this is a quick preview of the next post)
.