12.11.2009, 20:57
Will this work ?
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/help", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid,0x33CCFFAA, " -~Weapons For Sale~-");
SendClientMessage(playerid,0x33CCFFAA, "[Hint] Use /buy [name] to buy a weapon");
SendClientMessage(playerid,0x33CCFFAA, "Pistols- 9mm($450), S9mm($500), Deagle($1500)");
SendClientMessage(playerid,0x33CCFFAA, "Shotguns- Shotgun($800), CShotgun($2100), Sawnoff($1000)");
SendClientMessage(playerid,0x33CCFFAA, "Automatics- MicroSMG($800), SMG($1200), Tec9($900)");
SendClientMessage(playerid,0x33CCFFAA, "Rifles- CountryRifle($700), Sniper($1100),");
SendClientMessage(playerid,0x33CCFFAA, "AssaultRifles- AK47($1800), M4($2500),");
SendClientMessage(playerid,0x33CCFFAA, "Thrown- Grenade($3500), Molotov($3500), SatchelCharge($4000");
return 1;
}
if (strcmp("/buy 9mm", cmdtext, true, Cool == 0)
{
GivePlayerWeapon(playerid, 22, 60);
SendClientMessage(playerid,0x33AA33AA,"You have bought a 9mm for $450!");
GivePlayerMoney(playerid, -450);
return 1;
}
if (strcmp("/buy S9mm", cmdtext, true, 9) == 0)
{
GivePlayerWeapon(playerid, 23, 45);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Silenced 9mm for $500!");
GivePlayerMoney(playerid, -500);
return 1;
}
if (strcmp("/buy Deagle", cmdtext, true, 11) == 0)
{
GivePlayerWeapon(playerid, 24, 30);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Desert Eagle for $1500!");
GivePlayerMoney(playerid, -1500);
return 1;
}
if (strcmp("/buy Shotgun", cmdtext, true, 12) == 0)
{
GivePlayerWeapon(playerid, 25, 25);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Shotgun for $800!");
GivePlayerMoney(playerid, -800);
return 1;
}
if (strcmp("/buy CShotgun", cmdtext, true, 13) == 0)
{
GivePlayerWeapon(playerid, 27, 35);
SendClientMessage(playerid,0x33AA33AA,"You have bought a CShotgun for $2100!");
GivePlayerMoney(playerid, -2100);
return 1;
}
if (strcmp("/buy Sawnoff", cmdtext, true, 12) == 0)
{
GivePlayerWeapon(playerid, 26, 20);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Sawnoff for $1000!");
GivePlayerMoney(playerid, -1000);
return 1;
}
if (strcmp("/buy MicroSMG", cmdtext, true, 13) == 0)
{
GivePlayerWeapon(playerid, 28, 90);
SendClientMessage(playerid,0x33AA33AA,"You have bought a MicroSMG for $800!");
GivePlayerMoney(playerid, -800);
return 1;
}
if (strcmp("/buy SMG", cmdtext, true, Cool == 0)
{
GivePlayerWeapon(playerid, 29, 90);
SendClientMessage(playerid,0x33AA33AA,"You have bought a SMG for $1200!");
GivePlayerMoney(playerid, -1200);
return 1;
}
if (strcmp("/buy Tec9", cmdtext, true, 9) == 0)
{
GivePlayerWeapon(playerid, 32, 90);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Tec9 for $900!");
GivePlayerMoney(playerid, -900);
return 1;
}
if (strcmp("/buy CountryRifle", cmdtext, true, 17) == 0)
{
GivePlayerWeapon(playerid, 33, 20);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Country Rifle for $700!");
GivePlayerMoney(playerid, -700);
return 1;
}
if (strcmp("/buy Sniper", cmdtext, true, 11) == 0)
{
GivePlayerWeapon(playerid, 34, 20);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Sniper for $1100!");
GivePlayerMoney(playerid, -1100);
return 1;
}
if (strcmp("/buy AK47", cmdtext, true, 9) == 0)
{
GivePlayerWeapon(playerid, 30, 120);
SendClientMessage(playerid,0x33AA33AA,"You have bought a AK47 for $1800!");
GivePlayerMoney(playerid, -1800);
return 1;
}
if (strcmp("/buy M4", cmdtext, true, 7) == 0)
{
GivePlayerWeapon(playerid, 31, 120);
SendClientMessage(playerid,0x33AA33AA,"You have bought a M4 for $2500!");
GivePlayerMoney(playerid, -2500);
return 1;
}
if (strcmp("/buy Grenade", cmdtext, true, 12) == 0)
{
GivePlayerWeapon(playerid, 16, 3);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Grenade for $3500!");
GivePlayerMoney(playerid, -3500);
return 1;
}
if (strcmp("/buy Molotov", cmdtext, true, 12) == 0)
{
GivePlayerWeapon(playerid, 18, 3);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Molotov for $3500!");
GivePlayerMoney(playerid, -3500);
return 1;
}
if (strcmp("/buy SatchelCharge", cmdtext, true, 1 == 0)
{
GivePlayerWeapon(playerid, 39, 2);
SendClientMessage(playerid,0x33AA33AA,"You have bought a SatchelCharge for $4000!");
GivePlayerMoney(playerid, -4000);
return 1;
return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/help", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid,0x33CCFFAA, " -~Weapons For Sale~-");
SendClientMessage(playerid,0x33CCFFAA, "[Hint] Use /buy [name] to buy a weapon");
SendClientMessage(playerid,0x33CCFFAA, "Pistols- 9mm($450), S9mm($500), Deagle($1500)");
SendClientMessage(playerid,0x33CCFFAA, "Shotguns- Shotgun($800), CShotgun($2100), Sawnoff($1000)");
SendClientMessage(playerid,0x33CCFFAA, "Automatics- MicroSMG($800), SMG($1200), Tec9($900)");
SendClientMessage(playerid,0x33CCFFAA, "Rifles- CountryRifle($700), Sniper($1100),");
SendClientMessage(playerid,0x33CCFFAA, "AssaultRifles- AK47($1800), M4($2500),");
SendClientMessage(playerid,0x33CCFFAA, "Thrown- Grenade($3500), Molotov($3500), SatchelCharge($4000");
return 1;
}
if (strcmp("/buy 9mm", cmdtext, true, Cool == 0)
{
GivePlayerWeapon(playerid, 22, 60);
SendClientMessage(playerid,0x33AA33AA,"You have bought a 9mm for $450!");
GivePlayerMoney(playerid, -450);
return 1;
}
if (strcmp("/buy S9mm", cmdtext, true, 9) == 0)
{
GivePlayerWeapon(playerid, 23, 45);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Silenced 9mm for $500!");
GivePlayerMoney(playerid, -500);
return 1;
}
if (strcmp("/buy Deagle", cmdtext, true, 11) == 0)
{
GivePlayerWeapon(playerid, 24, 30);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Desert Eagle for $1500!");
GivePlayerMoney(playerid, -1500);
return 1;
}
if (strcmp("/buy Shotgun", cmdtext, true, 12) == 0)
{
GivePlayerWeapon(playerid, 25, 25);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Shotgun for $800!");
GivePlayerMoney(playerid, -800);
return 1;
}
if (strcmp("/buy CShotgun", cmdtext, true, 13) == 0)
{
GivePlayerWeapon(playerid, 27, 35);
SendClientMessage(playerid,0x33AA33AA,"You have bought a CShotgun for $2100!");
GivePlayerMoney(playerid, -2100);
return 1;
}
if (strcmp("/buy Sawnoff", cmdtext, true, 12) == 0)
{
GivePlayerWeapon(playerid, 26, 20);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Sawnoff for $1000!");
GivePlayerMoney(playerid, -1000);
return 1;
}
if (strcmp("/buy MicroSMG", cmdtext, true, 13) == 0)
{
GivePlayerWeapon(playerid, 28, 90);
SendClientMessage(playerid,0x33AA33AA,"You have bought a MicroSMG for $800!");
GivePlayerMoney(playerid, -800);
return 1;
}
if (strcmp("/buy SMG", cmdtext, true, Cool == 0)
{
GivePlayerWeapon(playerid, 29, 90);
SendClientMessage(playerid,0x33AA33AA,"You have bought a SMG for $1200!");
GivePlayerMoney(playerid, -1200);
return 1;
}
if (strcmp("/buy Tec9", cmdtext, true, 9) == 0)
{
GivePlayerWeapon(playerid, 32, 90);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Tec9 for $900!");
GivePlayerMoney(playerid, -900);
return 1;
}
if (strcmp("/buy CountryRifle", cmdtext, true, 17) == 0)
{
GivePlayerWeapon(playerid, 33, 20);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Country Rifle for $700!");
GivePlayerMoney(playerid, -700);
return 1;
}
if (strcmp("/buy Sniper", cmdtext, true, 11) == 0)
{
GivePlayerWeapon(playerid, 34, 20);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Sniper for $1100!");
GivePlayerMoney(playerid, -1100);
return 1;
}
if (strcmp("/buy AK47", cmdtext, true, 9) == 0)
{
GivePlayerWeapon(playerid, 30, 120);
SendClientMessage(playerid,0x33AA33AA,"You have bought a AK47 for $1800!");
GivePlayerMoney(playerid, -1800);
return 1;
}
if (strcmp("/buy M4", cmdtext, true, 7) == 0)
{
GivePlayerWeapon(playerid, 31, 120);
SendClientMessage(playerid,0x33AA33AA,"You have bought a M4 for $2500!");
GivePlayerMoney(playerid, -2500);
return 1;
}
if (strcmp("/buy Grenade", cmdtext, true, 12) == 0)
{
GivePlayerWeapon(playerid, 16, 3);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Grenade for $3500!");
GivePlayerMoney(playerid, -3500);
return 1;
}
if (strcmp("/buy Molotov", cmdtext, true, 12) == 0)
{
GivePlayerWeapon(playerid, 18, 3);
SendClientMessage(playerid,0x33AA33AA,"You have bought a Molotov for $3500!");
GivePlayerMoney(playerid, -3500);
return 1;
}
if (strcmp("/buy SatchelCharge", cmdtext, true, 1 == 0)
{
GivePlayerWeapon(playerid, 39, 2);
SendClientMessage(playerid,0x33AA33AA,"You have bought a SatchelCharge for $4000!");
GivePlayerMoney(playerid, -4000);
return 1;
return 0;
}