28.01.2010, 15:17
Hey there, take a look at my code:
I think most of it works, but I can't get the "if(classid == 4)" to work, since "public OnPlayerText(playerid, text[])" doesn't have that. How can I make it check the players class, I can't find a GetPlayerClass from the sidemenu(afaik).
Help a noob.
Код:
if (strcmp("/swapg", cmdtext, true, 10) == 0)
{
new grenadeammo = GetPlayerAmmo(playerid);
new grenweaponcheck = GetPlayerWeapon(playerid);
if (classid == 4)
{
if (grenweaponcheck == 16)
{
GivePlayerWeapon(playerid, 18, grenadeammo);
SendClientMessage(playerid, COLOR_YELLOW , "Swapped your current grenades for Molotov Cocktails.");
return 1;
}
else if (grenweaponcheck == 18)
{
GivePlayerWeapon(playerid, 16, grenadeammo);
SendClientMessage(playerid, COLOR_YELLOW , "Swapped your current grenades for Frag Grenades.");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_YELLOW , "Please equip your grenades or purchase new");
SendClientMessage(playerid, COLOR_YELLOW , "ones with the /guns command to swap them.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED , "Command only available for Grenadiers.");
return 1;
}
Help a noob.

