How do I make this work
#9

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
Yes, the second poster has either scripted the code mindlessly without testing it first, or copied it from other script, which shows a lack of effort and a prospering laze in my opinion.

pawn Код:
CMD:givegun(playerid, params[])
{
    new targetid, weaponid;
    if(sscanf(params, "ui", targetid, weaponid)) return SendClientMessage(playerid, -1, "Usage: /givegun [name/id] [gun]");
    if(weaponid < 0 || (weaponid > 18 && weaponid < 22) || weaponid > 46) return SendClientMessage(playerid, -1, "Invalid weapon ID.");
    //I was going to create a function like IsValidWeapon, but I think it may cause more confusion for new scripters.
    if(!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "User is not connected!");
    GivePlayerWeapon(targetid, weaponid, 200); //You can change the ammo from 200 to whatever you wish.
    if(targetid == playerid) return SendClientMessage(playerid, 0xFFFF00FF, "You have given yourself a weapon.");
    SendClientMessage(playerid, 0xFFFF00FF, "You have given a weapon to another player."); //Putting a player name/id here is optional.
    SendClientMessage(targetid, 0xFFFF00FF, "You have been given a weapon by another player."); //Putting a player name/id here is optional.
    return 1;
}
Thank you so much, this worked, I appreciate it. +rep
Reply


Messages In This Thread
How do I make this work - by Wizardking - 29.12.2013, 07:00
Re: How do I make this work - by Twizted - 29.12.2013, 07:44
Re: How do I make this work - by Wizardking - 29.12.2013, 08:03
Re: How do I make this work - by iZN - 29.12.2013, 08:07
Re: How do I make this work - by Wizardking - 29.12.2013, 08:21
AW: Re: How do I make this work - by CutX - 29.12.2013, 08:29
Re: How do I make this work - by Wizardking - 29.12.2013, 09:51
Re: How do I make this work - by Threshold - 29.12.2013, 10:18
Re: How do I make this work - by Wizardking - 29.12.2013, 10:30

Forum Jump:


Users browsing this thread: 1 Guest(s)