Posts: 232
Threads: 4
Joined: Apr 2013
PHP код:
CMD:agiveweapon(playerid, params[])
{
new TargetID, Weapon, Ammo;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFF, "You are not rcon admin.");
if(sscanf(params,"udd", TargetID, Weapon, Ammo)) return SendClientMessage(playerid,0xFFFFFF,"Syntax: /agiveweapon <PlayerID/PartOfName> <WeaponID> <Ammo>");
SendClientMessage(playerid,0xFFFFFF,"Player has recieved the weapon!");
SendClientMessage(targetid,0xFFFFFF,"You have recieved a weapon!");
return 1;
}
But that player will never get their weapon
You don't give anything to them!
Posts: 1,147
Threads: 109
Joined: Jul 2013
Reputation:
0
ahameed, use GivePlayerWeapon();
And why are you using sscanf twice?
I don't know if that's incorrect or smth, but I've never seen it before.
Posts: 6,242
Threads: 8
Joined: Jun 2008
Quote:
Originally Posted by saffierr
ahameed, use GivePlayerWeapon();
And why are you using sscanf twice?
I don't know if that's incorrect or smth, but I've never seen it before.
|
PHP код:
if(sscanf(params,"udd",TargetID,Weapon,Ammo));
That is where the issue is... That, is an empty statement, as it doesn't have the { }, or anything done in it after the if.
Quote:
Originally Posted by Andre02
if/else if/else statements do not have semicolons ';' at the end!
|
That is incorrect.
You can make them on one line, and they can have semicolons at the end of them, meaning it's the end of the if portion.
Posts: 1,266
Threads: 6
Joined: Oct 2014
Quote:
Originally Posted by ahameed4755
i use the command but it keep saying Usage [PlayerID] (this script dosent work)
|
change :
Код:
if(sscanf(params, "udd", targetid, weapon, ammo)) return SendClientMessage(playerid, 0xFFFFFF, "Usage: /agiveweapon [playerid]");
to
PHP код:
if(sscanf(params, "udd", targetid, weapon, ammo)) return SendClientMessage(playerid, 0xFFFFFF, "Usage: /agiveweapon [playerid] [weaponid] [ammo]");
then /agiveweapon playerid weaponid ammo
example: /agiveweapon 0 38 5000
Posts: 6,242
Threads: 8
Joined: Jun 2008
Quote:
Originally Posted by Andre02
Semicolons are added to 1 line if statements but after the function
|
Look, fact is, I was meaning about the fact that when you put them on one line, they have a semicolon at the end of the line.
I'd say unless you've been helping in the first place, avoid nitpicking on those who have been.