Weapon name(Duel command)
#1

How to use this is command for weapon name and not weapon id?

Example: /duel [playerid] [weapon id or name]

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







	if(g_HasInvitedToDuel[playerid] == 1)
		return SendError(playerid, "You already invited someone to a duel! ~n~Type ~b~~h~/duel~w~ to reset your invite");

	new
		tString[256]
	;

	if (!IsPlayerConnected( params[ 0 ] ))
	    return SendError(playerid, "Player is not connected.");

 	if(	g_HasInvitedToDuel[ params[ 0 ] ] == 1)
 		return SendError(playerid, "That player is already invited to a duel!");


 	    if(IsNotWeapon( params[ 1 ] ) )
		return SendError( playerid, "Not allowed weapon ID");


	//if(	params[ 0 ]  == playerid)
 		//return SendError(playerid, "You can not duel yourself!");

    if(!IsValidWeapon( params[ 1 ] ) )
		return SendError( playerid, "Invalid weapon ID");

 

	new WeapName[ 32 ];


	DWP = params[ 1 ];
    GetWeaponName( params[ 1 ],WeapName,32 );

 	format(tString, sizeof(tString), "Invitation sent!~n~~n~Sent to:~b~~h~%s(~w~ID:%d~b~~h~)~n~~w~Weapon: ~r~~h~%s~n~~n~~w~Player must accept the duel invitation before starting a fight!",PlayerName2( params[ 0 ]), params[ 0 ],WeapName);
 	Info(playerid, tString, 13000);

 	format(tString, sizeof(tString), "Invitation received!~n~~n~Hoster:~b~~h~%s (~w~ID:%d~b~~h~)~n~~w~Weapon: ~r~~h~%s~n~~n~~w~Type ~b~~h~/duelaccept <playerid>~w~ to accept the invitation!",PlayerName2(playerid), playerid, WeapName);
 	Info( params[ 0 ], tString, 13000);

 	g_GotInvitedToDuel[ params[ 0 ]] = playerid;
	g_HasInvitedToDuel[playerid] = 1;

	return 1;
}
Reply


Messages In This Thread
Weapon name(Duel command) - by pista - 18.09.2011, 14:08
Re: Weapon name(Duel command) - by Kingunit - 18.09.2011, 14:16
Re: Weapon name(Duel command) - by Super_Panda - 18.09.2011, 14:16
Re: Weapon name(Duel command) - by pista - 18.09.2011, 14:22

Forum Jump:


Users browsing this thread: 1 Guest(s)