SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 14/03/2012, 04:19 AM   #1
Tanush123
High-roller
 
Tanush123's Avatar
 
Join Date: Aug 2011
Posts: 1,022
Reputation: 65
Default Dealership

Well it updates perfectly into mysql but for some reason the vehicle will not create
pawn Code:
CMD:createcar(playerid,params[])
{
    new carid = GetCarid();
    new modelid = GetVehicleModel(GetPlayerVehicleID(playerid));
    if(PlayerData[playerid][AdminLevel] < 4) return 0;
    if(sscanf(params,"i",amount)) return SCM(playerid,grey,"USAGE: /createcar [cost]");
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SCM(playerid,red,"ERROR: You are not driving an vehicle");
    if(carid == 0) return SCM(playerid,red,"ERROR: You have reached the max cars you can create");
    format(str,sizeof(str),"You have created this vehicle (model %d) as id %d",modelid,GetCarid());
    SCM(playerid,COLOR_LIMEGREEN,str);
    new ppcol1,ppcol2;
    GetVehicleColor(GetPlayerVehicleID(playerid),ppcol1,ppcol2);
    GetVehiclePos(playerid,X,Y,Z);
    GetVehicleZAngle(playerid,A);
    DealerInfo[carid][Ccolor1] = ppcol1;
    DealerInfo[carid][Ccolor2] = ppcol2;
    DealerInfo[carid][Model] = modelid;
    DealerInfo[carid][PosX] = X;
    DealerInfo[carid][PosY] = Y;
    DealerInfo[carid][PosZ] = Z;
    DealerInfo[carid][Aangle] = A;
    DealerInfo[carid][HasOwner] = 0;
    DealerInfo[carid][Cost] = amount;
    format(DealerInfo[carid][Owner],24,"No Owner",DealerInfo[carid][Owner]);
    DealerInfo[carid][Locked] = 0;
    format(str,sizeof(str),"{FF9900}ID:{FFFFFF} %d\n{FF9900}Owner:{FFFFFF} No Owner\n{FF9900}Price:{FFFFFF} %d",carid,amount);
    DealerInfo[carid][dlabel] = Create3DTextLabel(str,-1,0,0,0,100,-1,0);
    format(query,sizeof(query),"INSERT INTO `Dealership` (ID,Model,PosX,PosY,PosZ,Owner,HasOwner,Color1,Color2,Angle,Cost) VALUES (%d,%d,%f,%f,%f,'No Owner',0,%d,%d,%f,%d)",GetCarid(),GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,ppcol1,ppcol2,A,amount);
    mysql_query(query);
    DestroyVehicle(GetPlayerVehicleID(playerid));
    GetPlayerPos(playerid,X,Y,Z);
    SetPlayerPos(playerid,X,Y,Z+3);
    DealerInfo[carid][Car] = CreateVehicle(DealerInfo[carid][Model],DealerInfo[carid][PosX],DealerInfo[carid][PosY],DealerInfo[carid][PosZ],DealerInfo[carid][Aangle],DealerInfo[carid][Ccolor1],DealerInfo[carid][Ccolor2],60);
    Attach3DTextLabelToVehicle(DealerInfo[carid][dlabel],DealerInfo[carid][Car],0,0,0);
    return 1;
}
Tanush123 is offline   Reply With Quote
Old 18/03/2012, 01:25 PM   #2
Tanush123
High-roller
 
Tanush123's Avatar
 
Join Date: Aug 2011
Posts: 1,022
Reputation: 65
Default Re: Dealership

bump
Tanush123 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
Dealership help, Jack_Leslie Help Archive 8 09/08/2011 10:15 AM
Car dealership Anteino Help Archive 0 23/12/2010 12:28 AM
[HELP] Dealership NotoriousMOB Help Archive 0 14/10/2010 07:32 PM
Need help[Car dealership] iRana Help Archive 1 27/09/2010 10:59 AM


All times are GMT. The time now is 12:06 AM.


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