player weapon save
#1

how to save player selected weapons please help +rep

Quote:

#define TD_MENU_WEAPONS 61
#define TD_MENU_MALE_WEAPONS 62
#define TD_MENU_HANDGUNS_WEAPONS 63
#define TD_MENU_MACHINES_WEAPONS 66
#define TD_MENU_ASSAULT_WEAPONS 67
#define TD_MENU_RIFLES_WEAPONS 68
#define TD_MENU_SHOTGUN_WEAPONS 69

Quote:

COMMAND:weapons(playerid,params[])
{
SHOW_WEAPONS(playerid);
return 1;
}

stock SHOW_WEAPONS(playerid)
{
if(PlayerInfo[playerid][pSpawned] > 0)
{
new string[128];
HideTextDrawMenu(playerid);
ShowTextDrawMenu(playerid, TD_MENU_WEAPONS,"~g~WEAPONS", 7+6, 7);
format(string, sizeof(string), "Select an ~b~Option~w~ To Select a ~p~Weapon");
ShowTextDrawMenuItems(playerid, 0, string, " ", " ",0);
ShowTextDrawMenuItems(playerid, 1, " ", "~y~1~w~ - Melee Weapons", " ",0);
ShowTextDrawMenuItems(playerid, 2, " ", "~y~2~w~ - Handguns", " ",0);
ShowTextDrawMenuItems(playerid, 3, " ", "~y~3~w~ - Shotguns", " ",0);
ShowTextDrawMenuItems(playerid, 4, " ", "~y~4~w~ - SUB Machines Guns", " ",0);
ShowTextDrawMenuItems(playerid, 5, " ", "~y~5~w~ - Assault", " ",0);
ShowTextDrawMenuItems(playerid, 6, " ", "~y~6~w~ - Rifles", " ",0);
ShowTextDrawMenuItems(playerid, 7, " ", "~y~7~w~ - ~r~Default Weapons", " ",0);
}
else
{
SendClientMessage(playerid,COLOR_ERROR,"You Cannot Use This Command While You're Dead.");
}
}

Quote:

stock OnPlayerEnterTextDrawMenuOption(playerid,text[])
{
new Option,string[2480];

if (isNumeric(text))
{
Option = strval(text);
}else{
Option = -1;
}

switch (PlayerInfo[playerid][pTextdraw])
{

//-----------------------------------------------------------------------------
// Weapons System
//-----------------------------------------------------------------------------
case TD_MENU_WEAPONS:
{
if (Option != -1)
{
if (Option > 0 && Option <= Menu_Options[playerid])
{
switch (Option)
{
case 1:
{
MALE_WEAPONS(playerid);
}
case 2:
{
HAND_GUNS(playerid);
}
case 3:
{
SHOT_GUNS(playerid);
}
case 4:
{
SUB_MACHINES_GUNS(playerid);
}
case 5:
{
ASSAULT_GUNS(playerid);
}
case 6:
{
SNIPER_RIFLE(playerid);
}
case 7:
{
GivePlayerCommonWeapons(playerid);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received {0080FF}Default Weapons.");
}


}
}else{
SendClientMessage(playerid,COLOR_ERROR,"Invalid Selection");
}
}else{
SendClientMessage(playerid,COLOR_ERROR,"Invalid Selection");
}
}

case TD_MENU_MALE_WEAPONS:
{
if (Option != -1)
{
if (Option > 0 && Option <= Menu_Options[playerid])
{
switch (Option)
{
case 1:
{
GivePlayerCommonWeapons(playerid);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received {0080FF}Default Weapons.");
}
case 2:
{
GivePlayerWeapon(playerid, 2, 1);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}Golf Club.");
}
case 3:
{
GivePlayerWeapon(playerid, 3, 1);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}Nightstick.");
}
case 4:
{
GivePlayerWeapon(playerid, 5, 1);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}Baseball Bat.");
}
case 5:
{
GivePlayerWeapon(playerid, 6, 1);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}Shovel.");
}
case 6:
{
GivePlayerWeapon(playerid, 7, 1);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}PoolCue.");
}
case 7:
{
GivePlayerWeapon(playerid, 9, 1);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}Chainsaw.");
}
case 8:
{
SHOW_WEAPONS(playerid);
}


}
}else{
SendClientMessage(playerid,COLOR_ERROR,"Invalid Selection");
}
}else{
SendClientMessage(playerid,COLOR_ERROR,"Invalid Selection");
}
}


case TD_MENU_HANDGUNS_WEAPONS:
{
if (Option != -1)
{
if (Option > 0 && Option <= Menu_Options[playerid])
{
switch (Option)
{
case 1:
{
GivePlayerCommonWeapons(playerid);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received {0080FF}Default Weapons.");
}
case 2:
{
GivePlayerWeapon(playerid, 22, 4000);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}9mm Pistol.");
}
case 3:
{
GivePlayerWeapon(playerid, 23, 4000);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}Silenced Pistol.");
}
case 4:
{
GivePlayerWeapon(playerid, 24, 4000);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}Desert Eagle.");
}
case 5:
{
SHOW_WEAPONS(playerid);
}


}
}else{
SendClientMessage(playerid,COLOR_ERROR,"Invalid Selection");
}
}else{
SendClientMessage(playerid,COLOR_ERROR,"Invalid Selection");
}
}


case TD_MENU_MACHINES_WEAPONS:
{
if (Option != -1)
{
if (Option > 0 && Option <= Menu_Options[playerid])
{
switch (Option)
{
case 1:
{
GivePlayerCommonWeapons(playerid);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received {0080FF}Default Weapons.");
}
case 2:
{
GivePlayerWeapon(playerid, 28, 4000);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}Micro SMG/Uzi.");
}
case 3:
{
GivePlayerWeapon(playerid, 29, 4000);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}MP5.");
}
case 4:
{
GivePlayerWeapon(playerid, 32, 4000);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}Tec-9.");
}
case 5:
{
SHOW_WEAPONS(playerid);
}


}
}else{
SendClientMessage(playerid,COLOR_ERROR,"Invalid Selection");
}
}else{
SendClientMessage(playerid,COLOR_ERROR,"Invalid Selection");
}
}

case TD_MENU_ASSAULT_WEAPONS:
{
if (Option != -1)
{
if (Option > 0 && Option <= Menu_Options[playerid])
{
switch (Option)
{
case 1:
{
GivePlayerCommonWeapons(playerid);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received {0080FF}Default Weapons.");
}
case 2:
{
GivePlayerWeapon(playerid, 30, 4000);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}Ak-47.");
}
case 3:
{
GivePlayerWeapon(playerid, 31, 4000);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}M4.");
}
case 4:
{
SHOW_WEAPONS(playerid);
}


}
}else{
SendClientMessage(playerid,COLOR_ERROR,"Invalid Selection");
}
}else{
SendClientMessage(playerid,COLOR_ERROR,"Invalid Selection");
}
}

case TD_MENU_RIFLES_WEAPONS:
{
if (Option != -1)
{
if (Option > 0 && Option <= Menu_Options[playerid])
{
switch (Option)
{
case 1:
{
GivePlayerCommonWeapons(playerid);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received {0080FF}Default Weapons.");
}
case 2:
{
GivePlayerWeapon(playerid, 33, 4000);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}Country Rifle.");
}
case 3:
{
GivePlayerWeapon(playerid, 34, 4000);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}Sniper Rifle.");
}
case 4:
{
SHOW_WEAPONS(playerid);
}


}
}else{
SendClientMessage(playerid,COLOR_ERROR,"Invalid Selection");
}
}else{
SendClientMessage(playerid,COLOR_ERROR,"Invalid Selection");
}
}

case TD_MENU_SHOTGUN_WEAPONS:
{
if (Option != -1)
{
if (Option > 0 && Option <= Menu_Options[playerid])
{
switch (Option)
{
case 1:
{
GivePlayerCommonWeapons(playerid);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received {0080FF}Default Weapons.");
}
case 2:
{
GivePlayerWeapon(playerid, 25, 4000);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}Shotgun.");
}
case 3:
{
GivePlayerWeapon(playerid, 26, 4000);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}Sawnoff Shotgun.");
}
case 4:
{
GivePlayerWeapon(playerid, 27, 4000);
SendClientMessage(playerid, COLOR_WHITE,"You Have Received A {0080FF}Combat Shotgun.");
}
case 5:
{
SHOW_WEAPONS(playerid);
}


}
}else{
SendClientMessage(playerid,COLOR_ERROR,"Invalid Selection");
}
}else{
SendClientMessage(playerid,COLOR_ERROR,"Invalid Selection");
}
}

}
}
else
SendClientMessage(playerid,COLOR_ERROR,"Invalid Selection");
}
}
return 1;
}

Reply
#2

First of all use tags for entering code.

You want to save the weapons so that when ever he logs on he must get those weapons? Or what? If so what are you using sql or y_ini?
Reply
#3

y_ini , if player select "You Have Received A {0080FF}Combat Shotgun" weapons save it ..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)