choose a race from the dialog and start it
#1

Hello all.I have a problem.

I want: I want choose a race from the race's dialog and start it, i wrote this in a filterscript but when i choose a race and the race is start but with other coordinates and not what i choosen.

(sorry for bad english)

the script:

Код:
#define FILTERSCRIPT
#include <a_samp>

#define DIALOG_RACES    1024

enum Racesi
{
    Starti[64],
    Endl[64],
    Float:startx,
    Float:starty,
    Float:startz,
    Float:endx,
    Float:endy,
    Float:endz
}
new Races[][Racesi] =
{
	{"Verseny1 Start","Verseny1 Vйge", 4118.9805,-1304.5021,11.0081, 2524.2917,2819.3291,10.8203},
	{"Verseny2 Start","Verseny2 Vйge", 4739.9312,-2368.0493,10.8731, 1066.2122,1241.1855,10.8275},
	{"Verseny3 Start","Verseny3 Vйge", 2524.2917,2819.3291,10.8203, -576.1246,-545.7786,25.5234},
	{"Verseny4 Start","Verseny4 Vйge", 1728.2246,977.7601,10.8203, 2338.1992,73.0833,26.4786},
	{"Verseny5 Start","Verseny5 Vйge", 2728.2246,977.7601,10.8203, -309.1451,1194.3457,19.7422}
};

public OnPlayerCommandText(playerid, cmdtext[]) {
	if(!strcmp(cmdtext, "/races")) {
	    new bool:voltmar[128] = {false, ...}, string[1024], rand;
		for(new x; x < 3; x++) {
start_:
		    rand = random(sizeof(Races));

		    if(voltmar[rand] == true) goto start_;

		    voltmar[rand] = true;

		    format(string, sizeof(string), "%s%s - %s\n", string, Races[rand][Starti], Races[rand][Endl]);
		}

		ShowPlayerDialog(playerid, DIALOG_RACES, DIALOG_STYLE_LIST, "Vбlassz a veresenyek kцzьl!", string, "Tovбbb", "Mйgse");
	    return 1;
	}
	return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
	if(dialogid == DIALOG_RACES && response) {
	    new line[256], id = -1;
		for(new x; x < sizeof(Races); x++) {
		    format(line, sizeof(line), "%s - %s", Races[x][Starti], Races[x][Endl]);
		    if(!strcmp(inputtext, line)) {
		        id = x;
		        break;
		    }
		}

		if(id == -1) print("Error");
		else {
		    RaceIndit(playerid, Races[id][startx], Races[id][starty], Races[id][startz], Races[id][endx], Races[id][endy], Races[id][endz]);
		}
	}
	return 1;
}
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/races"))
    {
        new string[sizeof (Races) + 45];
        for(new x; x < sizeof (Races); x++) format(string, sizeof(string), "%s%s - %s\n", string, Races[x][Starti], Races[x][Endl]);
        ShowPlayerDialog(playerid, DIALOG_RACES, DIALOG_STYLE_LIST, "Vбlassz a veresenyek kцzьl!", string, "Tovбbb", "Mйgse");
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_RACES && response)
    {
        RaceIndit(playerid, Races[listitem][startx], Races[listitem][starty], Races[listitem][startz], Races[listitem][endx], Races[listitem][endy], Races[listitem][endz]);
    }
    return 1;
}
Reply
#3

How can i do that if i want put races the dialog with random?

Код:
new rand = random(sizeof(Races));
Reply
#4

somebody can help me?
Reply
#5

please help me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)