Jump to content

Cerere Tutorial


IosifR

Recommended Posts

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?????????????????????????

Link to comment
Share on other sites

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_
Link to comment
Share on other sites

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', '-;+']]

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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_
Link to comment
Share on other sites

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];

 

Link to comment
Share on other sites

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_
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 weeks later...
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
Link to comment
Share on other sites

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!

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
Reply to this topic...

×   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.