question
#1

Код:
CMD:rentvehicle(playerid, params[])
{
	new vehicleid, string[256], string2[256], id;
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
	if(PlayerInfo[playerid][pCash] < 30000) return SendClientMessage(playerid, COLOR_WHITE, "Nu ai suma necesara de bani. (30.000$)");
	if(IsPlayerInVehicle(playerid, vehicleid)) return SendClientMessage(playerid, COLOR_WHITE, "Nu poti inchiria un vehicul atat timp cat tu te afli intr-o masina.");
	if(!IsPlayerInRangeOfPoint(playerid, 10.0, -2240.7644,539.0970,35.1488)) return SendClientMessage(playerid, COLOR_WHITE, "Nu te afli in locatia corecta.");
	strcat(string2, "Vehicle\tIn Stock\n");
	format(string, sizeof(string), "%s\t30\n", VehiculeRent(id);
	strcat(string, string2);
	
	ShowPlayerDialog(playerid, DIALOG_RENTCAR, DIALOG_STYLE_TABLIST_HEADERS, "RentCar", string2, "Select", "Cancel");

	return 1;
}
Код:
stock VehiculeRent(id){
	new string[256];
	switch(id){
		case 0: string = "Infernus";
		case 1: string = "Sultan";
		case 2: string = "Bravura";
		case 3: string = "Perenial";
	}
	return string;
}
Ok so i created those, my dialog looks like this:
https://imgur.com/a/IoPGrWV

and i want it look like this:
https://imgur.com/a/WRMduxX

how can i do this? is the stock needed here?
Reply
#2

make it like this-
new dialog[500];
strcat(string2, "Vehicle\tIn Stock\n"); // delete this
rmat(string, sizeof(string), "Vehicle\tIn Stock\n\n%s\t30\n", VehiculeRent(id);
strcat(string, dialog);

ShowPlayerDialog(playerid, DIALOG_RENTCAR, DIALOG_STYLE_TABLIST_HEADERS, "RentCar", dialog, "Select", "Cancel");

Hope it works, rep++ if it will help you.
Reply
#3

Код:
CMD:rentvehicle(playerid, params[])
{
	new vehicleid, string[256], string2[256], dialog[500], id;
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
	if(PlayerInfo[playerid][pCash] < 30000) return SendClientMessage(playerid, COLOR_WHITE, "Nu ai suma necesara de bani. (30.000$)");
	if(IsPlayerInVehicle(playerid, vehicleid)) return SendClientMessage(playerid, COLOR_WHITE, "Nu poti inchiria un vehicul atat timp cat tu te afli intr-o masina.");
	if(!IsPlayerInRangeOfPoint(playerid, 10.0, -2240.7644,539.0970,35.1488)) return SendClientMessage(playerid, COLOR_WHITE, "Nu te afli in locatia corecta.");
	format(string, sizeof(string), "Vehicle\tIn Stock\n\n%s\t30\n", VehiculeRent(id);
	strcat(string, dialog);
	
	ShowPlayerDialog(playerid, DIALOG_RENTCAR, DIALOG_STYLE_TABLIST_HEADERS, "RentCar", string2, "Select", "Cancel");

	return 1;
}
D:\server\gamemodes\ExtremeGame.pwn(2557 : error 001: expected token: ",", but found ";"

FIXED, FORGOT A )
COMING BACK WITH THE ANSWER IF HELPED OR NOT
Reply
#4

Quote:
Originally Posted by TadePoleMG
Посмотреть сообщение
make it like this-
new dialog[500];
strcat(string2, "Vehicle\tIn Stock\n"); // delete this
rmat(string, sizeof(string), "Vehicle\tIn Stock\n\n%s\t30\n", VehiculeRent(id);
strcat(string, dialog);

ShowPlayerDialog(playerid, DIALOG_RENTCAR, DIALOG_STYLE_TABLIST_HEADERS, "RentCar", dialog, "Select", "Cancel");

Hope it works, rep++ if it will help you.
after the modifies, the dialog doesnt show anymore
Reply
#5

here you go!
PHP код:
CMD:rentvehicle(playeridparams[])
{
    new 
vehicleidstring[256], string2[256], id;
    if(
gPlayerLogged[playerid] == 0) return SendClientMessage(playeridCOLOR_LIGHTRED"You need to log in first.");
    if(
PlayerInfo[playerid][pCash] < 30000) return SendClientMessage(playeridCOLOR_WHITE"Nu ai suma necesara de bani. (30.000$)");
    if(
IsPlayerInVehicle(playeridvehicleid)) return SendClientMessage(playeridCOLOR_WHITE"Nu poti inchiria un vehicul atat timp cat tu te afli intr-o masina.");
    if(!
IsPlayerInRangeOfPoint(playerid10.0, -2240.7644,539.0970,35.1488)) return SendClientMessage(playeridCOLOR_WHITE"Nu te afli in locatia corecta.");
    
strcat(string2"Vehicle\tIn Stock\n");
    
format(stringsizeof(string), "%s\t30\n"VehiculeRent(id);
    
//strcat(string, string2);
    
strcat(string2string);
    
    
ShowPlayerDialog(playeridDIALOG_RENTCARDIALOG_STYLE_TABLIST_HEADERS"RentCar"string2"Select""Cancel");
    return 
1;

and yes
You can do it in more simpler way like
PHP код:
new arrVehiculeRent[] = 
{
    {
"Infernus"411},
    {
"Sultan"560},
    {
"Bravura"x}, //replace x with its vehicle id
    
{"Perenial"y//replace y with vehicle id
}; 
and then using it in a loop like
PHP код:
CMD:rentvehicle(playeridparams[])
{
    new 
vehicleidstring[256], string2[256], id;
    if(
gPlayerLogged[playerid] == 0) return SendClientMessage(playeridCOLOR_LIGHTRED"You need to log in first.");
    if(
PlayerInfo[playerid][pCash] < 30000) return SendClientMessage(playeridCOLOR_WHITE"Nu ai suma necesara de bani. (30.000$)");
    if(
IsPlayerInVehicle(playeridvehicleid)) return SendClientMessage(playeridCOLOR_WHITE"Nu poti inchiria un vehicul atat timp cat tu te afli intr-o masina.");
    if(!
IsPlayerInRangeOfPoint(playerid10.0, -2240.7644,539.0970,35.1488)) return SendClientMessage(playeridCOLOR_WHITE"Nu te afli in locatia corecta.");
    
strcat(string2"Vehicle\tIn Stock\n");
    for(new 
0sizeof arrVehiculeRenti++)
    {
        
format(stringsizeof(string), "%s\t30\n"VehiculeRent[i][0];
        
strcat(string2string);
    }
    
    
ShowPlayerDialog(playeridDIALOG_RENTCARDIALOG_STYLE_TABLIST_HEADERS"RentCar"string2"Select""Cancel");
    return 
1;

and in the dialog you can get it like this
PHP код:
 if(dialogid == DIALOG_RENTCAR)
{
    if(
response)
    {
        
//You can spawn a new vehicle here by simply getting the listitem such as
        //CreateVehicle(VehiculeRent[listitem][1], ......);
    
}

Reply
#6

Ok i fix it try this-

PHP код:
new dialog[1000], str[128];
format(str,128,"Vehicle\t In Stick\n");
strcat(dialog,str);
format(str,128,"%s\t 30\n",VehicleRent(id));
strcat(dialog,str);
ShowPlayerDialog(playerid,DIALOG_RENTCAR,DIALOG_STYLE_TABLIST_HEADERS,"RentCar",dialog,"Select","Cancel"); 
Hope this will work fine

Sorry for wrong script above
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)