SA-MP Forums Archive
Car dealership system - Need help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Car dealership system - Need help (/showthread.php?tid=398847)



Car dealership system - Need help - tsonn1 - 11.12.2012

Hi!
I need a little help with my car dealership system.
If a player buys a car, I want t he car to spawn, not only write it to mysql, but to make the car spawn, I have to get it to select only the car, the player buyed and spawn that one, but I don't know, how to do it.

The code:
pawn Код:
CMD:sultan(playerid, params[])
{
    new string[555], omanikunimi[MAX_PLAYER_NAME];
    if(PlayerInfo[playerid][AutoV6ti] == 255)
    {
        GetPlayerName(playerid, omanikunimi, sizeof(omanikunimi));
        format(string, 555, "INSERT INTO `autod` (autoid, myygis, omanik, v2rv1, v2rv2, pargitudX, pargitudY, pargitudZ, parkimisangle, model, poesmyygis) VALUES ('5', '0', '%s', '1', '1', '-785.3877', '2753.9294', '45.2800', '235.9695', '411', '0')", omanikunimi);
        mysql_query(string);
    }
    else
    {
        SendClientMessage(playerid, punane, "U've already got a car!");
    }
    return 1;
}

((Translated frome Estonian ))


Re: Car dealership system - Need help - DaRk_RaiN - 11.12.2012

pawn Код:
CMD:sultan(playerid, params[])
{
    new string[555], omanikunimi[MAX_PLAYER_NAME],Float:x, Float:y, Float:z;
    if(PlayerInfo[playerid][AutoV6ti] == 255)
    {
        GetPlayerName(playerid, omanikunimi, sizeof(omanikunimi));
        format(string, 555, "INSERT INTO `autod` (autoid, myygis, omanik, v2rv1, v2rv2, pargitudX, pargitudY, pargitudZ, parkimisangle, model, poesmyygis) VALUES ('5', '0', '%s', '1', '1', '-785.3877', '2753.9294', '45.2800', '235.9695', '411', '0')", omanikunimi);
        mysql_query(string);
        GetPlayerPos(playerid, x, y, z);
        CreateVehicle(560,x, y, z, 0, 1, 1, -1);
    }
    else
    {
        SendClientMessage(playerid, punane, "U've already got a car!");
    }
    return 1;
}



Re: Car dealership system - Need help - tsonn1 - 11.12.2012

Aam... The car has to be created with the MySQL info.

autoid - carid
myygis- on sale
omanik - owner
v2rv1 - color1
v2rv2 - color2
pargitudXYZ - parkedXYZ (It should spawn at the parking position)
parkimisangle - parkangle (The angle, it should spawn with)
model - model
poesmyygys - carshopsale


Re: Car dealership system - Need help - tsonn1 - 12.12.2012

Anyone?


Re: Car dealership system - Need help - tsonn1 - 13.12.2012

Bump1