[Pedido] Pasar cуdigo a compra.
#1

Buenas noches/dнas.

Querнa saber si alguien podrнa hacerme el favor de ayudarme a pasar este cуdigo de Lбser, a mйtodo de compra, es decir, que el Objeto se pueda comprar en una tienda, y no usar simplemente en un Comando para obtenerlo.

Por si no me hago entender, es por ejemplo, al comprar una "bebida" en un 24/7, entonces en vez de esto, comprar el lбser, y poder usar sus comandos al tenerlo.

Clickeame para descargar el Filterscript de Laser. (Este es el FS, abajo dejo el cуdigo de compra de ejemplo que uso)

• Este es el cуdigo de compra que usa la GM: (Si falta algo, me lo hacen saber, para detallar mas)

Posdata: No publico el cуdigo del Lбser, ya que es muy largo, posiblemente algunos ya conozcan el FS, solo que quiero intentar adaptarlo, si no consigo respuestas, igual yo estarй intentando hacerlo, gracias por su paciencia.


Код:
	CMD:comprar(playerid,params[])
	{
		if(!strcmp(params,"armas",true))
		{
		if(IsPlayerInRangeOfPoint(playerid,2,313.8407,-133.2842,999.6016))
		{
		if(!InfoJugador[playerid][jHoras]) return Error(playerid,"ЎNo puedes comprar armas, debes jugar al menos una hora para esto!");
		if(!InfoJugador[playerid][jLicenciaArmas]) return Error(playerid,"ЎNo tienes liencia de armas!");
		Dialog(playerid,dElejirArmBal,DIALOG_STYLE_LIST,""#CBLANCO"їQuй desea comprar?",""#CINFO"> "#CBLANCO"Armas\n"#CINFO"> "#CBLANCO"Balas","Comprar","Cancelar");
		return 1;
		}
		return Error(playerid,"ЎAquн no venden armas!");
		}
	return 1;
	}
Reply
#2

Con la funciуn GetPlayerMoney:

pawn Код:
CMD:comprar(playerid,params[])
{
    if(GetPlayerMoney(playerid) < cantidad) return SendClientMessage(playerid, -1, "* Necesitas $X para comprar el lбser.");

    // el resto de tu cуdigo
    return 1;
}
Reply
#3

Quote:
Originally Posted by EnzoMetlc
Посмотреть сообщение
Con la funciуn GetPlayerMoney:

pawn Код:
CMD:comprar(playerid,params[])
{
    if(GetPlayerMoney(playerid) < cantidad) return SendClientMessage(playerid, -1, "* Necesitas $X para comprar el lбser.");

    // el resto de tu cуdigo
    return 1;
}
Si, lo se, pero. їComo le indico que va a comprar el lбser? Tu disculpa.
Lo que quiero es comprar el Lбser, el cmd que publique arriba, es para que se figuren mas o menos como es el CMD de compra.
Reply
#4

Revivo. (?)
Reply
#5

el link del lбser esta caнdo, asн no podre ayudarte.
Reply
#6

Quote:
Originally Posted by Gles
Посмотреть сообщение
el link del lбser esta caнdo, asн no podre ayudarte.
Ups, que raro, esta subido, pero no se que fallo, ya lo e re-subido, gracias, tu disculpa.
Reply
#7

Код:
stock IsPlayerInWater(playerid)
{
        new anim = GetPlayerAnimationIndex(playerid);
        if (((anim >=  1538) && (anim <= 1542)) || (anim == 1544) || (anim == 1250) || (anim == 1062)) return 1;
        return 0;
}

stock IsPlayerAiming(playerid)
{
	new anim = GetPlayerAnimationIndex(playerid);
	if (((anim >= 1160) && (anim <= 1163)) || (anim == 1167) || (anim == 1365) ||
	(anim == 1643) || (anim == 1453) || (anim == 220)) return 1;
	return 0;
}

CMD:comprar(playerid, params[])
{
 	SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing aiming
  	0.108249, 0.030232, 0.118051, 1.468254, 350.512573, 364.284240);
  	GivePlayerMoney(playerid, 1000);
	if (GetPVarInt(playerid, "laser")) {
                RemovePlayerAttachedObject(playerid, 0);
                if ((IsPlayerInAnyVehicle(playerid)) || (IsPlayerInWater(playerid))) return 1;
                switch (GetPlayerWeapon(playerid)) {
                        case 23: {
                                if (IsPlayerAiming(playerid)) {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing aiming
                                                0.108249, 0.030232, 0.118051, 1.468254, 350.512573, 364.284240);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP crouched aiming
                                                0.108249, 0.030232, 0.118051, 1.468254, 349.862579, 364.784240);
                                        }
                                } else {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing not aiming
                                                0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP crouched not aiming
                                                0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216);
                        }       }       }
                        case 27: {
                                if (IsPlayerAiming(playerid)) {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS standing aiming
                                                0.588246, -0.022766, 0.138052, -11.531745, 347.712585, 352.784271);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS crouched aiming
                                                0.588246, -0.022766, 0.138052, 1.468254, 350.712585, 352.784271);
                                        }
                                } else {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS standing not aiming
                                                0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS crouched not aiming
                                                0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216);
                        }       }       }
                        case 30: {
                                if (IsPlayerAiming(playerid)) {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK standing aiming
                                                0.628249, -0.027766, 0.078052, -6.621746, 352.552642, 355.084289);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK crouched aiming
                                                0.628249, -0.027766, 0.078052, -1.621746, 356.202667, 355.084289);
                                        }
                                } else {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK standing not aiming
                                                0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK crouched not aiming
                                                0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216);
                        }       }       }
                        case 31: {
                                if (IsPlayerAiming(playerid)) {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 standing aiming
                                                0.528249, -0.020266, 0.068052, -6.621746, 352.552642, 355.084289);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 crouched aiming
                                                0.528249, -0.020266, 0.068052, -1.621746, 356.202667, 355.084289);
                                        }
                                } else {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 standing not aiming
                                                0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 crouched not aiming
                                                0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222);
                        }       }       }
			case 34: {
				if (IsPlayerAiming(playerid)) {
					/*if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
						SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper standing aiming
						0.528249, -0.020266, 0.068052, -6.621746, 352.552642, 355.084289);
					} else {
						SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper crouched aiming
						0.528249, -0.020266, 0.068052, -1.621746, 356.202667, 355.084289);
					}*/
					return 1;
				} else {
					if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
						SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper standing not aiming
						0.658248, -0.03276, 0.133051, -11.631746, 355.302673, 353.584259);
					} else {
						SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper crouched not aiming
						0.658248, -0.03276, 0.133051, -11.631746, 355.302673, 353.584259);
			}	}	}
                        case 29: {
                                if (IsPlayerAiming(playerid)) {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 standing aiming
                                                0.298249, -0.02776, 0.158052, -11.631746, 359.302673, 357.584259);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 crouched aiming
                                                0.298249, -0.02776, 0.158052, 8.368253, 358.302673, 352.584259);
                                        }
                                } else {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 standing not aiming
                                                0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 crouched not aiming
                                                0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222);
        }       }       }       }       }
        return 1;
}
acabo de probarlo y me sale bien, probarlo y me avisas.
Reply
#8

Ordene el cуdigo de la siguiente forma, y me presento el siguiente error. (Se que de pronto es por los espacios, o algo, a veces me cuesta mucho 'adaptar' el cуdigo por esos espacios y saber como es el tema, jaja)

Код:
C:\Users\sebas_000\Desktop\CA - Version (xxxx)\filterscripts\neonfs.pwn(174) : error 010: invalid function or declaration
C:\Users\sebas_000\Desktop\CA - Version (xxxx)\filterscripts\neonfs.pwn(1) : error 010: invalid function or declaration
C:\Users\sebas_000\Desktop\CA - Version (xxxx)\filterscripts\neonfs.pwn(1 -- 4) : error 010: invalid function or declaration
C:\Users\sebas_000\Desktop\CA - Version (xxxx)\filterscripts\neonfs.pwn(1 -- 4) : fatal error 107: too many error messages on one line
Ayъdame con esa pequeсa parte tu disculpa, yo luego te compenso.

Posdata: Agregale los Else, ya que esta entre otros comandos del /comprar


Код:
 		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing aiming
  		0.108249, 0.030232, 0.118051, 1.468254, 350.512573, 364.284240);
  		GivePlayerMoney(playerid, 1000);
		if (GetPVarInt(playerid, "laser"))
	    {
		RemovePlayerAttachedObject(playerid, 0);
		if ((IsPlayerInAnyVehicle(playerid)) || (IsPlayerInWater(playerid))) return 1;
		switch (GetPlayerWeapon(playerid))
	    {
		case 23:
	    {
		if (IsPlayerAiming(playerid))
	    {
		if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
	    {
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing aiming
		0.108249, 0.030232, 0.118051, 1.468254, 350.512573, 364.284240);
	    }
		else
	    {
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP crouched aiming
		0.108249, 0.030232, 0.118051, 1.468254, 349.862579, 364.784240);
	    }
	    }
		else
		{
		if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing not aiming
		0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216);
	    }
		else
	    {
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP crouched not aiming
		0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216);
	    }
		}
		}
		case 27:
		{
		if (IsPlayerAiming(playerid))
		{
		if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS standing aiming
		0.588246, -0.022766, 0.138052, -11.531745, 347.712585, 352.784271);
	    }
		else
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS crouched aiming
		0.588246, -0.022766, 0.138052, 1.468254, 350.712585, 352.784271);
	    }
	    }
		else
		{
		if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS standing not aiming
		0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216);
	    }
		else
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS crouched not aiming
		0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216);
	    }
		}
		}
		case 30:
		{
		if (IsPlayerAiming(playerid))
		{
		if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK standing aiming
		0.628249, -0.027766, 0.078052, -6.621746, 352.552642, 355.084289);
	    }
		else
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK crouched aiming
		0.628249, -0.027766, 0.078052, -1.621746, 356.202667, 355.084289);
	    }
	    }
		else
		{
		if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK standing not aiming
		0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216);
	    }
		else
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK crouched not aiming
		0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216);
	    }
		}
		}
		case 31:
		{
		if (IsPlayerAiming(playerid))
		{
		if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 standing aiming
		0.528249, -0.020266, 0.068052, -6.621746, 352.552642, 355.084289);
	    }
		else
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 crouched aiming
		0.528249, -0.020266, 0.068052, -1.621746, 356.202667, 355.084289);
	    }
	    }
		else {
		if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 standing not aiming
		0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222);
	    }
		else
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 crouched not aiming
		0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222);
	    }
		}
		}
		case 34:
		{
		if (IsPlayerAiming(playerid))
		{
		/*if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper standing aiming
		0.528249, -0.020266, 0.068052, -6.621746, 352.552642, 355.084289);
		} else {
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper crouched aiming
		0.528249, -0.020266, 0.068052, -1.621746, 356.202667, 355.084289);
		}*/
		return 1;
		}
		else
		{
		if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper standing not aiming
		0.658248, -0.03276, 0.133051, -11.631746, 355.302673, 353.584259);
		}
		else
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper crouched not aiming
		0.658248, -0.03276, 0.133051, -11.631746, 355.302673, 353.584259);
		}
		}
		}
		case 29:
		{
		if (IsPlayerAiming(playerid))
		{
		if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 standing aiming
		0.298249, -0.02776, 0.158052, -11.631746, 359.302673, 357.584259);
	    }
		else
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 crouched aiming
		0.298249, -0.02776, 0.158052, 8.368253, 358.302673, 352.584259);
	    }
	    }
		else
		{
		if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 standing not aiming
		0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222);
	    }
		else
		{
		SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 crouched not aiming
		0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222);
						}
					}
	    		}
			}
		}
		return 1;
}
Reply
#9

no tiene nada que ver, a mi no me tira ningъn error.
Reply
#10

Quote:
Originally Posted by Gles
Посмотреть сообщение
no tiene nada que ver, a mi no me tira ningъn error.
Pero. їNo me presentara problema si lo copio tal cual abajo asн con ese montуn de espacios en el cmd de comprar? Intentare a ver y te digo.

Edito.
Si me lanza error, mira:


Код:
C:\Users\sebas_000\Desktop\CA - Version (xxxx)\gamemodes\MI-RP.pwn(5288) : error 021: symbol already defined: "IsPlayerAiming"
C:\Users\sebas_000\Desktop\CA - Version (xxxx)\gamemodes\MI-RP.pwn(30870) : warning 217: loose indentation
C:\Users\sebas_000\Desktop\CA - Version (xxxx)\gamemodes\MI-RP.pwn(30980) : warning 217: loose indentation
C:\Users\sebas_000\Desktop\CA - Version (xxxx)\gamemodes\MI-RP.pwn(30982) : error 010: invalid function or declaration
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)