Weapons -
HighPitchedVoice - 24.05.2012
When a player select a class, how can I do so he get the specific weapon I selected? Where should I put this under, OnPlayerSpawn?
Re: Weapons -
HighPitchedVoice - 24.05.2012
Where should I put it under and is it going to be; GivePlayerWeapon(playerid, 24);?
Re: Weapons - Jarnu - 24.05.2012
Can you explain a bit more? i didn't understood what you asking.. and from your line i am just thinking that you are asking about when a player select class in how to give him weapon? if yes then use following code:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == dialogid)
{
if(response)
{
if(listitem == 0)
{
//Here will be your codes.. whatever they are.. just add these lines in them.:
GivePlayerWeapon(playerid, 27, 150);//Spas
GivePlayerWeapon(playerid, 31, 200);//m4
GivePlayerWeapon(playerid, 25, 100);//mp5
GivePlayerWeapon(playerid, 24, 70);//deagle
return 1;
}
}
its so simple
Re: Weapons -
HighPitchedVoice - 24.05.2012
I want each class to have different weapons but I don't really know how the script can give him it on OnPlayerSpawn, any tips?
Re: Weapons - Jarnu - 24.05.2012
well dude.. i hope you will get help with my script..
pawn Код:
OnPlayerSpawn(playerid)
{
ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST,"Select Class","Soldier/nSniper/nEngineer/nPilot","Choose","");
return 1;
}
Then Use following Lines..
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 999)//dialog id response
{
if(response)
{
if(listitem == 0)//the listitem0, defines the number one option of the dialog
{
if(GetPlayerScore(playerid) >= 0)//if player have 0 score then he can choose this class
{
SendClientMessage(playerid, COLOR_WHITE, "You chose the Soldier as your class.");
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Soldier Class:", "{F81414}Abilities:\n{FFFFFF}A Solo class, good in infantry attacks.\n\n{F81414}Weapons:\n\n{FFFFFF}M4\n{FFFFFF}Shotgun\n{FFFFFF}Deagle", "Play","");
gPlayerClass[playerid] = SOLDIER;//setting the class to soldier
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 27, 150);//Spas
GivePlayerWeapon(playerid, 31, 200);//m4
GivePlayerWeapon(playerid, 25, 100);//mp5
GivePlayerWeapon(playerid, 24, 70);//deagle
return 1;
}
}
if(listitem == 1)//the listitem1, defines the number one option of the dialog
{
if(GetPlayerScore(playerid) >= 0)//if player have 0 score then he can choose this class
{
SendClientMessage(playerid, COLOR_WHITE, "You chose the Sniper as your class.");
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Sniper Class:", "{F81414}Abilities:\n{FFFFFF}A Locater class, Always invisible on map.\n\n{F81414}Weapons:\n\n{FFFFFF}Sniper Rifle\n{FFFFFF}Mp5\n{FFFFFF}Knife", "Play","");
gPlayerClass[playerid] = SNIPER;//setting the class to Sniper
PickedClass[playerid] = 1;
RemovePlayerMapIcon(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 34, 250);//sniper
GivePlayerWeapon(playerid, 29, 250);//mp5
GivePlayerWeapon(playerid, 4, 1);//knife
return 1;
}
}
if(listitem == 2)//the listitem2, defines the number one option of the dialog
{
if(GetPlayerScore(playerid) >= 100)//if player have 0 score then he can choose this class
{
SendClientMessage(playerid, COLOR_WHITE, "You chose the Engineer as your class.");
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Engineer Class:", "{F81414}Abilities:\n{FFFFFF}A Strong class, Good in both land and air\nCan drive tanks.\n\n{F81414}Weapons:\n\n{FFFFFF}Spas12\n{FFFFFF}Silent Pistol\n{FFFFFF}RPG\n{FFFFFF}Grenade", "Play","");
gPlayerClass[playerid] = ENGINEER;//setting the class to engineer
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 27, 200);//spas12
GivePlayerWeapon(playerid, 23, 200);//silent pistol
GivePlayerWeapon(playerid, 35, 2);//rpg
GivePlayerWeapon(playerid, 16, 2);//grenade
return 1;
}
}
if(listitem == 3)//the listitem3, defines the number one option of the dialog
{
if(GetPlayerScore(playerid) >= 250)//if player have 0 score then he can choose this class
{
SendClientMessage(playerid, COLOR_WHITE, "You chose the Pilot as your class.");
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Pilot Class:", "{F81414}Abilities:\n{FFFFFF}An Airforce class, Can drive hydra.\n\n{F81414}Weapons:\n\n{FFFFFF}Deagle\n{FFFFFF}Tear Gas\n{FFFFFF}Shotgun", "Play","");
gPlayerClass[playerid] = PILOT;//setting the class to pilot
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 24, 200);//deagle
GivePlayerWeapon(playerid, 17, 4);//moltove
GivePlayerWeapon(playerid, 25, 100);//shotgun
return 1;
}
}
}
}
}
hoep this would have helped you ^^ You can use your own Classes except this.
Re: Weapons -
HighPitchedVoice - 24.05.2012
I don't want a dialog...
pawn Код:
SetPlayerTeamFromClass(playerid, classid)
{
if(classid == 0)
{
gTeam[playerid] = TEAM_MAFIA;
GameTextForPlayer(playerid, "Mafia", 2000, 5);
}
else if(classid == 1)
{
gTeam[playerid] = TEAM_POLICE;
GameTextForPlayer(playerid, "Police", 2000, 5);
}
else if(classid == 2)
{
gTeam[playerid] = TEAM_GROVE;
GameTextForPlayer(playerid, "Grove", 2000, 5);
}
else if(classid == 3)
{
gTeam[playerid] = TEAM_BALLAS;
GameTextForPlayer(playerid, "Ballas", 2000, 5);
}
else if(classid == 4)
{
gTeam[playerid] = TEAM_BIKERS;
GameTextForPlayer(playerid, "Bikers", 2000, 5);
}
return 1;
}
//------------------------------------------------------------------------------
SetPlayerToTeamColor(playerid)
{
if(gTeam[playerid] == TEAM_MAFIA)
{
SetPlayerColor(playerid, COLOR_MAFIA);
}
else if(gTeam[playerid] == TEAM_POLICE)
{
SetPlayerColor(playerid, POLICE_COLOR);
}
else if(gTeam[playerid] == TEAM_GROVE)
{
SetPlayerColor(playerid, GROVE_COLOR);
}
else if(gTeam[playerid] == TEAM_BALLAS)
{
SetPlayerColor(playerid, BALLAS_COLOR);
}
else if(gTeam[playerid] == TEAM_BIKERS)
{
SetPlayerColor(playerid, BIKERS_COLOR);
}
}
Re: Weapons - Jarnu - 24.05.2012
try to add GivePlayerWeapon beyond gTeam[playerid] may it will help you.. try it..
Re: Weapons -
vIBIENNYx - 24.05.2012
You can do it on
pawn Код:
AddPlayerClass(skin, Float:x, Float:y, Float:z, Float:Angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
Re: Weapons -
SuperViper - 24.05.2012
You can do it in AddPlayerClass or you can do it in OnPlayerSpawn like this:
pawn Код:
public OnPlayerSpawn(playerid)
{
switch(gTeam[playerid])
{
case TEAM_MAFIA:
{
GivePlayerWeapon(playerid, 38, 65535);
}
case TEAM_POLICE:
{
GivePlayerWeapon(playerid, 37, 65535);
}
}
}