SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 04/12/2019, 11:14 AM   #1
Kevinas100
Little Clucker
 
Join Date: Oct 2015
Posts: 36
Reputation: 7
Default not deleting car when leave server

This is on player disconnect

PHP Code:
    if(pDB[playerid][turiMasina])
    {
        
DestroyVehicle(pDB[playerid][masina]);
    } 
PHP Code:
    if(dialogid == DIALOG_PirktiHuntley)
    {
        if(
response)
        {
            if(
GetPlayerMoney(playerid) < 25000)
            {
                
SendClientMessage(playerid, -1"Jums neužtenka pinigų");
                
RemovePlayerFromVehicle(playerid);
                new 
vehicleid GetPlayerVehicleID(playerid);
                
SetVehicleToRespawn(vehicleid);
            }
            else
            {
                
GivePlayerMoney(playerid, -25000);
                new 
vehicleid GetPlayerVehicleID(playerid);
                
RemovePlayerFromVehicle(playerid);
                
SetVehicleToRespawn(vehicleid);
                
pDB[playerid][turiMasina] = true;
                new 
query[255], vardas[255];
                new 
masinosid 579;
                new 
stringas[255];
                
GetPlayerName(playeridvardassizeof(vardas));
                
format(stringassizeof(stringas), "%s"vardas);
                
format(querysizeof(query), "INSERT INTO `vehicles` (model, Savininkas, kuras, rida) VALUES (579, '%s', '%.1f', '%.1f')"stringas50.0,0.0);
                
mysql_query(DBHandlequery);
                
pDB[playerid][masina] = CreateVehicle(masinosid,-2054.4338,465.5025,35.1719,255.2596, -1,-1,-1);
                
mDB[vehicleid][Savininkas] = stringas;
                
mDB[vehicleid][ModelID] = masinosid;
                
mDB[vehicleid][kuras] = 50.0;
                
mDB[vehicleid][rida] = 0.0;
                
mDB[vehicleid][posX] = -2054.4338;
                
mDB[vehicleid][posY] = 465.5025;
                
mDB[vehicleid][posZ] = 35.1719;
                
mDB[vehicleid][posA] = 255.2596;
                
format(querysizeof(query), "SELECT `uid` FROM `vehicles` WHERE `Savininkas` = '%s'"stringas);
                
mysql_tquery(DBHandlequery"SetVehicleUID""i"vehicleid); 
this is where it defines pDB[playerid][masina]
Kevinas100 is offline   Reply With Quote
Old 04/12/2019, 11:33 AM   #2
CXdur
Big Clucker
 
CXdur's Avatar
 
Join Date: Jun 2014
Location: Norway
Posts: 57
Reputation: 6
Default Re: not deleting car when leave server

Have you tried printing the pDb[playerid][masina] value before destroying the vehicle? To make sure that it is called and that the vehicle ID is correct?
CXdur is offline   Reply With Quote
Old 04/12/2019, 11:45 AM   #3
Kevinas100
Little Clucker
 
Join Date: Oct 2015
Posts: 36
Reputation: 7
Default Re: not deleting car when leave server

Quote:
Originally Posted by CXdur View Post
Have you tried printing the pDb[playerid][masina] value before destroying the vehicle? To make sure that it is called and that the vehicle ID is correct?
Just tried it, turns out it wasn't calling the if(pDB[playerid][turiMasina]), Thank you
Kevinas100 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
When player leave your server. ChristianIvann09 Scripting Help 4 19/03/2014 11:02 AM
[FilterScript] Join/Leave Server radiobizza Filterscripts 23 09/03/2013 07:31 PM
deleting weapons when leave area. esttalk Help Archive 4 27/11/2009 08:00 PM
How to leave message in the server? need help. Konrads Help Archive 6 11/04/2009 02:06 PM


All times are GMT. The time now is 11:29 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.