Jump to content

Recommended Posts

Posted

Salutt, ma poate ajuta cinva?

Deci, fac un dialog, iese cam asa: 

Citat

CMD:GetVeh(playerid

ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "{ff9500}GetVeh", "Infernus\nSultan " , "Ok", "");

return 1; 

Si acm vreau cand dau Pe Infernus sau sultan sa il spawneze la mine. Cum fac?????????????????????????

Posted (edited)

Te folosești de callback-ul „OnDialogResponse”.

Exemplu de cod:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
	if(dialogid == DIALOG_GETVEH) {// sau 1, cum ai tu definit ID-ul dialog-ului.
		if(response) {
				new Float:pPos[4];
				GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
				GetPlayerFacingAngle(playerid, pPos[3]);
			switch(listitem) {				
				case 0: CreateVehicle(411, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, 0, 0);
				case 1: CreateVehicle(560, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, 0, 0);
			}
		}
		return 1;
	}
	return 0;
}

Cam așa trebuie să arate codul tău.

Edited by matei_
Posted

Imi da erorile astea;

Citat

C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(54) : warning 202: number of arguments does not match definition
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(50) : warning 204: symbol is assigned a value that is never used: "gActor"
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(304) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(304) : warning 221: label name "Float" shadows tag name
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(304) : error 017: undefined symbol "pX"
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(304) : warning 221: label name "Float" shadows tag name
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(304) : error 017: undefined symbol "pY"
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(304) : fatal error 107: too many error messages on one line

Compilation aborted.[Finished in 0.5s with exit code 1]
[cmd: ['pawncc.exe', '-i includes', 'C:\\Users\\h\\Desktop\\un nou inceput\\gamemodes\\TutorialGM.pwn', '-;+']]

 

Posted
Acum 1 minut, IosifR a spus:

Imi da erorile astea;

 

Pune aici liniile unde ai erorile.

Posted

aici

Citat

                new Float: pX, Float: pY, Float: pZ, pR;

 

Posted
Acum 5 minute, IosifR a spus:

aici

 

new Float: pX, Float: pY, Float: pZ, Float: pR;

CMD:getveh(playerid, params[]) {
   ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "{FF9500}Get Vehicle", "Infernus\nSultan", "Spawn", "");
   return 1;
}

Asa trebuie sa arate si comanda ta.

Posted (edited)
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
	if(dialogid == DIALOG_GETVEH) {// sau 1, cum ai tu definit ID-ul dialog-ului.
		if(response) {
				new Float:pPos[4];
				GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
				GetPlayerFacingAngle(playerid, pPos[3]);
			switch(listitem) {				
				case 0: CreateVehicle(411, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, 0, 0);
				case 1: CreateVehicle(560, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, 0, 0);
			}
		}
		return 1;
	}
	return 0;
}

Incearca asa, la `OnDialogResponse`.

Edited by matei_
Posted
Citat

C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(304) : warning 221: label name "Float" shadows tag name
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(304) : error 017: undefined symbol "pPos"
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(304) : warning 215: expression has no effect
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(304) : error 001: expected token: ";", but found "]"
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(304) : fatal error 107: too many error messages on one line

la linia:

Citat

new Float:pPos[3];

 

Posted (edited)
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
	if(dialogid == DIALOG_GETVEH) {// sau 1, cum ai tu definit ID-ul dialog-ului.
		if(response) {
				new Float:pPos[4];
				GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
				GetPlayerFacingAngle(playerid, pPos[3]);
			switch(listitem) {				
				case 0: CreateVehicle(411, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, 0, 0);
				case 1: CreateVehicle(560, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, 0, 0);
			}
		}
		return 1;
	}
	return 0;
}

Greseala mea, scuze. Acum trebuie sa mearga.

Edited by matei_
Posted (edited)
Citat

C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(305) : error 032: array index out of bounds (variable "pPos")

C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(307) : error 032: array index out of bounds (variable "pPos")
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(308) : error 032: array index out of bounds (variable "pPos")
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(315) : error 010: invalid function or declaration

Linia 305:

Citat

    GetPlayerFacingAngle(playerid, pPos[3]);

 

Linia 307:

Citat

case 0: CreateVehicle(411, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, 0, 0);

Linia 308:

Citat

  case 1: CreateVehicle(560, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, 0, 0);

Linia: 315

Citat

return  1;

pfffffffffffffffffffffffff

Scuze daca te stresez 😐

Edited by IosifR
Posted

C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(54) : warning 202: number of arguments does not match definition
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(50) : warning 204: symbol is assigned a value that is never used: "gActor"
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(306) : warning 217: loose indentation
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(315) : error 010: invalid function or declaration
C:\Users\h\Desktop\un nou inceput\gamemodes\TutorialGM.pwn(482) : warning 203: symbol is never used: "InitFly"
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

Posted
Acum 31 minute, IosifR a spus:

Tuto.png

Bro, sterge ultimul return 1; cu tot cu acolada aia.

Posted

Nu imi spawneaza masina

Dau /getveh dau Infernus sau Sultan si nu se intampla nimic

Posted
case 0: CreateVehicle(411, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, -1, 0);
case 1: CreateVehicle(560, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, -1, 0);

S-ar putea sa fie din cauza valorii 0 pe care am pus-o la respawn_delay... Incearca cu -1, cum ti-am dat mai sus.

Posted

Am rezolvat =D

Dar, totusi, este o problema. Cum fac ?

Daca am spawnat o masina, sa nu o mai pot spawna inca o data

  • 2 weeks later...
Posted (edited)
On 1/26/2021 at 5:19 PM, IosifR said:

Am rezolvat =D

Dar, totusi, este o problema. Cum fac ?

Daca am spawnat o masina, sa nu o mai pot spawna inca o data

 

1. mergi pe sub toate include urile  si pune asta new playerSpawned[MAX_PLAYERS]

2. mergi la linia public OnPlayerConnect(playerid) {
si pune public playerVehicle[playerid] = -1;

3. mergi la linia public OnPlayerDisconnect(playerid, reason)

si pune if(playerSpawned[playerid] != -1) playerSpawned[playerid] != -1;

4.  aici unde ai pus 

case 0: CreateVehicle(411, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, -1, 0);
case 1: CreateVehicle(560, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, -1, 0);

  

pui asa

 


case 0: {
   CreateVehicle(411, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, -1, 0);
   playerSpawned[playerid] = 1;
}
case 1: {
   CreateVehicle(560, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, -1, 0);
playerSpawned[playerid] = 1; 
}
 

5.  la comanda asta CMD:GetVeh(playerid) {

pui CMD:GetVeh(playerid) {

  if(playerSpawned[playerid] == 1) return SendPlayerMessage(playerid, -1, "ai deja o masina spawnata!");

 

Edited by Sebi wepos
Posted
Acum 10 minute, Sebi wepos a spus:

 

1. mergi pe sub toate include urile  si pune asta new playerSpawned[MAX_PLAYERS]

2. mergi la linia public OnPlayerConnect(playerid) {
si pune public playerVehicle[playerid] = -1;

3. mergi la linia public OnPlayerDisconnect(playerid, reason)

si pune if(playerSpawned[playerid] != -1) playerSpawned[playerid] != -1;

4.  aici unde ai pus 


case 0: CreateVehicle(411, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, -1, 0);
case 1: CreateVehicle(560, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, -1, 0);

  

pui asa

 


case 0: {
   CreateVehicle(411, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, -1, 0);
   playerSpawned[playerid] = 1;
}
case 1: {
   CreateVehicle(560, pPos[0], pPos[1], pPos[2] + 5.0, pPos[3], 1, 1, -1, 0);
playerSpawned[playerid] = 1; 
}
 

5.  la comanda asta CMD:GetVeh(playerid) {

pui CMD:GetVeh(playerid) {

  if(playerSpawned[playerid] == 1) return SendPlayerMessage(playerid, -1, "ai deja o masina spawnata!");

 

Am rezolvat problema asta. Mulțumesc oricum!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.