Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums



(Advanced Search)

Forum Statistics
» Members: 7,499
» Latest member: amin1stp
» Forum threads: 2,413
» Forum posts: 12,360

Full Statistics

Online Users
There are currently 471 online users.
» 2 Member(s) | 464 Guest(s)
Bing, Applebot, Twitter, Pevenaider, Dr0pp

Latest Threads
San Fierro Cops And Robbe...
Forum: Advertisements
Last Post: Dr0pp
50 minutes ago
» Replies: 0
» Views: 7
Adding new vehicles and s...
Forum: Programming
Last Post: __.A.__
Yesterday, 07:47 PM
» Replies: 0
» Views: 54
Zona América del Sur Free...
Forum: Advertisements
Last Post: kevinberriosflores
Yesterday, 02:16 PM
» Replies: 1
» Views: 77
Busco copia de gamemode S...
Forum: Spanish/Espa?ol
Last Post: briancristaldo2021
2025-09-11, 11:14 AM
» Replies: 0
» Views: 61
[Tutorial] Registrando o ...
Forum: Portuguese/Portugu?s
Last Post: Crazy_ArKzX
2025-09-09, 08:36 PM
» Replies: 0
» Views: 204
San Andreas Police Pursui...
Forum: Advertisements
Last Post: BriBri
2025-09-08, 10:09 PM
» Replies: 1
» Views: 296
Problem with plugins load...
Forum: Support
Last Post: MrKacu13
2025-09-08, 07:15 PM
» Replies: 9
» Views: 371
Compilation error
Forum: Pawn Scripting
Last Post: MrKacu13
2025-09-07, 07:18 AM
» Replies: 6
» Views: 357
Need help, problem when i...
Forum: Programming
Last Post: nonickowned
2025-09-06, 06:21 PM
» Replies: 0
» Views: 146
Transfer server from SAMP...
Forum: Support
Last Post: MrKacu13
2025-09-06, 04:03 PM
» Replies: 1
» Views: 239

 
  Server Sided Vehicle Health?
Posted by: JaKe Elite - 2021-01-23, 01:10 PM - Forum: Pawn Scripting - Replies (2)

Hi!



I would like to know if it's possible to make the vehicle health server-sided? Our server has been attacked lately by hackers and they use a CLEO mod, probably something like "Plant & Detonate" mod to make the vehicles exploded.



The way how their hack works was something like



-Type a command to get in a vehicle (it doesn't matter if it's occupied, the previous driver gets kicked and they become the driver)

-They then type a command to plant the bomb (not quite sure)

-Gets out of the vehicle, instantly types a command to detonate or set the vehicle on fire

-teleport far from the vehicle or somewhere nearby?



This was done with their keybinding (except for the part where they have to input the vehicleID of their target)



Is there any way to counter this or to at least make the vehicle health server sided to prevent this kind of stuff??



I am not quite sure if this is the right section or area to post this but I need a clue where to start.


  How to Fix this Run time error 19: "File or function is not found"
Posted by: nocode - 2021-01-23, 11:04 AM - Forum: Pawn Scripting - Replies (5)

server.cfg:?https://prnt.sc/xhwnwi
plugins:?https://prnt.sc/xhwp60
?

Code:
[05:57:34]

[05:57:34] Server Plugins

[05:57:34] --------------

[05:57:34]? Loaded 0 plugins.



[05:57:34] I couldn't load any gamemode scripts. Please verify your server.cfg

[05:57:34] It needs a gamemode0 line at the very least.



----------

Loaded log file: "server_log.txt".

----------



SA-MP Dedicated Server

----------------------

v0.3.7-R2, (C)2005-2015 SA-MP Team



[05:57:37]

[05:57:37] Server Plugins

[05:57:37] --------------

[05:57:37]? Loaded 0 plugins.



[05:57:37] I couldn't load any gamemode scripts. Please verify your server.cfg

[05:57:37] It needs a gamemode0 line at the very least.



----------

Loaded log file: "server_log.txt".

----------



SA-MP Dedicated Server

----------------------

v0.3.7-R2, (C)2005-2015 SA-MP Team



[05:57:40]

[05:57:40] Server Plugins

[05:57:40] --------------

[05:57:40]? Loaded 0 plugins.



[05:57:40] I couldn't load any gamemode scripts. Please verify your server.cfg

[05:57:40] It needs a gamemode0 line at the very least.



----------

Loaded log file: "server_log.txt".

----------



SA-MP Dedicated Server

----------------------

v0.3.7-R2, (C)2005-2015 SA-MP Team



[05:57:43]

[05:57:43] Server Plugins

[05:57:43] --------------

[05:57:43]? Loaded 0 plugins.



[05:57:43] I couldn't load any gamemode scripts. Please verify your server.cfg

[05:57:43] It needs a gamemode0 line at the very least.



----------

Loaded log file: "server_log.txt".

----------



SA-MP Dedicated Server

----------------------

v0.3.7-R2, (C)2005-2015 SA-MP Team



[05:57:46] filterscripts = ""? (string)

[05:57:46]

[05:57:46] Server Plugins

[05:57:46] --------------

[05:57:46]? Loaded 0 plugins.



[05:57:46]

[05:57:46] Filterscripts

[05:57:46] ---------------

[05:57:46]? Loaded 0 filterscripts.



[05:57:46] Script[gamemodes/CODMW3.amx]: Run time error 19: "File or function is not found"

[05:57:46] Number of vehicle models: 0



----------

Loaded log file: "server_log.txt".

----------



SA-MP Dedicated Server

----------------------

v0.3.7-R2, (C)2005-2015 SA-MP Team



[05:57:53] filterscripts = ""? (string)

[05:57:53]

[05:57:53] Server Plugins

[05:57:53] --------------

[05:57:53]? Loaded 0 plugins.



[05:57:53]

[05:57:53] Filterscripts

[05:57:53] ---------------

[05:57:53]? Loaded 0 filterscripts.



[05:57:53] Script[gamemodes/CODMW3.amx]: Run time error 19: "File or function is not found"

[05:57:53] Number of vehicle models: 0


  I need help to fix Dini.inc
Posted by: nocode - 2021-01-23, 07:48 AM - Forum: Pawn Scripting - No Replies

Original plugin:?https://github.com/AndreT/samp-vortex-rp...e/Dini.inc



Error: https://prnt.sc/xhnokq


  Special characters aren't correct on sampctl
Posted by: Rique_FTW - 2021-01-23, 02:42 AM - Forum: Support - Replies (1)

I found a person on the github with the same problem as me. It is not possible to insert accent and special characters in sampctl.

Github link: Special characters aren't correct on sampctl ? Issue #416 ? Southclaws/sampctl (github.com)

When I type 'Portuguese', the output is 'Portugu�s'.


  Mai?osi versijos
Posted by: Lukas - 2021-01-22, 08:21 PM - Forum: Lithuanian/Lietuvi?kas - Replies (2)

Sveiki, sugalvojau parsisiusti 0.3.DL, isira?iau atskira GTA kitame folderyje ir ten instaliavau, nes norejau pasilikt 0.3.7, prisijungiau karta i 0.3.DL ir kai ejau i 0.3.7 serveri, junge vis tiek kaip su DL. Teko perra?yt samp. Gal ?inot kaip pasidaryt kad nesima?ytu tos versijos ir leistu i? vieno jungtis i viena, i? kito i kita?


  How to save player accounts when the server crashes?
Posted by: Radical - 2021-01-22, 12:07 PM - Forum: Pawn Scripting - Replies (2)

Is there a way to save the account of all players when the server crashes and closes?

OnGameModeExit will not be called at this time.



Solved: Crashdetect include >> OnServerRuntime


  deleted
Posted by: zetrazak - 2021-01-22, 11:06 AM - Forum: Pawn Scripting - No Replies

Fixed


Star Add new vehicles to server
Posted by: Disretired - 2021-01-22, 08:08 AM - Forum: Questions and Suggestions - Replies (1)

So my idea is based off what GTA V servers do, clients like Rage and FiveM allow the servers to add brand new vehicle models to the game that are not default game, If possible this would be a major upgrade for GTA SA RP servers, for example a lot of servers have? multiple law enforcement factions, if we were able to add a bunch of new cars unique to each of those factions instead of having to work with the old default game models, then these factions would look much more professional and easier for the player to tell which agency is which. This idea of course could be for much more then just law enforcement, we could added new civilian vehicles and other government vehicle as well.



as I said above I? don't know how hard it would be to allow completely new vehicles to be added to a server and have those models sync with other players, but if there is any possible way to do this I truly believe it could really change the game for how the role-play servers operate.


  [Help] Dealership disappears after server restart
Posted by: Disretired - 2021-01-22, 07:24 AM - Forum: Pawn Scripting - Replies (5)

Hello again, myself and my friends could use a hand on this issue as we haven't been able to fix it regardless of what we try.







So our vehicle dealerships disappears after server restart, I've checked the ini file it is writing the info for the lots too and it does show the dealership we created in it, however when we go in game after a restart it does not load that dealership in, we've been trying to fix this for about two or three weeks now with know solution in site, I kindly ask that if anyone knows how to fix this so that it will properly load after restart to please help us out.







Below I've attached every line i see mentioning the dealership.







Code:
#define DIALOG_GPS_LA_CARDEALERSHIPS 32637



//=========================================================================//



#define MAX_DEALERSHIPVEHICLES 51



#define MAX_CARDEALERSHIPS 51



//=========================================================================//



enum cdInfo



{



cdOwned,



cdOwner[MAX_PLAYER_NAME],



Float: cdEntranceX,



Float: cdEntranceY,



Float: cdEntranceZ,



Float: cdExitX,



Float: cdExitY,



Float: cdExitZ,



cdMessage[128],



cdTill,



cdInterior,



Float: cdRadius,



cdPrice,



cdPickupID,



Text3D:cdTextLabel,



Text3D:cdVehicleLabel[MAX_DEALERSHIPVEHICLES],



cdVehicleModel[MAX_DEALERSHIPVEHICLES],



cdVehicleCost[MAX_DEALERSHIPVEHICLES],



cdVehicleId[MAX_DEALERSHIPVEHICLES],



Float: cdVehicleSpawnX[MAX_DEALERSHIPVEHICLES],



Float: cdVehicleSpawnY[MAX_DEALERSHIPVEHICLES],



Float: cdVehicleSpawnZ[MAX_DEALERSHIPVEHICLES],



Float: cdVehicleSpawnAngle[MAX_DEALERSHIPVEHICLES],



Float: cdVehicleSpawn[4],



};



new CarDealershipInfo[MAX_CARDEALERSHIPS][cdInfo];



//=========================================================================//



}



? ? if(GetCarDealershipVehicleId(newcar) != -1 && GetCarDealershipVehicleId(newcar) == GetPVarInt(playerid, "editingcdveh")) return 1;



? ? ? ? if(GetCarDealershipVehicleId(newcar) != -1)



? ? ? ? {



new string[57  20  4];



format(string, sizeof(string),"Would you like to buy this %s?\n\nThis vehicle costs $%d.", GetVehicleName(newcar), CarDealershipInfo[GetCarDealershipId(newcar)][cdVehicleCost][GetCarDealershipVehicleId(newcar)]);



? ? ShowPlayerDialog(playerid,DIALOG_CDBUY,DIALOG_STYLE_MSGBOX,"LB-Gaming CAR DEALERSHIP",string,"Buy","Cancel");



? ? TogglePlayerControllable(playerid, false);



? ? return 1;



? ? ? ? }



GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);



if((engine == VEHICLE_PARAMS_UNSET || engine == VEHICLE_PARAMS_OFF) && GetVehicleModel(newcar) != 509 && GetVehicleModel(newcar) != 481 && GetVehicleModel(newcar) != 510) {



SendClientMessageEx(playerid, COLOR_WHITE, "This vehicle's engine is not running - if you wish to start it, type /car engine.");



}



else



{



if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 481 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 509 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 510)



{



//format(erpstring, sizeof(erpstring), "%.2f GAL", VehicleFuel[GetPlayerVehicleID(playerid)]);



//TextDrawSetString(FuelText[playerid],erpstring);



}



}



}



//=========================================================================//



LoadcDealerships()



{



? ? new string2[64];



format(string2, sizeof(string2), "cardealerships.ini");



new File: DealerFile = fopen(string2, io_read);



if ( DealerFile )



{



new key[ 256 ] , val[ 256 ];



new Data[ 256 ];



while ( fread( DealerFile , Data , sizeof( Data ) ) )



{



? ? new string[128];



? ? for(new f = 0; f < MAX_FAMILY; f)



? ? {



key = ini_GetKey( Data );



format(string, 128, "cd%dOwned",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdOwned] = strval( val ); }



format(string, 128, "cd%dOwner",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); strmid(CarDealershipInfo[f][cdOwner], val, 0, strlen(val)-1, 255); }



format(string, 128, "cd%dEntranceX",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdEntranceX] = floatstr( val ); }



format(string, 128, "cd%dEntranceY",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdEntranceY] = floatstr( val ); }



format(string, 128, "cd%dEntranceZ",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdEntranceZ] = floatstr( val ); }



format(string, 128, "cd%dExitX",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdExitX] = floatstr( val ); }



format(string, 128, "cd%dExitY",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdExitY] = floatstr( val ); }



format(string, 128, "cd%dExitZ",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdExitZ] = floatstr( val ); }



format(string, 128, "cd%dMessage",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); strmid(CarDealershipInfo[f][cdMessage], val, 0, strlen(val)-1, 255); }



format(string, 128, "cd%dTill",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdTill] = strval( val ); }



format(string, 128, "cd%dInterior",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdInterior] = strval( val ); }



format(string, 128, "cd%dVehicleSpawn0",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleSpawn][0] = floatstr( val ); }



format(string, 128, "cd%dVehicleSpawn1",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleSpawn][1] = floatstr( val ); }



format(string, 128, "cd%dVehicleSpawn2",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleSpawn][2] = floatstr( val ); }



format(string, 128, "cd%dVehicleSpawn3",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleSpawn][3] = floatstr( val ); }



format(string, 128, "cd%dRadius",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdRadius] = floatstr( val ); }



format(string, 128, "cd%dPrice",f);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdPrice] = strval( val ); }







for(new fv = 0; fv < MAX_DEALERSHIPVEHICLES; fv)



? ? {



? ? ? ? format(string, 128, "cd%dVeh%dModelId",f, fv);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleModel][fv] = strval( val ); }



format(string, 128, "cd%dVeh%dCost",f, fv);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleCost][fv] = strval( val ); }



format(string, 128, "cd%dVeh%dSpawnX",f, fv);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleSpawnX][fv] = floatstr( val ); }



format(string, 128, "cd%dVeh%dSpawnY",f, fv);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleSpawnY][fv] = floatstr( val ); }



format(string, 128, "cd%dVeh%dSpawnZ",f, fv);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleSpawnZ][fv] = floatstr( val ); }



format(string, 128, "cd%dVeh%dSpawnA",f, fv);



if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); CarDealershipInfo[f][cdVehicleSpawnAngle][fv] = floatstr( val ); }



? ? }



}



}



fclose(DealerFile);



}



return 1;



}







SavecDealerships()



{



new string3[32];



format(string3, sizeof(string3), "cardealerships.ini");



new File: hFile = fopen(string3, io_write);



if (hFile)



{



new var[32];



for(new f = 0; f < MAX_CARDEALERSHIPS; f)



? {



format(var, 32, "cd%dOwned=%d\n",f, CarDealershipInfo[f][cdOwned]); fwrite(hFile, var);



format(var, 32, "cd%dOwner=%s\n",f, CarDealershipInfo[f][cdOwner]); fwrite(hFile, var);



format(var, 32, "cd%dEntranceX=%.1f\n",f, CarDealershipInfo[f][cdEntranceX]); fwrite(hFile, var);



format(var, 32, "cd%dEntranceY=%.1f\n",f, CarDealershipInfo[f][cdEntranceY]); fwrite(hFile, var);



format(var, 32, "cd%dEntranceZ=%.1f\n",f, CarDealershipInfo[f][cdEntranceZ]); fwrite(hFile, var);



format(var, 32, "cd%dExitX=%.1f\n",f, CarDealershipInfo[f][cdExitX]); fwrite(hFile, var);



format(var, 32, "cd%dExitY=%.1f\n",f, CarDealershipInfo[f][cdExitX]); fwrite(hFile, var);



format(var, 32, "cd%dExitZ=%.1f\n",f, CarDealershipInfo[f][cdExitX]); fwrite(hFile, var);



format(var, 32, "cd%dMessage=%s\n\n",f, CarDealershipInfo[f][cdMessage]); fwrite(hFile, var);



format(var, 32, "cd%dTill=%d\n",f, CarDealershipInfo[f][cdTill]); fwrite(hFile, var);



format(var, 32, "cd%dInterior=%d\n",f, CarDealershipInfo[f][cdInterior]); fwrite(hFile, var);



format(var, 32, "cd%dVehicleSpawn0=%.1f\n",f, CarDealershipInfo[f][cdVehicleSpawn][0]); fwrite(hFile, var);



format(var, 32, "cd%dVehicleSpawn1=%.1f\n",f, CarDealershipInfo[f][cdVehicleSpawn][1]); fwrite(hFile, var);



format(var, 32, "cd%dVehicleSpawn2=%.1f\n",f, CarDealershipInfo[f][cdVehicleSpawn][2]); fwrite(hFile, var);



format(var, 32, "cd%dVehicleSpawn3=%.1f\n",f, CarDealershipInfo[f][cdVehicleSpawn][3]); fwrite(hFile, var);



format(var, 32, "cd%dRadius=%.1f\n",f, CarDealershipInfo[f][cdRadius]); fwrite(hFile, var);



format(var, 32, "cd%dPrice=%d\n",f, CarDealershipInfo[f][cdPrice]); fwrite(hFile, var);







for(new fv = 0; fv < MAX_DEALERSHIPVEHICLES; fv)



? {



? ? ? format(var, 32, "cd%dVeh%dModelId=%d\n",f, fv, CarDealershipInfo[f][cdVehicleModel][fv]); fwrite(hFile, var);



format(var, 32, "cd%dVeh%dCost=%d\n",f, fv,CarDealershipInfo[f][cdVehicleCost][fv]); fwrite(hFile, var);



format(var, 32, "cd%dVeh%dSpawnX=%.1f\n",f, fv,CarDealershipInfo[f][cdVehicleSpawnX][fv]); fwrite(hFile, var);



format(var, 32, "cd%dVeh%dSpawnY=%.1f\n",f, fv,CarDealershipInfo[f][cdVehicleSpawnY][fv]); fwrite(hFile, var);



format(var, 32, "cd%dVeh%dSpawnZ=%.1f\n",f, fv,CarDealershipInfo[f][cdVehicleSpawnZ][fv]); fwrite(hFile, var);



format(var, 32, "cd%dVeh%dSpawnA=%.1f\n",f, fv,CarDealershipInfo[f][cdVehicleSpawnAngle][fv]); fwrite(hFile, var);



? ? }



? }



fclose(hFile);



}



return 1;



}



//=========================================================================//



LoadcDealerships();



//=========================================================================//



}



new text_info[128];



for(new d = 0; d < sizeof(CarDealershipInfo); d)



{



if(CarDealershipInfo[d][cdEntranceX] != 0.0 && CarDealershipInfo[d][cdEntranceY] != 0.0)



{



CarDealershipInfo[d][cdPickupID] = CreateDynamicPickup(1239, 1, CarDealershipInfo[d][cdEntranceX], CarDealershipInfo[d][cdEntranceY], CarDealershipInfo[d][cdEntranceZ]);



if(CarDealershipInfo[d][cdOwned])



{



? ? ? ? ? ? format(text_info, sizeof(text_info),"Car Dealership %s\nOwner: %s\nRadius: %.1f\nID: %d", CarDealershipInfo[d][cdMessage], CarDealershipInfo[d][cdOwner], CarDealershipInfo[d][cdRadius], d);



? ? ? ? ? ? CarDealershipInfo[d][cdTextLabel] = CreateDynamic3DTextLabel(text_info,COLOR_GREEN,CarDealershipInfo[d][cdEntranceX], CarDealershipInfo[d][cdEntranceY], CarDealershipInfo[d][cdEntranceZ].75,3.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,1);



}



else



{



? ? ? ? ? ? format(text_info, sizeof(text_info),"Car Dealership %s For Sale\nPrice: %d\nRadius: %.1f\nID: %d", CarDealershipInfo[d][cdMessage], CarDealershipInfo[d][cdPrice], CarDealershipInfo[d][cdRadius], d);



? ? ? ? ? ? CarDealershipInfo[d][cdTextLabel] = CreateDynamic3DTextLabel(text_info,COLOR_RED,CarDealershipInfo[d][cdEntranceX], CarDealershipInfo[d][cdEntranceY], CarDealershipInfo[d][cdEntranceZ].75,3.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,1);



}



}



for(new v = 0; v < MAX_DEALERSHIPVEHICLES; v)



? ? {



if (CarDealershipInfo[d][cdVehicleModel][v] != 0)



{



? ? ? ? new carcreated = CreateVehicleEx(CarDealershipInfo[d][cdVehicleModel][v], CarDealershipInfo[d][cdVehicleSpawnX][v], CarDealershipInfo[d][cdVehicleSpawnY][v], CarDealershipInfo[d][cdVehicleSpawnZ][v], CarDealershipInfo[d][cdVehicleSpawnAngle][v], 0, 0, 6);



? ? ? ? format(text_info, sizeof(text_info), "%s For Sale\nPrice: %d", GetVehicleName(carcreated), CarDealershipInfo[d][cdVehicleCost][v]);



? ? ? ? ? ? ? ? CarDealershipInfo[d][cdVehicleLabel][v] = CreateDynamic3DTextLabel(text_info,COLOR_LIGHTBLUE,0.0, 0.0, 0.0,8.0,INVALID_PLAYER_ID,carcreated);



? ? ? ? ? ? ? ? CarDealershipInfo[d][cdVehicleId][v] = carcreated;



}



}



}



//=========================================================================//



CMD:editcardealership(playerid, params[])



{



? ? for(new d = 0 ; d < MAX_CARDEALERSHIPS; d)



{



? ? ? ? if(IsPlayerInRangeOfPoint(playerid, CarDealershipInfo[d][cdRadius], CarDealershipInfo[d][cdEntranceX], CarDealershipInfo[d][cdEntranceY], CarDealershipInfo[d][cdEntranceZ])) {



? ? ? ? ? ? if(PlayerInfo[playerid][pAdmin] >= 1337)



{



? ? ? ? ? ? ? ? SetPVarInt(playerid, "editingcd", d);



? ? ? ? ? ? ? ? SetPVarInt(playerid, "editingcdveh", -1);



? ? ? ? ? ? ? ? SetPVarInt(playerid, "editingcdvehpos", 0);



? ? ? ? ? ? ? ? SetPVarInt(playerid, "editingcdvehnew", 0);



? ? ? ? ? ? ? ? new listitems[] = "1 New Vehicle\n2 My Vehicles\n3 Upgrade\n4 Till";



? ? ? ? ? ? ? ? ShowPlayerDialog(playerid,DIALOG_CDEDIT,DIALOG_STYLE_LIST,"Car Dealership Editor:", listitems,"Select","Cancel");



? ? ? ? ? ? ? ? return 1;



? ? ? ? ? ? }



? ? ? ? ? ? else



{



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "You do not own that Car Dealership.");



? ? ? ? ? ? ? ? return 1;



? ? ? ? ? ? }



? ? ? ? }



? ? }



? ? SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You must be standing inside the radius of the Car Dealership.");



? ? return 1;



}











CMD:editcar(playerid, params[])



{



? ? new vehicleid = GetPlayerVehicleID(playerid);



? ? new v, d;



? ? v = GetCarDealershipVehicleId(vehicleid);



? ? d = GetCarDealershipId(vehicleid);



? ? if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You are not in any car.");



? ? if(v != -1 && d != -1)



{



? ? ? ? if(PlayerInfo[playerid][pAdmin] >= 1337)



{



? ? ? ? ? ? SetPVarInt(playerid, "editingcd", d);



? ? ? ? ? ? SetPVarInt(playerid, "editingcdveh", v);



? ? ? ? ? ? SetPVarInt(playerid, "editingcdvehpos", 0);



? ? ? ? ? ? SetPVarInt(playerid, "editingcdvehnew", 0);



? ? ? ? ? ? new listitems[] = "1 Edit Model\n2 Edit Cost\n3 Edit Park\n4 Delete Vehicle";



? ? ? ? ? ? ShowPlayerDialog(playerid,DIALOG_CDEDITONE,DIALOG_STYLE_LIST,"Car Dealership Editor:", listitems,"Select","Cancel");



? ? ? ? ? ? return 1;



? ? ? ? }



? ? ? ? else



{



? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You do not own that Car Dealership.");



? ? ? ? }



? ? }



? ? else



{



? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "ERROR: Car is not part of a Car Dealership.");



? ? }



? ? return 1;



}







CMD:buydealership(playerid, params[])



{



? ? for(new d = 0 ; d < MAX_CARDEALERSHIPS; d)



{



? ? ? ? if(IsPlayerInRangeOfPoint(playerid, 3.0, CarDealershipInfo[d][cdEntranceX], CarDealershipInfo[d][cdEntranceY], CarDealershipInfo[d][cdEntranceZ]))



{



? ? ? ? ? ? if(!CarDealershipInfo[d][cdOwned])



{



? ? ? ? ? ? ? ? if(GetPVarInt(playerid, "Cash") < CarDealershipInfo[d][cdPrice])



{



? ? ? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, " You do not have enough money to buy this Car Dealership.");



? ? ? ? ? ? ? ? ? ? return 1;



? ? ? ? ? ? ? ? }



? ? ? ? ? ? ? ? SetPVarInt(playerid, "Cash", GetPVarInt(playerid, "Cash")-CarDealershipInfo[d][cdPrice]);



? ? ? ? ? ? ? ? SetPlayerOwnerOfCD(playerid, d);



? ? ? ? ? ? ? ? PlayerPlayMusic(playerid);



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_WHITE, " Type /help to review the new car dealership help section.");



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD1, " Please set the position you want your brought cars to spawn.");



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD2, " Stand where you want to have your brought vehicles spawn.");



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD2, " Once ready press the fire button.");



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_WHITE, " NOTE: If you don't set it your customers wont be able to buy any cars.");



? ? ? ? ? ? ? ? SetPVarInt(playerid, "editingcdvehpos", 2);



? ? ? ? ? ? ? ? SetPVarInt(playerid, "editingcd", d);



? ? ? ? ? ? ? ? return 1;



? ? ? ? ? ? }



? ? ? ? ? ? else



{



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "That car dealership is already owned and it's not for sale.");



? ? ? ? ? ? }



? ? ? ? }



? ? }



? ? return 1;



}







CMD:selldealership(playerid, params[])



{



new string[128];







? ? for(new d = 0 ; d < MAX_CARDEALERSHIPS; d)



{



? ? ? ? if(IsPlayerInRangeOfPoint(playerid, 3.0, CarDealershipInfo[d][cdEntranceX], CarDealershipInfo[d][cdEntranceY], CarDealershipInfo[d][cdEntranceZ]))



{



? ? ? ? ? ? if(PlayerInfo[playerid][pAdmin] >= 1337)



{



? ? ? ? ? ? ? ? SetPVarInt(playerid, "editingcd", d);



? ? ? ? ? ? ? ? format(string,128,"Are you sure you want to sell this Car Dealership for $%d?\n.", CarDealershipInfo[d][cdPrice] / 2);



? ? ? ? ? ? ? ? ShowPlayerDialog(playerid,DIALOG_CDSELL,DIALOG_STYLE_MSGBOX,"Warning:",string,"Sell","Cancel");



? ? ? ? ? ? ? ? return 1;



? ? ? ? ? ? }



? ? ? ? ? ? else



{



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "You are not the owner of this car dealership.");



? ? ? ? ? ? ? ? return 1;



? ? ? ? ? ? }



? ? ? ? }



? ? }



? ? SendClientMessageEx(playerid, COLOR_GREY, "You have to be near a car dealership.");



? ? return 1;



}







CMD:createcdveh(playerid, params[])



{



? ? if (PlayerInfo[playerid][pAdmin] < 1337)



{



? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, " You are not allowed to use this command.");



? ? ? ? return 1;



? ? }







? ? new string[128], price, dealershipid, modelid;



? ? if(sscanf(params, "ddd", price, dealershipid, modelid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /createcdveh [price] [dealership] [modelid]");







? ? new Float:X,Float:Y,Float:Z,Float:A;



? ? GetPlayerPos(playerid,X,Y,Z);



? ? GetPlayerFacingAngle(playerid, A);



? ? new cdvehicleid = CreateCarDealershipVehicle(dealershipid, modelid, X, Y, Z, A, price);



? ? if(cdvehicleid == -1)



{



? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "ERROR: cdVehicles limit reached.");



? ? }



? ? else



{



? ? ? ? format(string, sizeof(string), " SYSTEM: Car dealership vehicle created (M-ID %d)(ID %d)", modelid, cdvehicleid);



? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD1, string);



? ? }



? ? return 1;



}







CMD:destroycdveh(playerid, params[])



{



? ? if (PlayerInfo[playerid][pAdmin] < 1337)



{



? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, " You are not allowed to use this command.");



? ? ? ? return 1;



? ? }







? ? new string[128], vehid;



? ? if(sscanf(params, "d", vehid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /destroycdveh [vehicleid]");







? ? DestroyCarDealershipVehicle(GetCarDealershipId(vehid), GetCarDealershipVehicleId(vehid));



? ? SavecDealerships();



? ? format(string, sizeof(string), " SYSTEM: Car dealership vehicle destroyed (ID %d)", vehid);



? ? SendClientMessageEx(playerid, COLOR_GRAD1, string);



? ? return 1;



}







CMD:createdealership(playerid, params[])



{



? ? if (PlayerInfo[playerid][pAdmin] < 1337)



{



? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, " You are not allowed to use this command.");



? ? ? ? return 1;



? ? }







? ? new string[128], price, radius, message[64];



? ? if(sscanf(params, "dds[64]", price, radius, message)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /createdealership [price] [radius] [message]");







? ? new Float:X,Float:Y,Float:Z;



? ? GetPlayerPos(playerid,X,Y,Z);



? ? new dealershipid = CreateCarDealership(X, Y, Z, radius, price, message);



? ? if(dealershipid == -1)



{



? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "ERROR: Car Dealerships limit reached.");



? ? }



? ? else



{



? ? ? ? format(string, sizeof(string), " SYSTEM: Car dealership created (ID %d)", dealershipid);



? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD1, string);



? ? }



? ? return 1;



}







CMD:destroydealership(playerid, params[])



{



? ? if (PlayerInfo[playerid][pAdmin] < 1337)



{



? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, " You are not allowed to use this command.");



? ? ? ? return 1;



? ? }







? ? new string[128], dealershipid;



? ? if(sscanf(params, "d", dealershipid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /destroydealership [dealershipid]");







? ? for(new d = 0 ; d < MAX_CARDEALERSHIPS; d)



{



? ? ? ? if(IsPlayerInRangeOfPoint(playerid, 3.0, CarDealershipInfo[d][cdEntranceX], CarDealershipInfo[d][cdEntranceY], CarDealershipInfo[d][cdEntranceZ]))



{



? ? ? ? ? ? DestroyCarDealership(d);



? ? ? ? ? ? format(string, sizeof(string), " Car Dealership destroyed with ID %d.", d);



? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD1, string);



? ? ? ? ? ? return 1;



? ? ? ? }



? ? }



? ? if(dealershipid > MAX_CARDEALERSHIPS) return 1;



? ? if(dealershipid < 0) return 1;



? ? DestroyCarDealership(dealershipid);



? ? format(string, sizeof(string), " Car Dealership destroyed with ID %d.", dealershipid);



? ? SendClientMessageEx(playerid, COLOR_GRAD1, string);



? ? return 1;



}



//=========================================================================//



else if(dialogid == DIALOG_CDEDIT)



{ // car dealership dialog



if(response && GetPVarInt(playerid, "editingcd") != -1)



{



? ? ? ? ? ? if(listitem == 0) // New Vehicle



{



format(string, sizeof(string),"Please type the model ID of the new vehicle.");



? ? ? ? ShowPlayerDialog(playerid,DIALOG_CDNEWVEH,DIALOG_STYLE_INPUT,"Warning:",string,"Ok","Cancel");



}



else if(listitem == 1) // My Vehicles



{



new vehicles;



? ? ? ? ? ? ? ? for(new i=0; i<MAX_DEALERSHIPVEHICLES; i)



? ? ? ? ? ? {



if(CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdVehicleModel][i] != 0)



{



vehicles;



? ? ? ? ? ? ? ? format(string, sizeof(string), "Vehicle %d| Name: %s | Price: %d.",i,GetVehicleName(CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdVehicleId][i]),CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdVehicleCost][i]);



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_WHITE, string);



}



}



if(vehicles)



{



? ? ShowPlayerDialog(playerid, DIALOG_CDEDITCARS, DIALOG_STYLE_INPUT, "Car Dealership:", " Choose a vehicle to edit:", "Edit", "Back");



}



else



{



SendClientMessageEx(playerid, COLOR_GRAD2, " This car dealership doesn't have any cars.");



}



}



else if(listitem == 2) // Upgrade



{



new listitems[] = "1 Vehicle Spawn\n2 Radius\n3 Dealership Name\n4 Price";



? ? ShowPlayerDialog(playerid,DIALOG_CDUPGRADE,DIALOG_STYLE_LIST,"Choose an item to continue.", listitems,"Select","Cancel");



}



else if(listitem == 3) // Till



{



new listitems[] = "1 Withdraw\n2 Deposit";



? ? ShowPlayerDialog(playerid,DIALOG_CDTILL,DIALOG_STYLE_LIST,"Choose an item to continue.", listitems,"Select","Cancel");



}



}



else



{



SavecDealerships();



? ? ? ? ? ? SetPVarInt(playerid, "editingcd", -1);



}



}



else if(dialogid == DIALOG_CDTILL)



{ // car dealership dialog



? ? if(response && GetPVarInt(playerid, "editingcd") != -1)



{



? ? ? ? ? ? if(listitem == 0) // Withdraw



{



format(string, sizeof(string), "You have $%d in your till account.\n\n\tHow much money to withdraw?", CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdTill]);



ShowPlayerDialog(playerid,DIALOG_CDWITHDRAW,DIALOG_STYLE_INPUT,"Withdraw", string,"Select","Cancel");



}



else if(listitem == 1) // Deposit



{



format(string, sizeof(string), "You have $%d in your till account.\n\n\tHow much money to deposit?", CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdTill]);



ShowPlayerDialog(playerid,DIALOG_CDDEPOSIT,DIALOG_STYLE_INPUT,"Deposit", string,"Select","Cancel");



}



}



else



{



? ? ? ? ? ? SavecDealerships();



? ? ? ? ? ? SetPVarInt(playerid, "editingcd", -1);



}



}



else if(dialogid == DIALOG_CDWITHDRAW)



{ // car dealership dialog



if(response && GetPVarInt(playerid, "editingcd") != -1)



{



? ? if (IsNumeric(inputtext))



? ? ? ? {



? ? ? ? ? ? new money = strval(inputtext);



? ? ? ? ? ? if(CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdTill] < money)



? ? ? ? ? ? {



? ? ? ? ? ? ? ? ? ? format(string, sizeof(string), "You don't have that much in your till!\n\nYou have $%d in your till account.\n\n\tHow much money to withdraw?", CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdTill]);



? ? ShowPlayerDialog(playerid,DIALOG_CDWITHDRAW,DIALOG_STYLE_INPUT,"Withdraw", string,"Select","Cancel");



? ? ? ? ? ? ? ? ? ? return 1;



? ? ? ? ? ? }



? ? ? ? ? ? CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdTill] -= money;



? ? ? ? ? ? SetPVarInt(playerid, "Cash", GetPVarInt(playerid, "Cash")骉);



? ? ? ? ? ? format(string, sizeof(string), "You have successfully withdrawn $%d from your till, new balance: $%d", money, CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdTill]);



? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD2, string);



? ? ? ? ? ? SavecDealerships();



? ? ? ? ? ? ? ? SetPVarInt(playerid, "editingcd", -1);



}



? ? ? ? }



else



{



? ? ? ? ? ? SavecDealerships();



? ? ? ? ? ? SetPVarInt(playerid, "editingcd", -1);



}



}



else if(dialogid == DIALOG_CDDEPOSIT)



{ // car dealership dialog



if(response && GetPVarInt(playerid, "editingcd") != -1)



{



? ? if (IsNumeric(inputtext))



? ? ? ? {



? ? ? ? ? ? new money = strval(inputtext);



? ? ? ? ? ? if(GetPVarInt(playerid, "Cash") < money)



? ? ? ? ? ? {



? ? ? ? ? ? ? ? ? ? format(string, sizeof(string), "You don't have that much in your wallet!\n\nYou have $%d in your till account.\n\n\tHow much money to deposit?", CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdTill]);



? ? ShowPlayerDialog(playerid,DIALOG_CDDEPOSIT,DIALOG_STYLE_INPUT,"Deposit", string,"Select","Cancel");



? ? ? ? ? ? ? ? ? ? return 1;



? ? ? ? ? ? }



? ? ? ? ? ? CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdTill] = money;



? ? ? ? ? ? SetPVarInt(playerid, "Cash", GetPVarInt(playerid, "Cash")-money);



? ? ? ? ? ? format(string, sizeof(string), "You have successfully deposited $%d to your till, new balance: $%d", money, CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdTill]);



? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD2, string);



? ? ? ? ? ? SavecDealerships();



? ? ? ? ? ? ? ? SetPVarInt(playerid, "editingcd", -1);



}



}



else



{



? ? ? ? ? ? SavecDealerships();



? ? ? ? ? ? SetPVarInt(playerid, "editingcd", -1);



}



}



else if(dialogid == DIALOG_CDUPGRADE)



{ // car dealership dialog



if(response && GetPVarInt(playerid, "editingcd") != -1)



{



? ? ? ? ? ? if(listitem == 0) // Vehicle Spawn



{



SendClientMessageEx(playerid, COLOR_GRAD2, " Please stand where you want to have your brought vehicles spawn.");



SendClientMessageEx(playerid, COLOR_GRAD2, " Once ready press the fire button.");



SetPVarInt(playerid, "editingcdvehpos", 2);



}



? ? ? ? ? ? if(listitem == 1) // Radius



{



ShowPlayerDialog(playerid, DIALOG_CDRADIUS, DIALOG_STYLE_INPUT, "Car Dealership:", " Choose the new radius:", "Edit", "Back");



}



else if(listitem == 2) // Dealership Name



{



ShowPlayerDialog(playerid, DIALOG_CDNAME, DIALOG_STYLE_INPUT, "Car Dealership:", " Choose the new name:", "Edit", "Back");



}



else if(listitem == 3) // Price



{



ShowPlayerDialog(playerid, DIALOG_CDPRICE, DIALOG_STYLE_INPUT, "Car Dealership:", " Choose the new price:", "Edit", "Back");



}



}



else



{



? ? ? ? ? ? SavecDealerships();



? ? ? ? ? ? SetPVarInt(playerid, "editingcd", -1);



}



}



else if(dialogid == DIALOG_CDRADIUS)



{ // car dealership dialog



if(response && GetPVarInt(playerid, "editingcd") != -1)



{



new d;



d = GetPVarInt(playerid, "editingcd");



new Float:radius = floatstr(inputtext);



new Float:radiusex = CarDealershipInfo[d][cdRadius];



new test = floatround(radius), test1 = floatround(radiusex);



? ? ? ? ? ? if (CarDealershipInfo[d][cdRadius] > radius)



? ? ? ? {



new cost = ( test - test1 ) * ( test1 * 1000 );



if(GetPVarInt(playerid, "Cash") < cost)



{



? ? ? ? ? ? ? ? ? ? format(string, sizeof(string), "ERROR: You do not have enough money for this upgrade ($%d).",cost);



? ? ? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, string);



? ? ? ? ? ? ? ? ? ? return 1;



}



format(string, sizeof(string), " Car Dealership radius upgraded from %.1f to %.1f for $%d.",radiusex, radius, cost);



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, string);



? ? ? ? ? ? CarDealershipInfo[d][cdRadius] = radius;



? ? ? ? ? ? format(string,128,"Car Dealership %s\nOwner: %s\nRadius: %.1f\nID: %d", CarDealershipInfo[d][cdMessage], CarDealershipInfo[d][cdOwner], CarDealershipInfo[d][cdRadius], d);



? ? ? ? ? ? UpdateDynamic3DTextLabelText(CarDealershipInfo[d][cdTextLabel], COLOR_GREEN, string);



? ? ? ? ? ? new listitems[] = "1 Vehicle Spawn\n2 Radius\n3 Dealership Name\n4 Price";



? ? ShowPlayerDialog(playerid,DIALOG_CDUPGRADE,DIALOG_STYLE_LIST,"Choose an item to continue", listitems,"Select","Cancel");



? ? SavecDealerships();



? ? ? ? }



}



else



{



? ? new listitems[] = "1 Vehicle Spawn\n2 Radius\n3 Dealership Name\n4 Price";



ShowPlayerDialog(playerid,DIALOG_CDUPGRADE,DIALOG_STYLE_LIST,"Choose an item to continue", listitems,"Select","Cancel");



}



}



else if(dialogid == DIALOG_CDNAME)



{ // car dealership dialog



if(response && GetPVarInt(playerid, "editingcd") != -1)



{



new d;



d = GetPVarInt(playerid, "editingcd");



? ? ? ? ? ? if (!strlen(inputtext))



{



? ? SendClientMessageEx(playerid, COLOR_LIGHTRED, "** You must type a name **");



? ? ? ? ? ? ShowPlayerDialog(playerid, DIALOG_CDNAME, DIALOG_STYLE_INPUT, "Car Dealership:", " Choose the new name:", "Edit", "Back");



? ? ? ? return 1;



}



new cost = strlen(inputtext) * 50;



format(string, sizeof(string), " Car Dealership name upgraded from %s to %s for $%d.", CarDealershipInfo[d][cdMessage], inputtext, cost);



? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, string);



? ? ? ? strmid(CarDealershipInfo[d][cdMessage], inputtext, 0, strlen(inputtext), 255);



? ? ? ? format(string,128,"Car Dealership %s\nOwner: %s\nRadius: %.1f\nID: %d", CarDealershipInfo[d][cdMessage], CarDealershipInfo[d][cdOwner], CarDealershipInfo[d][cdRadius], d);



? ? ? ? UpdateDynamic3DTextLabelText(CarDealershipInfo[d][cdTextLabel], COLOR_GREEN, string);



? ? ? ? new listitems[] = "1 Vehicle Spawn\n2 Radius\n3 Dealership Name\n4 Price";



ShowPlayerDialog(playerid,DIALOG_CDUPGRADE,DIALOG_STYLE_LIST,"Choose an item to continue", listitems,"Select","Cancel");



SavecDealerships();



}



else



{



? ? new listitems[] = "1 Vehicle Spawn\n2 Radius\n3 Dealership Name\n4 Price";



ShowPlayerDialog(playerid,DIALOG_CDUPGRADE,DIALOG_STYLE_LIST,"Choose an item to continue", listitems,"Select","Cancel");



}



}



else if(dialogid == DIALOG_CDEDITCARS)



{ // car dealership dialog



if(response && GetPVarInt(playerid, "editingcd") != -1)



{



new cdvid;



? ? ? ? ? ? if (IsNumeric(inputtext))



? ? ? ? {



? ? ? ? ? ? cdvid = strval(inputtext);



? ? ? ? ? ? if(CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdVehicleModel][cdvid-1])



? ? ? ? ? ? {



? ? ? ? ? ? ? ? SetPVarInt(playerid, "editingcdveh", cdvid-1);



? ? ? ? ? ? ? ? new listitems[] = "1 Edit Model\n2 Edit Cost\n3 Edit Park\n4 Delete Vehicle";



? ? ? ? ShowPlayerDialog(playerid,DIALOG_CDEDITONE,DIALOG_STYLE_LIST,"Car Dealership:", listitems,"Select","Cancel");



}



? ? ? ? }



}



else



{



? ? new listitems[] = "1 New Vehicle\n2 My Vehicles\n3 Upgrade\n4 Till";



ShowPlayerDialog(playerid,DIALOG_CDEDIT,DIALOG_STYLE_LIST,"Choose an item to continue", listitems,"Select","Cancel");



}



}



else if(dialogid == DIALOG_CDEDITONE)



{ // car dealership dialog



if(response && GetPVarInt(playerid, "editingcd") != -1 && GetPVarInt(playerid, "editingcdveh") != -1)



{



? ? ? ? ? ? if(listitem == 0) // Edit Model



{



? ? ? ? ? ? ShowPlayerDialog(playerid, DIALOG_CDEDITMODEL, DIALOG_STYLE_INPUT, "Car Dealership:", " Choose the new model id:", "Edit", "Back");



? ? ? ? }



? ? ? ? else if(listitem == 1) // Edit Cost



{



? ? ? ? ? ? ShowPlayerDialog(playerid, DIALOG_CDEDITCOST, DIALOG_STYLE_INPUT, "Car Dealership:", " Choose the new price of the car:", "Edit", "Back");



? ? ? ? }



? ? ? ? else if(listitem == 2) // Edit Park



{



PutPlayerInVehicle(playerid, CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdVehicleId][GetPVarInt(playerid, "editingcdveh")], 0);



? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD2, " Please stand where you want to park the vehicle.");



SendClientMessageEx(playerid, COLOR_GRAD2, " Once ready press the fire button.");



SetPVarInt(playerid, "editingcdvehpos", 1);



? ? ? ? }



? ? ? ? else if(listitem == 3) // Delete Vehicle



{



? ? ? ? ? ? format(string, sizeof(string), "Are you sure you want to delete this %s?\nNote: You will not get any refounds.",



GetVehicleName(CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdVehicleId][GetPVarInt(playerid, "editingcdveh")]));



? ? ? ? ShowPlayerDialog(playerid,DIALOG_CDDELVEH,DIALOG_STYLE_MSGBOX,"Warning:",string,"Ok","Cancel");



? ? ? ? }



}



else



{



? ? ? ? ? ? SavecDealerships();



? ? ? ? ? ? SetPVarInt(playerid, "editingcdveh", -1);



}



}



? ? else if(dialogid == DIALOG_CDEDITMODEL)



{ // car dealership dialog



if(response && GetPVarInt(playerid, "editingcd") != -1 && GetPVarInt(playerid, "editingcdveh") != -1)



{



new modelid, d, v;



new text_info[128];



d = GetPVarInt(playerid, "editingcd");



v = GetPVarInt(playerid, "editingcdveh");



? ? ? ? ? ? if (IsNumeric(inputtext))



? ? ? ? {



? ? ? ? ? ? modelid = strval(inputtext);



? ? ? ? ? ? if(modelid < 400 || modelid > 611) { SendClientMessageEx(playerid, COLOR_GREY, "? Vehicle Number can't be below 400 or above 611 !"); return 1; }



? ? ? ? ? ? CarDealershipInfo[d][cdVehicleModel][v] = modelid;



? ? ? ? ? ? DestroyDynamic3DTextLabel(CarDealershipInfo[d][cdVehicleLabel][v]);



? ? ? ? ? ? DestroyVehicle(CarDealershipInfo[d][cdVehicleId][v]);



? ? ? ? ? ? new carcreated;



? ? ? ? ? ? carcreated = CreateVehicleEx(CarDealershipInfo[d][cdVehicleModel][v], CarDealershipInfo[d][cdVehicleSpawnX][v], CarDealershipInfo[d][cdVehicleSpawnY][v], CarDealershipInfo[d][cdVehicleSpawnZ][v], CarDealershipInfo[d][cdVehicleSpawnAngle][v], 0, 0, 6);



? ? ? ? format(text_info, sizeof(text_info),"%s For Sale\nPrice: %d", GetVehicleName(carcreated), CarDealershipInfo[d][cdVehicleCost][v]);



? ? ? ? ? ? ? ? CarDealershipInfo[d][cdVehicleLabel][v] = CreateDynamic3DTextLabel(text_info,COLOR_LIGHTBLUE,0.0, 0.0, 0.0,8.0,INVALID_PLAYER_ID,carcreated);



? ? ? ? ? ? CarDealershipInfo[d][cdVehicleId][v] = carcreated;



? ? ? ? ? ? new listitems[] = "1 Edit Model\n2 Edit Cost\n3 Edit Park\n4 Delete Vehicle";



? ? ShowPlayerDialog(playerid,DIALOG_CDEDITONE,DIALOG_STYLE_LIST,"Car Dealership:", listitems,"Select","Cancel");



? ? SavecDealerships();



? ? ? ? }



}



else



{



? ? new listitems[] = "1 Edit Model\n2 Edit Cost\n3 Edit Park\n4 Delete Vehicle";



ShowPlayerDialog(playerid,DIALOG_CDEDITONE,DIALOG_STYLE_LIST,"Car Dealership:", listitems,"Select","Cancel");



}



}



else if(dialogid == DIALOG_CDEDITCOST)



{ // car dealership dialog



if(response && GetPVarInt(playerid, "editingcd") != -1 && GetPVarInt(playerid, "editingcdveh") != -1)



{



new price, d, v;



new text_info[128];



d = GetPVarInt(playerid, "editingcd");



v = GetPVarInt(playerid, "editingcdveh");



? ? ? ? ? ? if (IsNumeric(inputtext))



? ? ? ? {



? ? ? ? ? ? price = strval(inputtext);



? ? ? ? ? ? CarDealershipInfo[d][cdVehicleCost][v] = price;



? ? ? ? ? ? format(text_info, sizeof(text_info), "%%s For Sale\nPrice: %d", GetVehicleName(CarDealershipInfo[d][cdVehicleId][v]), CarDealershipInfo[d][cdVehicleCost][v]);



? ? ? ? ? ? UpdateDynamic3DTextLabelText(CarDealershipInfo[d][cdVehicleLabel][v], COLOR_LIGHTBLUE, text_info);



? ? ? ? ? ? new listitems[] = "1 Edit Model\n2 Edit Cost\n3 Edit Park\n4 Delete Vehicle";



? ? ShowPlayerDialog(playerid,DIALOG_CDEDITONE,DIALOG_STYLE_LIST,"Car Dealership:", listitems,"Select","Cancel");



? ? SavecDealerships();



? ? ? ? }



}



else



{



? ? new listitems[] = "1 Edit Model\n2 Edit Cost\n3 Edit Park\n4 Delete Vehicle";



ShowPlayerDialog(playerid,DIALOG_CDEDITONE,DIALOG_STYLE_LIST,"Car Dealership:", listitems,"Select","Cancel");



}



}



else if(dialogid == DIALOG_CDDELVEH)



{ // car dealership dialog



if(response && GetPVarInt(playerid, "editingcd") != -1 && GetPVarInt(playerid, "editingcdveh") != -1)



{



DestroyCarDealershipVehicle(GetPVarInt(playerid, "editingcd"), GetPVarInt(playerid, "editingcdveh"));



SavecDealerships();



}



else



{



? ? new listitems[] = "1 Edit Model\n2 Edit Cost\n3 Edit Park\n4 Delete Vehicle";



ShowPlayerDialog(playerid,DIALOG_CDEDITONE,DIALOG_STYLE_LIST,"Car Dealership:", listitems,"Select","Cancel");



}



}



//=========================================================================//



else if(dialogid == DIALOG_CDEDITPARK)



{ // car dealership dialog



if(response && GetPVarInt(playerid, "editingcd") != -1 && GetPVarInt(playerid, "editingcdveh") != -1 &&? GetPVarInt(playerid, "editingcdvehpos") == 1 || GetPVarInt(playerid, "editingcdvehnew"))



{



new Float: x, Float: y, Float: z, Float: a;



new d, v, text_info[128];



d = GetPVarInt(playerid, "editingcd");



v = GetPVarInt(playerid, "editingcdveh");



GetVehiclePos(CarDealershipInfo[d][cdVehicleId][v], x, y, z);



? ? ? ? GetVehicleZAngle(CarDealershipInfo[d][cdVehicleId][v], a);



if(IsPlayerInRangeOfPoint(playerid, CarDealershipInfo[d][cdRadius], CarDealershipInfo[d][cdEntranceX], CarDealershipInfo[d][cdEntranceY], CarDealershipInfo[d][cdEntranceZ]))



? ? {



? ? CarDealershipInfo[d][cdVehicleSpawnX][v] = x;



? ? ? ? ? ? ? ? CarDealershipInfo[d][cdVehicleSpawnY][v] = y;



? ? ? ? ? ? ? ? CarDealershipInfo[d][cdVehicleSpawnZ][v] = z;



? ? ? ? ? ? ? ? CarDealershipInfo[d][cdVehicleSpawnAngle][v] = a;



? ? ? ? ? ? ? ? SetPVarInt(playerid, "editingcdvehpos", 0);



? ? ? ? ? ? ? ? SetPVarInt(playerid, "editingcdvehnew", 0);



? ? ? ? ? ? ? ? DestroyDynamic3DTextLabel(CarDealershipInfo[d][cdVehicleLabel][v]);



? ? ? ? ? ? DestroyVehicle(CarDealershipInfo[d][cdVehicleId][v]);



? ? ? ? ? ? new carcreated;



? ? ? ? ? ? carcreated = CreateVehicleEx(CarDealershipInfo[d][cdVehicleModel][v], CarDealershipInfo[d][cdVehicleSpawnX][v], CarDealershipInfo[d][cdVehicleSpawnY][v], CarDealershipInfo[d][cdVehicleSpawnZ][v], CarDealershipInfo[d][cdVehicleSpawnAngle][v], 0, 0, 6);



? ? ? ? format(text_info, sizeof(text_info), "%s For Sale\nPrice: %d", GetVehicleName(carcreated), CarDealershipInfo[d][cdVehicleCost][v]);



? ? ? ? ? ? ? ? CarDealershipInfo[d][cdVehicleLabel][v] = CreateDynamic3DTextLabel(text_info,COLOR_LIGHTBLUE,0.0, 0.0, 0.0,8.0,INVALID_PLAYER_ID,carcreated);



? ? ? ? ? ? CarDealershipInfo[d][cdVehicleId][v] = carcreated;



? ? ? ? ? ? TogglePlayerControllable(playerid, true);



? ? ? ? ? ? new listitems[] = "1 Edit Model\n2 Edit Cost\n3 Edit Park\n4 Delete Vehicle";



? ? ShowPlayerDialog(playerid,DIALOG_CDEDITONE,DIALOG_STYLE_LIST,"Car Dealership Editor:", listitems,"Select","Cancel");



? ? SavecDealerships();



}



else



{



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You are out of this Car Dealership radius, please try again.");



? ? ? ? ? ? ? ? TogglePlayerControllable(playerid, true);



}



}



else if(response && GetPVarInt(playerid, "editingcd") != -1 && GetPVarInt(playerid, "editingcdvehpos") == 2)



{



new Float: x, Float: y, Float: z, Float: a;



new d;



GetPlayerPos(playerid,x,y,z);



? ? ? ? GetPlayerFacingAngle(playerid, a);



d = GetPVarInt(playerid, "editingcd");



if(IsPlayerInRangeOfPoint(playerid, CarDealershipInfo[d][cdRadius], CarDealershipInfo[d][cdEntranceX], CarDealershipInfo[d][cdEntranceY], CarDealershipInfo[d][cdEntranceZ]))



? ? {



? ? CarDealershipInfo[d][cdVehicleSpawn][0] = x;



? ? ? ? ? ? ? ? CarDealershipInfo[d][cdVehicleSpawn][1] = y;



? ? ? ? ? ? ? ? CarDealershipInfo[d][cdVehicleSpawn][2] = z;



? ? ? ? ? ? ? ? CarDealershipInfo[d][cdVehicleSpawn][3] = a;



? ? ? ? ? ? ? ? SetPVarInt(playerid, "editingcdvehpos", 0);



? ? ? ? ? ? TogglePlayerControllable(playerid, true);



? ? ? ? ? ? new listitems[] = "1 Vehicle Spawn\n2 Radius\n3 Dealership Name\n4 Price";



? ? ShowPlayerDialog(playerid,DIALOG_CDUPGRADE,DIALOG_STYLE_LIST,"Car Dealership Editor:", listitems,"Select","Cancel");



? ? SavecDealerships();



}



else



{



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You are out of this Car Dealership radius, please try again.");



? ? ? ? ? ? ? ? TogglePlayerControllable(playerid, true);



}



}



else if(!response && GetPVarInt(playerid, "editingcd") != -1 && GetPVarInt(playerid, "editingcdvehpos") == 1)



{



? ? ? ? ? ? new listitems[] = "1 Edit Model\n2 Edit Cost\n3 Edit Park\n4 Delete Vehicle";



ShowPlayerDialog(playerid,DIALOG_CDEDITONE,DIALOG_STYLE_LIST,"Car Dealership Editor:", listitems,"Select","Cancel");



TogglePlayerControllable(playerid, true);



SetPVarInt(playerid, "editingcdvehpos", 0);



}



else if(!response && GetPVarInt(playerid, "editingcd") != -1 && GetPVarInt(playerid, "editingcdvehpos") == 2)



{



? ? ? ? ? ? new listitems[] = "1 Vehicle Spawn\n2 Radius\n3 Dealership Name\n4 Price";



? ? ShowPlayerDialog(playerid,DIALOG_CDUPGRADE,DIALOG_STYLE_LIST,"Car Dealership Editor:", listitems,"Select","Cancel");



TogglePlayerControllable(playerid, true);



SetPVarInt(playerid, "editingcdvehpos", 0);



}



}



else if(dialogid == DIALOG_CDNEWVEH)



{ // car dealership dialog



if(response && GetPVarInt(playerid, "editingcd") != -1)



{



new modelid, d;



new Float: x, Float: y, Float: z, Float: a;



new text_info[128];



d = GetPVarInt(playerid, "editingcd");



GetPlayerPos(playerid,x,y,z);



? ? ? ? GetPlayerFacingAngle(playerid, a);



? ? ? ? if (!IsNumeric(inputtext)) return SendClientMessageEx(playerid, COLOR_GRAD1, "ERROR: Model ID must be numbers.");



? ? ? ? ? ? if (IsPlayerInRangeOfPoint(playerid, CarDealershipInfo[d][cdRadius], CarDealershipInfo[d][cdEntranceX], CarDealershipInfo[d][cdEntranceY], CarDealershipInfo[d][cdEntranceZ]))



? ? ? ? {



? ? ? ? ? ? modelid = strval(inputtext);



? ? ? ? ? ? if(modelid < 400 || modelid > 611) { SendClientMessageEx(playerid, COLOR_GREY, "? Vehicle Number can't be below 400 or above 611 !"); return 1; }



? ? ? ? ? ? new cdvehicleid = CreateCarDealershipVehicle(d, modelid, x, y, z, a, 1337);



? ? ? ? ? ? if(cdvehicleid == -1)



? ? ? ? {



? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "ERROR: Car couldn't be created.");



? ? ? ? }



? ? ? ? ? ? else



? ? ? ? ? ? {



PutPlayerInVehicle(playerid, CarDealershipInfo[d][cdVehicleId][cdvehicleid], 0);



? ? ? ? ? ? ? ? ? ? format(text_info, sizeof(text_info), " SYSTEM: Car dealership vehicle created (ID %d)", cdvehicleid-1);



? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD1, text_info);



? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD2, " Please stand where you want to add your new vehicle.");



? ? SendClientMessageEx(playerid, COLOR_GRAD2, " Once ready press the fire button.");



? ? SetPVarInt(playerid, "editingcdvehnew", 1);



? ? ? ? ? ? SetPVarInt(playerid, "editingcdveh", cdvehicleid);



? ? ? ? ? ? }



? ? ? ? }



? ? ? ? else



? ? ? ? {



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You are out of this Car Dealership radius, please try again.");



? ? ? ? ? ? ? ? TogglePlayerControllable(playerid, true);



? ? ? ? }



}



else



{



? ? ? ? ? ? TogglePlayerControllable(playerid, true);



SetPVarInt(playerid, "editingcd", -1);



}



}



else if(dialogid == DIALOG_CDBUY)



{







? ? // Account Eating Bug Fix



? ? if(!IsPlayerInAnyVehicle(playerid))



{



? ? TogglePlayerControllable(playerid, 1);



SendClientMessageEx(playerid,COLOR_GRAD2,"You need to be in the vehicle you wish to purchase.");



return 1;



}







new vehicleid = GetPlayerVehicleID(playerid);



new v = GetCarDealershipVehicleId(vehicleid);



new d = GetCarDealershipId(vehicleid);



if(response)



{



for(new b; b < MAX_PLAYERVEHICLES; b)



{



if(PlayerVehicleInfo[playerid][b][pvImpounded] == 1) {



SendClientMessageEx(playerid, COLOR_GRAD1, "ERROR: You cannot buy a new car with a impounded vehicle, you must release the car first.");



RemovePlayerFromVehicle(playerid);



new Float:slx, Float:sly, Float:slz;



GetPlayerPos(playerid, slx, sly, slz);



SetPlayerPos(playerid, slx, sly, slz.2);



TogglePlayerControllable(playerid, 1);



return 1;



}



}



? ? ? ? ? ? if(CarDealershipInfo[d][cdVehicleSpawn][0] == 0.0 && CarDealershipInfo[d][cdVehicleSpawn][1] == 0.0 && CarDealershipInfo[d][cdVehicleSpawn][2] == 0.0)



? ? ? ? ? ? {



SendClientMessageEx(playerid, COLOR_GRAD1, "ERROR: The owner of this Car Dealership hasn't set the purchased vehicles spawn point.");



RemovePlayerFromVehicle(playerid);



new Float:slx, Float:sly, Float:slz;



GetPlayerPos(playerid, slx, sly, slz);



SetPlayerPos(playerid, slx, sly, slz.2);



TogglePlayerControllable(playerid, 1);



return 1;



? ? ? ? ? ? }



? ? ? ? ? ? if(IsVIPModel(vehicleid) && (PlayerInfo[playerid][pDonateRank] == 0 || PlayerInfo[playerid][pTempVIP] > 0))



? ? ? ? ? ? {



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "ERROR: Only VIP's can own that type of vehicles.");



? ? ? ? ? ? ? ? RemovePlayerFromVehicle(playerid);



? ? ? ? ? ? ? ? new Float:slx, Float:sly, Float:slz;



GetPlayerPos(playerid, slx, sly, slz);



SetPlayerPos(playerid, slx, sly, slz.2);



? ? ? ? ? ? ? ? TogglePlayerControllable(playerid, 1);



? ? ? ? ? ? ? ? return 1;



? ? ? ? ? ? }



? ? ? ? ? ? new playervehicleid = GetPlayerFreeVehicleId(playerid);



? ? ? ? ? ? new carsamount = GetPlayerVehicleCount(playerid);



? ? ? ? ? ? if((PlayerInfo[playerid][pDonateRank] == 0 || PlayerInfo[playerid][pTempVIP] > 0) && carsamount >= 2)



{



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You can't have more cars.");



? ? ? ? ? ? ? ? RemovePlayerFromVehicle(playerid);



? ? ? ? ? ? ? ? new Float:slx, Float:sly, Float:slz;



GetPlayerPos(playerid, slx, sly, slz);



SetPlayerPos(playerid, slx, sly, slz.2);



? ? ? ? ? ? ? ? TogglePlayerControllable(playerid, 1);



? ? ? ? ? ? ? ? return 1;



}



? ? ? ? ? ? if(PlayerInfo[playerid][pDonateRank] == 1 && carsamount >= 3)



? ? ? ? ? ? {



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You can't have more cars, VIP Rank 1 can only own 1 extra car.");



? ? ? ? ? ? ? ? RemovePlayerFromVehicle(playerid);



? ? ? ? ? ? ? ? new Float:slx, Float:sly, Float:slz;



GetPlayerPos(playerid, slx, sly, slz);



SetPlayerPos(playerid, slx, sly, slz.2);



? ? ? ? ? ? ? ? TogglePlayerControllable(playerid, 1);



? ? ? ? ? ? ? ? return 1;



? ? ? ? ? ? }



? ? ? ? ? ? if(PlayerInfo[playerid][pDonateRank] == 2 && carsamount >= 4)



? ? ? ? ? ? {



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You can't have more cars, VIP Rank 2 can only own 2 extra cars.");



? ? ? ? ? ? ? ? RemovePlayerFromVehicle(playerid);



? ? ? ? ? ? ? ? new Float:slx, Float:sly, Float:slz;



GetPlayerPos(playerid, slx, sly, slz);



SetPlayerPos(playerid, slx, sly, slz.2);



? ? ? ? ? ? ? ? TogglePlayerControllable(playerid, 1);



? ? ? ? ? ? ? ? return 1;



? ? ? ? ? ? }



? ? ? ? ? ? if(PlayerInfo[playerid][pDonateRank] == 3 && carsamount >= 5)



? ? ? ? ? ? {



? ? ? ? ? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You can't have more cars, VIP Rank 3 can only own 3 extra cars.");



? ? ? ? ? ? ? ? RemovePlayerFromVehicle(playerid);



? ? ? ? ? ? ? ? new Float:slx, Float:sly, Float:slz;



GetPlayerPos(playerid, slx, sly, slz);



SetPlayerPos(playerid, slx, sly, slz.2);



? ? ? ? ? ? ? ? TogglePlayerControllable(playerid, 1);



? ? ? ? ? ? ? ? return 1;



? ? ? ? ? ? }



? ? if(playervehicleid == -1)



? ? {



? ? ? ? SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You can't have more cars.");



? ? ? ? ? ? ? ? RemovePlayerFromVehicle(playerid);



? ? ? ? ? ? ? ? new Float:slx, Float:sly, Float:slz;



GetPlayerPos(playerid, slx, sly, slz);



SetPlayerPos(playerid, slx, sly, slz.2);



? ? ? ? ? ? ? ? TogglePlayerControllable(playerid, 1);



? ? ? ? ? ? ? ? return 1;



? ? }



? ? new randcolor1 = Random(0, 126);



? ? new randcolor2 = Random(0, 126);



? ? SetPlayerPos(playerid, CarDealershipInfo[d][cdVehicleSpawn][0], CarDealershipInfo[d][cdVehicleSpawn][1], CarDealershipInfo[d][cdVehicleSpawn][2]);



? ? TogglePlayerControllable(playerid, 1);



? ? new cost;



? ? if(PlayerInfo[playerid][pDonateRank] < 1)



? ? ? ? ? ? {



? ? ? ? ? ? ? ? cost = CarDealershipInfo[d][cdVehicleCost][v];



? ? ? ? ? ? if(GetPVarInt(playerid, "Cash") < CarDealershipInfo[d][cdVehicleCost][v])



? ? ? ? ? ? {



SendClientMessageEx(playerid, COLOR_GRAD1, "ERROR: You don't have enough money to buy this.");



RemovePlayerFromVehicle(playerid);



new Float:slx, Float:sly, Float:slz;



GetPlayerPos(playerid, slx, sly, slz);



SetPlayerPos(playerid, slx, sly, slz.2);



return 1;



? ? ? ? ? ? }



? ? ? ? ? ? ? ? format(string, sizeof(string), " Thank you for buying at %s.", CarDealershipInfo[d][cdMessage]);



? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD1, string);



? ? ? ? SetPVarInt(playerid, "Cash", GetPVarInt(playerid, "Cash")-CarDealershipInfo[d][cdVehicleCost][v]);



? ? ? ? CarDealershipInfo[d][cdTill] = ( CarDealershipInfo[d][cdVehicleCost][v] * 40 ) / ( 100 );



? ? ? ? }



? ? ? ? else



? ? ? ? {



cost = ( CarDealershipInfo[d][cdVehicleCost][v] * 80 ) / ( 100 );



? ? ? ? ? ? if(GetPVarInt(playerid, "Cash") < cost)



? ? ? ? ? ? {



SendClientMessageEx(playerid, COLOR_GRAD1, "ERROR: You don't have enough money to buy this.");



RemovePlayerFromVehicle(playerid);



new Float:slx, Float:sly, Float:slz;



GetPlayerPos(playerid, slx, sly, slz);



SetPlayerPos(playerid, slx, sly, slz.2);



return 1;



? ? ? ? ? ? }







? ? ? ? ? ? ? ? format(string, sizeof(string), " Thank you for buying at %s.", CarDealershipInfo[d][cdMessage]);



? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD1, string);



? ? ? ? SetPVarInt(playerid, "Cash", GetPVarInt(playerid, "Cash") - cost );



CarDealershipInfo[d][cdTill] = cost;



? ? }



? ? ? ? ? ? new car = CreatePlayerVehicle(playerid, playervehicleid, CarDealershipInfo[d][cdVehicleModel][v], CarDealershipInfo[d][cdVehicleSpawn][0], CarDealershipInfo[d][cdVehicleSpawn][1], CarDealershipInfo[d][cdVehicleSpawn][2], CarDealershipInfo[d][cdVehicleSpawn][3], randcolor1, randcolor2, cost);



Gas[car] =100.0;



SetTimerEx("PutPlayerInVeh", 2000, 0, "dd", playerid, car);



? ? ? ? ? ? SavecDealerships();



}



else



{



? ? ? ? ? ? RemovePlayerFromVehicle(playerid);



? ? ? ? ? ? new Float:slx, Float:sly, Float:slz;



GetPlayerPos(playerid, slx, sly, slz);



SetPlayerPos(playerid, slx, sly, slz.2);



? ? ? ? ? ? TogglePlayerControllable(playerid, 1);



return 1;



}



}



else if(dialogid == DIALOG_CDSELL)



{



if(response)



{



if(GetPVarInt(playerid, "editingcd") == -1) return 1;



? ? ? ? ? ? SetPVarInt(playerid, "Cash", GetPVarInt(playerid, "Cash") (CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdPrice] / 2));



SellCarDealership(GetPVarInt(playerid, "editingcd"));



PlayerPlayMusic(playerid);



format(string, sizeof(string), "Car Dealership successfully sold for %d.", CarDealershipInfo[GetPVarInt(playerid, "editingcd")][cdPrice] / 2);



SendClientMessageEx(playerid, COLOR_WHITE, string);



}



else



{



? ? ? ? ? ? SetPVarInt(playerid, "editingcd", -1);



return 1;



}



}



//=========================================================================//



//CAR DEALERSHIP SYSTEM BY Unknown



//------------------------------------------------------------------------------



stock CreateCarDealership(Float: enx, Float: eny, Float: enz, Float: radius, price, message[])



{



new dealershipid = GetFreeCarDealership();



if(dealershipid == -1) return -1;



new text_info[128];



CarDealershipInfo[dealershipid][cdEntranceX] = enx;



CarDealershipInfo[dealershipid][cdEntranceY] = eny;



CarDealershipInfo[dealershipid][cdEntranceZ] = enz;



CarDealershipInfo[dealershipid][cdRadius] = radius;



CarDealershipInfo[dealershipid][cdPrice] = price;



strmid(CarDealershipInfo[dealershipid][cdMessage], message, 0, strlen(message), 255);



CarDealershipInfo[dealershipid][cdPickupID] = CreateDynamicPickup(1239, 1, CarDealershipInfo[dealershipid][cdEntranceX], CarDealershipInfo[dealershipid][cdEntranceY], CarDealershipInfo[dealershipid][cdEntranceZ]);



format(text_info, sizeof(text_info), "Car Dealership %s For Sale\nPrice: %d\nRadius: %.1f\nID: %d", CarDealershipInfo[dealershipid][cdMessage], CarDealershipInfo[dealershipid][cdPrice], CarDealershipInfo[dealershipid][cdRadius], dealershipid);



? ? CarDealershipInfo[dealershipid][cdTextLabel] = CreateDynamic3DTextLabel(text_info,COLOR_RED,CarDealershipInfo[dealershipid][cdEntranceX], CarDealershipInfo[dealershipid][cdEntranceY], CarDealershipInfo[dealershipid][cdEntranceZ].75,3.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,1);



? ? SavecDealerships();



? ? return dealershipid;



}



stock DestroyCarDealership(dealershipid)



{



new string[30];



CarDealershipInfo[dealershipid][cdEntranceX] = 0.0;



CarDealershipInfo[dealershipid][cdEntranceY] = 0.0;



CarDealershipInfo[dealershipid][cdEntranceZ] = 0.0;



CarDealershipInfo[dealershipid][cdRadius] = 0.0;



CarDealershipInfo[dealershipid][cdTill] = 0;



CarDealershipInfo[dealershipid][cdOwned] = 0;



CarDealershipInfo[dealershipid][cdPrice] = 0;



format(string, sizeof(string), "None");



strmid(CarDealershipInfo[dealershipid][cdOwner], string, 0, strlen(string), 255);



format(string, sizeof(string), "None");



strmid(CarDealershipInfo[dealershipid][cdMessage], string, 0, strlen(string), 255);



DestroyDynamic3DTextLabel(CarDealershipInfo[dealershipid][cdTextLabel]);



DestroyDynamicPickup(CarDealershipInfo[dealershipid][cdPickupID]);



CarDealershipInfo[dealershipid][cdPickupID] = 0;



CarDealershipInfo[dealershipid][cdTextLabel] = Text3D:INVALID_3DTEXT_ID;



CarDealershipInfo[dealershipid][cdVehicleSpawn][0] = 0.0;



? ? CarDealershipInfo[dealershipid][cdVehicleSpawn][1] = 0.0;



? ? CarDealershipInfo[dealershipid][cdVehicleSpawn][2] = 0.0;



? ? CarDealershipInfo[dealershipid][cdVehicleSpawn][3] = 0.0;



for(new v = 0; v < MAX_DEALERSHIPVEHICLES; v)



{



if (CarDealershipInfo[dealershipid][cdVehicleModel][v] != 0)



{



? ? ? ? DestroyCarDealershipVehicle(dealershipid, v);



}



}



SavecDealerships();



}



stock GetFreeCarDealership()



{



? ? new



i = 0;



while (i < MAX_CARDEALERSHIPS && CarDealershipInfo[i][cdEntranceX] != 0.0 && CarDealershipInfo[i][cdEntranceY] != 0.0)



{



i;



}



if (i == MAX_CARDEALERSHIPS) return -1;



return i;







}



stock SetPlayerOwnerOfCD(playerid, dealershipid)



{



new owner[MAX_PLAYER_NAME];



CarDealershipInfo[dealershipid][cdOwned] = 1;



GetPlayerName(playerid, owner, sizeof(owner));



strmid(CarDealershipInfo[dealershipid][cdOwner], owner, 0, strlen(owner), 255);



new text_info[128];



format(text_info, sizeof(text_info), "Car Dealership %s\nOwner: %s\nRadius: %.1f\nID: %d", CarDealershipInfo[dealershipid][cdMessage], CarDealershipInfo[dealershipid][cdOwner], CarDealershipInfo[dealershipid][cdRadius], dealershipid);



UpdateDynamic3DTextLabelText(CarDealershipInfo[dealershipid][cdTextLabel], COLOR_GREEN, text_info);



SavecDealerships();



}



stock SellCarDealership(dealershipid)



{



CarDealershipInfo[dealershipid][cdOwned] = 0;



CarDealershipInfo[dealershipid][cdVehicleSpawn][0] = 0.0;



CarDealershipInfo[dealershipid][cdVehicleSpawn][1] = 0.0;



CarDealershipInfo[dealershipid][cdVehicleSpawn][2] = 0.0;



CarDealershipInfo[dealershipid][cdVehicleSpawn][3] = 0.0;



strmid(CarDealershipInfo[dealershipid][cdOwner], "No-one", 0, MAX_PLAYER_NAME, 255);



new text_info[128];



format(text_info, sizeof(text_info), "Car Dealership %s For Sale\nPrice: %d\nRadius: %.1f\nID: %d", CarDealershipInfo[dealershipid][cdMessage], CarDealershipInfo[dealershipid][cdPrice], CarDealershipInfo[dealershipid][cdRadius], dealershipid);



UpdateDynamic3DTextLabelText(CarDealershipInfo[dealershipid][cdTextLabel], COLOR_RED, text_info);



SavecDealerships();



}



stock IsPlayerOwnerOfCD(playerid)



{



new owner[MAX_PLAYER_NAME];



GetPlayerName(playerid, owner, sizeof(owner));



for(new d = 0; d < MAX_CARDEALERSHIPS; d)



? ? {



? ? if(strcmp(CarDealershipInfo[d][cdOwner],owner, true ) == 0)



? ? {



return d;



}



}



return -1;



}



stock IsPlayerOwnerOfCDEx(playerid, dealershipid)



{



new owner[MAX_PLAYER_NAME];



GetPlayerName(playerid, owner, sizeof(owner));



if(strcmp(CarDealershipInfo[dealershipid][cdOwner],owner, true ) == 0)



{



? ? return 1;



}



return 0;



}



stock CreateCarDealershipVehicle(dealershipid, modelid, Float: x, Float: y, Float: z, Float: a, price)



{



? ? new cdvehicleid = GetFreeCarDealershipVehicleId(dealershipid);



? ? if(cdvehicleid == -1) return -1;



? ? new text_info[128];



? ? CarDealershipInfo[dealershipid][cdVehicleModel][cdvehicleid] = modelid;



? ? CarDealershipInfo[dealershipid][cdVehicleCost][cdvehicleid] = price;



? ? CarDealershipInfo[dealershipid][cdVehicleSpawnX][cdvehicleid] = x;



? ? CarDealershipInfo[dealershipid][cdVehicleSpawnY][cdvehicleid] = y;



? ? CarDealershipInfo[dealershipid][cdVehicleSpawnZ][cdvehicleid] = z;



? ? CarDealershipInfo[dealershipid][cdVehicleSpawnAngle][cdvehicleid] = a;



? ? new carcreated = CreateVehicleEx(modelid, x, y, z, a, 0, 0, 6);



? ? format(text_info, sizeof(text_info), "%s For Sale\nPrice: %d\nID: %d", GetVehicleName(carcreated), CarDealershipInfo[dealershipid][cdVehicleCost][cdvehicleid], cdvehicleid);



? ? CarDealershipInfo[dealershipid][cdVehicleLabel][cdvehicleid] = CreateDynamic3DTextLabel(text_info,COLOR_LIGHTBLUE,0.0, 0.0, 0.0,5.0,INVALID_PLAYER_ID,carcreated,1);



CarDealershipInfo[dealershipid][cdVehicleId][cdvehicleid] = carcreated;



SavecDealerships();



? ? return cdvehicleid;



}



stock DestroyCarDealershipVehicle(dealershipid, cdvehicleid)



{



? ? CarDealershipInfo[dealershipid][cdVehicleModel][cdvehicleid] = 0;



? ? CarDealershipInfo[dealershipid][cdVehicleCost][cdvehicleid] = 0;



? ? CarDealershipInfo[dealershipid][cdVehicleSpawnX][cdvehicleid] = 0.0;



? ? CarDealershipInfo[dealershipid][cdVehicleSpawnY][cdvehicleid] = 0.0;



? ? CarDealershipInfo[dealershipid][cdVehicleSpawnZ][cdvehicleid] = 0.0;



? ? CarDealershipInfo[dealershipid][cdVehicleSpawnAngle][cdvehicleid] = 0.0;



? ? DestroyDynamic3DTextLabel(CarDealershipInfo[dealershipid][cdVehicleLabel][cdvehicleid]);



? ? DestroyVehicle(CarDealershipInfo[dealershipid][cdVehicleId][cdvehicleid]);



? ? CarDealershipInfo[dealershipid][cdVehicleLabel][cdvehicleid] = Text3D:INVALID_3DTEXT_ID;



? ? CarDealershipInfo[dealershipid][cdVehicleId][cdvehicleid] = 0;



}



stock GetFreeCarDealershipVehicleId(dealershipid)



{



? ? new



i = 0;



while (i < MAX_DEALERSHIPVEHICLES && CarDealershipInfo[dealershipid][cdVehicleModel][i] != 0)



{



i;



}



if (i == MAX_DEALERSHIPVEHICLES) return -1;



return i;







}



stock GetCarDealershipVehicleId(vehicleid)



{



? ? for(new d = 0; d < MAX_CARDEALERSHIPS; d)



? ? {



? ? ? ? for(new v = 0; v < MAX_DEALERSHIPVEHICLES; v)



? ? ? ? {



? ? ? ? ? ? if(CarDealershipInfo[d][cdVehicleId][v] == vehicleid)



? ? ? ? ? ? {



? ? ? ? ? ? ? ? return v;



? ? ? ? ? ? }



}



? ? }



? ? return -1;



}



stock GetCarDealershipId(vehicleid)



{



? ? for(new d = 0; d < MAX_CARDEALERSHIPS; d)



? ? {



? ? ? ? for(new v = 0; v < MAX_DEALERSHIPVEHICLES; v)



? ? ? ? {



? ? ? ? ? ? if(CarDealershipInfo[d][cdVehicleId][v] == vehicleid)



? ? ? ? ? ? {



? ? ? ? ? ? ? ? return d;



? ? ? ? ? ? }



}



? ? }



? ? return -1;



}







//=========================================================================//


  Colour Embedding Issue
Posted by: Torque - 2021-01-21, 11:14 PM - Forum: Support - Replies (3)

It seems that there's a bug with colour embedding, whether it be dialogs or chat text.



It seems the colour is "leaking" into the next word in which a colour has already been set for.



[Image: unknown.png]