13.01.2012, 23:10
Hey,
What functions would I need to make a /getgun [WEAPON_NAME] command?
Thanks,
-Snowman12.
What functions would I need to make a /getgun [WEAPON_NAME] command?
Thanks,
-Snowman12.
dcmd_w2(playerid, params[])
{
new idx, iString[128];
iString = strtok(params, idx);
if (!strlen(iString)) {
SendClientMessage(playerid, COLOR_RED, "[USAGE]: /w2 WEAPONID/NAME (AMMO) or /weapon WEAPONID/NAME (AMMO)");
return true;
}
new weaponid = GetWeaponModelIDFromName(iString);
if (weaponid == -1) {
weaponid = strval(iString);
if (weaponid < 0 || weaponid > 47) {
SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid WEAPONID/NAME");
return true;
}
}
if (!strlen(params[idx+1])) {
GivePlayerWeapon(playerid, weaponid, 500);
format(iString, 128, "[SUCCESS]: You were given weapon %s (ID: %d) with 500 ammo.", aWeaponNames[weaponid], weaponid);
SendClientMessage(playerid, COLOR_GREEN, iString);
return true;
}
idx = strval(params[idx+1]);
GivePlayerWeapon(playerid, weaponid, idx);
format(iString, 128, "[SUCCESS]: You were given weapon %s (ID: %d) with %d ammo.", aWeaponNames[weaponid], weaponid, idx);
SendClientMessage(playerid, COLOR_GREEN, iString);
return true;
}