PDA

View Full Version : Pickup help


silverms
14/04/2017, 07:40 AM
so iv made a pickup system from my server and it is good but when the player pickup pickup it checks if the pickup I created id I mean here is the code : for(new i = 0; i < sizeof(WeapPic); i++)
{
if(IsPlayerInRangeOfPoint(playerid,3.0,WeapPic[i][wX],WeapPic[i][wY],WeapPic[i][wZ]))
{
if(WeapPic[i][wPickupM] == 356)
{
PlayerPlaySound(playerid,1150,0.0,0.0,0.0);
GivePlayerWeapon(playerid, 31, WeapPic[i][wAmmo]);
}
if(WeapPic[i][wPickupM] == 358)
{
PlayerPlaySound(playerid,1150,0.0,0.0,0.0);
GivePlayerWeapon(playerid, 34, WeapPic[i][wAmmo]);
}
if(WeapPic[i][wPickupM] == 348)
{
PlayerPlaySound(playerid,1150,0.0,0.0,0.0);
GivePlayerWeapon(playerid, 24, WeapPic[i][wAmmo]);
}
if(WeapPic[i][wPickupM] == 1240)
{
PlayerPlaySound(playerid,1150,0.0,0.0,0.0);
SetPlayerHealth(playerid, WeapPic[i][wAmmo]);
}
if(WeapPic[i][wPickupM] == 1242)
{
PlayerPlaySound(playerid,1150,0.0,0.0,0.0);
SetPlayerArmour(playerid, WeapPic[i][wAmmo]);
}
}
}
it is working good but is there a way to make a strock that gets the weapon id from pickup thanks.

raydx
14/04/2017, 08:12 AM
stock GetWeaponByModel(wid)
{
if(wid == 331) return 1;
else if(wid == 332) return 2;
else if(wid == 333) return 3;
else if(wid == 334) return 5;
else if(wid == 335) return 6;
else if(wid == 336) return 7;
else if(wid == 321) return 10;
else if(wid == 322) return 11;
else if(wid == 323) return 12;
else if(wid == 324) return 13;
else if(wid == 325) return 14;
else if(wid == 326) return 15;
else if(wid == 347) return 23;
else if(wid == 348) return 24;
else if(wid == 349) return 25;
else if(wid == 350) return 26;
else if(wid == 351) return 27;
else if(wid == 352) return 28;
else if(wid == 353) return 29;
else if(wid == 355) return 30;
else if(wid == 356) return 31;
else if(wid == 372) return 32;
else if(wid == 357) return 33;
else if(wid == 335) return 4;
else if(wid == 358) return 34;
else if(wid == 365) return 41;
else if(wid == 366) return 44;
else if(wid == 367) return 43;
return 0;
}