SA-MP Forums Archive
Duel script with weapon name and ID - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Duel script with weapon name and ID (/showthread.php?tid=526430)



Duel script with weapon name and ID - HerBan - 17.07.2014

Hi!
What's wrong ?

pawn Код:
CMD:duel(playerid, params[])
{
    if ( sscanf( params, "udi", params[ 0 ], params[ 1 ] ) )
        return SendUsage(playerid, "/duel [playerid] [weapon name/ID]");



Re: Duel script with weapon name and ID - Jack_Leslie - 17.07.2014

pawn Код:
CMD:duel(playerid, params[])
{
    new targetid, weaponid;
    if ( sscanf( params, "ud", targetid, weaponid ) )
        return SendUsage(playerid, "/duel [playerid] [weapon name/ID]");



Re: Duel script with weapon name and ID - HerBan - 17.07.2014

wrong


Re: Duel script with weapon name and ID - Jack_Leslie - 17.07.2014

How? What the fuck do you want the command to do then? Don't be so rude when someone's taking their time to help you when you obviously have no idea what the fuck you are doing your self.


Re: Duel script with weapon name and ID - HerBan - 17.07.2014

I want this command /duel [ID] [weapon name OR ID]


Re: Duel script with weapon name and ID - Jack_Leslie - 17.07.2014

pawn Код:
CMD:duel(playerid, params[])
{
    new targetid, weapon;
    if ( sscanf( params, "us[126]", targetid, weapon ) )
        return SendUsage(playerid, "/duel [playerid] [weapon name/ID]");
Then find a stock/function that returns weapon id from name.


Re: Duel script with weapon name and ID - biker122 - 17.07.2014

pawn Код:
CMD:duel(playerid, params[])
{
* * if ( sscanf( params, "udu", params[ 0 ], params[ 1 ] ) )
* * * * return SendUsage(playerid, "/duel [playerid] [weapon name/ID]");
"u" - Either a numeric value or an alphabetical letter.


Re: Duel script with weapon name and ID - Jack_Leslie - 17.07.2014

Quote:
Originally Posted by biker122
Посмотреть сообщение
pawn Код:
CMD:duel(playerid, params[])
{
* * if ( sscanf( params, "udu", params[ 0 ], params[ 1 ] ) )
* * * * return SendUsage(playerid, "/duel [playerid] [weapon name/ID]");
"u" - Either a numeric value or an alphabetical letter.
https://sampwiki.blast.hk/wiki/Sscanf_code

Код:
/*----------------------------------------------------------------------------*-
Function:
	sscanf
Params:
	string[] - String to extract parameters from.
	format[] - Parameter types to get.
	{Float,_}:... - Data return variables.
Return:
	0 - Successful, not 0 - fail.
Notes:
	A fail is either insufficient variables to store the data or insufficient
	data for the format string - excess data is disgarded.
 
	A string in the middle of the input data is extracted as a single word, a
	string at the end of the data collects all remaining text.
 
	The format codes are:
 
	c - A character.
	d, i - An integer.
	h, x - A hex number (e.g. a colour).
	f - A float.
	s - A string.
	z - An optional string.
	pX - An additional delimiter where X is another character.
	'' - Encloses a litteral string to locate.
	u - User, takes a name, part of a name or an id and returns the id if they're connected.
 
	Now has IsNumeric integrated into the code.
 
	Added additional delimiters in the form of all whitespace and an
	optioanlly specified one in the format string.
-*----------------------------------------------------------------------------*/
u - User, takes a name, part of a name or an id and returns the id if they're connected.


Re: Duel script with weapon name and ID - Dissonancy - 17.07.2014

I think you have to add a case function with weapon Name and ids it will help.


Re: Duel script with weapon name and ID - Vince - 17.07.2014

https://github.com/Y-Less/sscanf/wik...cluded-kustoms