Jump to content
  • 0

Vehicule Personale


Spongibubu

Question

Salutare! Intâmpin o problema la comanda /v. Când scriu /v îmi spune SERVER: Unknown command.

Ce aș putea face?

Aveți aici codul:

CMD:v(playerid, params[]) { 
	ShowPlayerVehicle(playerid);
	return 1;
}

stock ShowPlayerVehicle(playerid) {
	new szTitle[180], szDialog[1300], szDialog2[1300], vstatus[1024];
	if(GetVehicles(playerid) == 0) return SendClientMessage(playerid, COLOR_GREY, "You don't own any vehicles.");	
	format(szTitle, sizeof(szTitle), "Vehicles (%d/4)", GetVehicles(playerid));			
	for(new i = 0; i < 5; i++) {
		if(PlayerInfo[playerid][pCarKey][i] != 0) {
			new car =  PlayerInfo[playerid][pCarKey][i];
			if(IsVehicleOccupied(CarInfo[car][cSpawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
			else if(CarInfo[car][cSpawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
			else format(vstatus, sizeof(vstatus), "{FF0000}(Despawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
			format(szDialog, sizeof(szDialog), "%s\n", vstatus);
			strcat(szDialog2, szDialog);
		}
		ShowPlayerDialog(playerid, DIALOG_GARAGE, DIALOG_STYLE_LIST, szTitle, szDialog2, "Ok", "Exit");
	}
	return 1;
}

O zi frumoasă vă doresc! ?

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

Baga crashdetect porneste serveru scrie comanda sa iti dea iar acea eroare si arata noul server log, problema asta o face doar contului tau sa la toata lumea? E posibil ca variabila playerului din baza de date "Carkey1" 2 sau 3 sau cat ai, acel id sa nu fie in tabelul "vehicles"

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
[debug] Run time error 4: "Array index out of bounds"
[debug]  Attempted to read/write array element at index 2 in array of size 2
[debug] AMX backtrace:
[debug] #0 00061304 in public OnLogin (0) from gm.amx
[debug] Run time error 4: "Array index out of bounds"
[debug]  Attempted to read/write array element at negative index -400
[debug] AMX backtrace:
[debug] #0 00069ecc in ?? (0) from gm.amx
[debug] #1 0004c524 in public cmd_v (0, 18849172) from gm.amx
[debug] #2 native CallLocalFunction () from samp-server.exe
[debug] #3 00000564 in public OnPlayerCommandText (0, 18849160) from gm.amx

Am vazut ce spune si e ciudat, deoarece ar trebui sa mearga. Voi schimba pCarKey[4] cu pCarKey1 etc.

Edited by Spongibubu
Link to comment
Share on other sites

  • 0
La 28.04.2018 la 16:02, Spongibubu a spus:

Salutare! Intâmpin o problema la comanda /v. Când scriu /v îmi spune SERVER: Unknown command.

Ce aș putea face?

Aveți aici codul:


CMD:v(playerid, params[]) { 
	ShowPlayerVehicle(playerid);
	return 1;
}

stock ShowPlayerVehicle(playerid) {
	new szTitle[180], szDialog[1300], szDialog2[1300], vstatus[1024];
	if(GetVehicles(playerid) == 0) return SendClientMessage(playerid, COLOR_GREY, "You don't own any vehicles.");	
	format(szTitle, sizeof(szTitle), "Vehicles (%d/4)", GetVehicles(playerid));			
	for(new i = 0; i < 5; i++) {
		if(PlayerInfo[playerid][pCarKey][i] != 0) {
			new car =  PlayerInfo[playerid][pCarKey][i];
			if(IsVehicleOccupied(CarInfo[car][cSpawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
			else if(CarInfo[car][cSpawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
			else format(vstatus, sizeof(vstatus), "{FF0000}(Despawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
			format(szDialog, sizeof(szDialog), "%s\n", vstatus);
			strcat(szDialog2, szDialog);
		}
		ShowPlayerDialog(playerid, DIALOG_GARAGE, DIALOG_STYLE_LIST, szTitle, szDialog2, "Ok", "Exit");
	}
	return 1;
}

O zi frumoasă vă doresc! ?

Inlocuieste if(PlayerInfo[playerid][pCarKey][i] != 0) cu

if(PlayerInfo[playerid][pCarKey][i] >0) sau

if(PlayerInfo[playerid][pCarKey][i] != -1)

Link to comment
Share on other sites

  • 0
Acum 4 ore, Spongibubu a spus:

Tot nu merge.

CMD:v(playerid, params[]) { 
	ShowPlayerVehicle(playerid);
	return 1;
}

stock ShowPlayerVehicle(playerid) {
	new szTitle[180], szDialog[1300], szDialog2[1300], vstatus[1024];
	if(GetVehicles(playerid) == 0) return SendClientMessage(playerid, COLOR_GREY, "You don't own any vehicles.");	
	format(szTitle, sizeof(szTitle), "Vehicles (%d/4)", GetVehicles(playerid));			
	for(new i = 0; i < 5; i++) {
		if(PlayerInfo[playerid][pCarKey][i] > 0) {
			new car =  PlayerInfo[playerid][pCarKey][i];
			if(IsVehicleOccupied(CarInfo[car][cSpawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
			else if(CarInfo[car][cSpawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
			else format(vstatus, sizeof(vstatus), "{FF0000}(Despawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
			format(szDialog, sizeof(szDialog), "%s\n", vstatus);
			strcat(szDialog2, szDialog);
		}
		ShowPlayerDialog(playerid, DIALOG_GARAGE, DIALOG_STYLE_LIST, szTitle, szDialog2, "Ok", "Exit");
	}
	return 1;
}

Daca nu merge ce erori ai in consola cu codul modificat?

Link to comment
Share on other sites

  • 0
17 hours ago, valivaly96 said:

CMD:v(playerid, params[]) { 
	ShowPlayerVehicle(playerid);
	return 1;
}

stock ShowPlayerVehicle(playerid) {
	new szTitle[180], szDialog[1300], szDialog2[1300], vstatus[1024];
	if(GetVehicles(playerid) == 0) return SendClientMessage(playerid, COLOR_GREY, "You don't own any vehicles.");	
	format(szTitle, sizeof(szTitle), "Vehicles (%d/4)", GetVehicles(playerid));			
	for(new i = 0; i < 5; i++) {
		if(PlayerInfo[playerid][pCarKey][i] > 0) {
			new car =  PlayerInfo[playerid][pCarKey][i];
			if(IsVehicleOccupied(CarInfo[car][cSpawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
			else if(CarInfo[car][cSpawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
			else format(vstatus, sizeof(vstatus), "{FF0000}(Despawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
			format(szDialog, sizeof(szDialog), "%s\n", vstatus);
			strcat(szDialog2, szDialog);
		}
		ShowPlayerDialog(playerid, DIALOG_GARAGE, DIALOG_STYLE_LIST, szTitle, szDialog2, "Ok", "Exit");
	}
	return 1;
}

Daca nu merge ce erori ai in consola cu codul modificat?

[debug] Run time error 4: "Array index out of bounds"
[debug]  Attempted to read/write array element at index 2 in array of size 2
[debug] AMX backtrace:
[debug] #0 00062188 in public OnLogin (0) from gm.amx
[debug] Run time error 4: "Array index out of bounds"
[debug]  Attempted to read/write array element at negative index -400
[debug] AMX backtrace:
[debug] #0 0006ab60 in ?? (0) from gm.amx
[debug] #1 0004d5e8 in public cmd_v (0, 18800116) from gm.amx
[debug] #2 native CallLocalFunction () from samp-server.exe
[debug] #3 00000564 in public OnPlayerCommandText (0, 18800104) from gm.amx

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.