PDA

View Full Version : Use a Filterscripts Class Selection Instead of Gamemode Class Selection


Eminem 2ka9
03/08/2012, 10:04 PM
I have a game mode, it already has class selection but I don't like it. The filterscript I have actually has a decent class selection with categories, but I'm not fully sure How to actually switch from gamemode class selection to my Filterscripts class selection. Would removing class selection from my gamemode do this automatically? I don't know!

Thanks a lot.

Sascha
03/08/2012, 10:05 PM
what about trying it out?

Eminem 2ka9
03/08/2012, 10:15 PM
Hm I'm not fully sure what to remove, I could corrupt my Gamemode.

Sascha
03/08/2012, 10:20 PM
There are those "cool" comment "features"....
at your "OnPlayerRequestClass" callback, simply comment everything out... like this:

public OnPlayerRequestClass(playerid, classid)
{
/*
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
*/
return 1;
}


the /* is the start symbol. Write it before the part you want to "comment out"... the */ defines the end of the comment....
this way you don't have to delete anything and can simply restore it later, and the script simply ignores it ;)

Eminem 2ka9
03/08/2012, 10:30 PM
It doesn't seem to be working. When I start up the server and when the screen comes to class selection, It doesn't show any character just the camera is still pointing in the direction just no characters. And I can cycle through the classes and end up with a random one :|

Sascha
03/08/2012, 10:31 PM
then simply try to copy the OnPlayerRequestClass part into your gamemode ;)
atleast basic parts like "SetPlayerPos", "SetPlayerFacingAngle", "SetPlayerCameraPos", "SetPlayerCameraLookAt", whatever

Eminem 2ka9
03/08/2012, 10:34 PM
Will I remove them from gamemode and put them into my filterscript?
It already has its own!

//======================CLASSES FUNCTIONS=====================//
new gPlayerClass[MAX_PLAYERS];

public OnPlayerRequestClass(playerid, classid)

{

gPlayerClass[playerid] = ASSAULT_CLASS;

return 1;

}

Sascha
03/08/2012, 10:36 PM
the other way 'round ;)
copy them from your filterscript and paste them into your gamemode.
For safety you should firstly copy it underneath the out commented part, so you still have the old "backup"

HarlemSAMP
03/08/2012, 10:36 PM
Eminem, i suggest you to backup your script, just make a copy of it with a different name, then just mess around with it, that helped me alot when i was new to scripting

Eminem 2ka9
03/08/2012, 10:38 PM
Oh ok I getcha, thanks I'm new to scripting I'll try that thanks.

HarlemSAMP
03/08/2012, 10:41 PM
No worries and do what Sascha said, once you backed up your script

Eminem 2ka9
03/08/2012, 10:53 PM
Ok Um I pasted all of this: and I seem to be getting 4 errors on line 1531?

LINE 1531: PickedClass[playerid] = 1;

ERRORS:
C:\Users\Administration\Desktop\My Script\gamemodes\MyScript.pwn(1531) : error 017: undefined symbol "PickedClass"
C:\Users\Administration\Desktop\My Script\gamemodes\MyScript.pwn(1531) : warning 215: expression has no effect
C:\Users\Administration\Desktop\My Script\gamemodes\MyScript.pwn(1531) : error 001: expected token: ";", but found "]"
C:\Users\Administration\Desktop\My Script\gamemodes\MyScript.pwn(1531) : error 029: invalid expression, assumed zero
C:\Users\Administration\Desktop\My Script\gamemodes\MyScript.pwn(1531) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
















----------------------------------------------------------------------------------------------------------------

//============================Dialog System===================================//
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
if(response)
{

if(GetPlayerScore(playerid) <= 0)//Private
{

SetPlayerSkin(playerid, 287);
SendClientMessage(playerid, COLOR_WHITE, "You chose the assault as your class.");
SendClientMessage(playerid, COLOR_WHITE, "You can type /switchclass to change your class again.");
gPlayerClass[playerid] = ASSAULT_CLASS;
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
GivePlayerWeapon(playerid, 24, 200);
GivePlayerWeapon(playerid, 31, 500);
GivePlayerWeapon(playerid, 17, 5);
}
}


if(listitem == 1)//sniper DONE
{
if(GetPlayerScore(playerid) <= 10)//Private

{

SetPlayerSkin(playerid, 122);
SendClientMessage(playerid, COLOR_WHITE, "You chose the Sniper as your class.");
SendClientMessage(playerid, COLOR_WHITE, "You can type /switchclass to change your class again.");
gPlayerClass[playerid] = SNIPER_CLASS;
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
GivePlayerWeapon(playerid, 23, 500);
GivePlayerWeapon(playerid, 34, 100);
GivePlayerWeapon(playerid, 29, 200);

}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You need to be atleast Private class [/rank to see yours]");
TogglePlayerControllable(playerid, 0);
}
}


if(listitem == 2)//pilot DONE
{
if(GetPlayerScore(playerid) <= 1150)//Lieutenant Colonel

{

SetPlayerSkin(playerid, 61);
SendClientMessage(playerid, COLOR_WHITE, "You chose the Pilot as your class.");
SendClientMessage(playerid, COLOR_WHITE, "You can type /switchclass to change your class again.");
gPlayerClass[playerid] = AIRMAN_CLASS;
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
GivePlayerWeapon(playerid, 22, 50);
GivePlayerWeapon(playerid, 29, 500);
GivePlayerWeapon(playerid, 16, 5);

}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You need to be atleast Lieutenant Colonel class [/rank to see yours]");
TogglePlayerControllable(playerid, 0);
}
}
if(listitem == 3)//Engineer
{
if(GetPlayerScore(playerid) <= 250)//Sergeant

{
SetPlayerSkin(playerid, 285);
SendClientMessage(playerid, COLOR_WHITE, "You chose the Engineer as your class.");
SendClientMessage(playerid, COLOR_WHITE, "You can type /switchclass to change your class again.");
gPlayerClass[playerid] = ENGINEER_CLASS;
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
GivePlayerWeapon(playerid, 22, 100);
GivePlayerWeapon(playerid, 32, 500);
GivePlayerWeapon(playerid, 35, 5);


}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You need to be atleast Sergeant class [/rank to see yours]");
TogglePlayerControllable(playerid, 0);
}
}

if(listitem == 4)//FlameThrower
{
if(GetPlayerScore(playerid) <= 400)//CAPTAIN

{

SetPlayerSkin(playerid, 144);
SendClientMessage(playerid, COLOR_WHITE, "You chose the Flamethrower as your class.");
SendClientMessage(playerid, COLOR_WHITE, "You can type /switchclass to change your class again.");
gPlayerClass[playerid] = FLAMETHROWER_CLASS;
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
GivePlayerWeapon(playerid, 24, 200);
GivePlayerWeapon(playerid, 30, 200);
GivePlayerWeapon(playerid, 37, 200);


}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You need to be atleast Captain class [/rank to see yours]");
TogglePlayerControllable(playerid, 0);
}
}
return 1;
}
return 1;
}

HarlemSAMP
04/08/2012, 05:00 AM
The code looks like a mess, try uploading the errors in [.code][./code] and the pawn script in [.PAWN][./PAWN] in order we can help you, without dots "."

Make sure you have new PickedClass[MAX_PLAYERS] you need to define it in order to work.