SA-MP Forums Archive
How To Change In format ? - 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: How To Change In format ? (/showthread.php?tid=144404)



How To Change In format ? - jame20702 - 27.04.2010

if(strcmp(cmd, "/givegun", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /givegun [playerid/PartOfName] [weaponid(eg. 46 = Parachute)] [ammo]");
return 1;
}
new playa;
new gun;
new ammo;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
gun = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /givegun [playerid/PartOfName] [weaponid] [ammo]");
SendClientMessage(playerid, COLOR_GRAD4, "3(Club) 4(knife) 5(bat) 6(Shovel) 7(Cue) 8(Katana) 10-13(Dildo) 14(Flowers) 16(Grenades) 18(Molotovs) 22(Pistol) 23(SPistol)");
SendClientMessage(playerid, COLOR_GRAD3, "24(Eagle) 25(shotgun) 29(MP5) 30(AK47) 31(M4) 33(Rifle) 34(Sniper) 37(Flamethrower) 41(spray) 42(exting) 43(Camera) 46(Parachute)");
return 1;
}
if(gun < 1||gun > 46||gun==1||gun==2||gun==19||gun==20||gun==21||gun ==39||gun==40||gun==44||gun==45)
{ SendClientMessage(playerid, COLOR_GRAD1, " ЛБТВаЕў»Ч№јФґ!"); return 1; }
tmp = strtok(cmdtext, idx);
ammo = strval(tmp);
if(ammo <1||ammo > 9999)
{ SendClientMessage(playerid, COLOR_GRAD1, " ЎГРКШ№µйН§дБи№йНВЎЗиТ 1 ЛГЧНБТЎЎЗиТ 9999 №Сґ !"); return 1; }
if (PlayerInfo[playerid][pAdmin] >= 1337)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
SafeGivePlayerWeapon(playa, gun, ammo);
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, "AdmWarning: %s дґйгЛйНТЗШёЛБТВаЕў·Хи %d гЛйЎСє %s", sendername,gun,giveplayer);
ABroadCast(COLOR_YELLOW,string,1);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " ¤ШідБиКТБТГ¶гЄй¤УКС觹Хйдґй !");
}
}
return 1;
}

format(string, 256, "AdmWarning: %s дґйгЛйНТЗШёЛБТВаЕў·Хи %d гЛйЎСє %s", sendername,gun,giveplayer);
gun is number . how to change to Name Of Weapon ?

Example if gun is 24 how to change to Desert Eagle


Re: How To Change In format ? - Whitetiger - 27.04.2010

new mywep[32];
GetWeaponName(gun, mywep, sizeof(mywep));

mywep now = the gun name, and treat it as a string, with %s in format :P

more info ---- https://sampwiki.blast.hk/wiki/GetWeaponName


Re: How To Change In format ? - jame20702 - 27.04.2010

thank man