Duel script with weapon name and ID
#1

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]");
Reply
#2

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

wrong
Reply
#4

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.
Reply
#5

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

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.
Reply
#7

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.
Reply
#8

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.
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)