dcmd_buy... Help please =) - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: dcmd_buy... Help please =) (
/showthread.php?tid=68390)
dcmd_buy... Help please =) -
introzen - 09.03.2009
I'm back with new problem :P
pawn Код:
dcmd_buy(playerid,params[])
{
if(PlayerInfo[playerid][pAmmunation] == 1)
{
new weapon;
if(sscanf(params,"s",weapon)) return SendClientMessage(playerid,COLOR_DARKRED,"Usage: /buy <bat/silenced>");
if( ) // IF TYPE /BUY COMBATKNIFE... How to fix? :P
{
GivePlayerWeapon(playerid,4,1);
GivePlayerMoney(playerid,-1000);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Bought a Combat Knife");
}
}
else SendClientMessage(playerid,COLOR_DARKRED,"Not in a store");
return 1;
}
Anyone know how to fix? :P plz :P
Re: dcmd_buy... Help please =) -
Nubotron - 09.03.2009
You are doing the same mistake as your /report command..
You want to scan the command parameters for a weapon NAME, so your variable "weapon" should be an array.
And for your main rpoblem, use strcmp, like any strings comparisons..
pawn Код:
if (!strcmp(params, "combaknife"))
Re: dcmd_buy... Help please =) -
introzen - 09.03.2009
THX