PDA

View Full Version : Score system


_GHT_MarK445
02/02/2015, 03:37 PM
Hi guys,

i am here with another problem, i mean not a problem but.. question.

The thing i need is I cant find on internet or this forums some script witch will be like score system and stuff.

I will tell you what exactly i need.

I have an Cops vs Thief and I need a score system that will work for everybody.

So I got team Cop witch I need to be required by for example 50 points, so In OnPlayerRequestClass the player will be not enabled to select Cop if he will not have 50 points.

This is my OnPlayerRequestClass:
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 226.5244,2508.5847,16.5112);
SetPlayerCameraPos(playerid, 244.7385,2508.5847,16.5092);
SetPlayerCameraLookAt(playerid, 226.5244,2508.5847,16.5112);
switch(classid)
{
case 0:
{
GameTextForPlayer(playerid, "~r~Thief", 4000, 3);
SetPlayerTeam(playerid, Thief);
}
case 1:
{
GameTextForPlayer(playerid, "~r~Cop", 4000, 3);
SetPlayerTeam(playerid, Cop);
}
}
return 1;
}

Everything works just fine, but I need to do, what i described up. I would be really thankful.

And the second thing is how to set these points and save them. I got my register system but I really need to save this points somehow.


And last thing about the missions. Or just commands, you can just write me how and I will. If someone for example complete mission that I would make, it will give him 50 points.

Thanks guys, i just need to know how to do it and beleive me I will do it.

_GHT_MarK445
02/02/2015, 07:57 PM
Will someone be please enabled to help me with this?

CalvinC
02/02/2015, 08:03 PM
SetPlayerScore to set his score, and GetPlayerScore to detect his current score.
So use GetPlayerScore and then save it with an saving system, MySQL, SQLite, y_ini etc.

_GHT_MarK445
02/02/2015, 08:31 PM
I am really big newbie, And... really? I didnt understand what you just said.

With (Set and Get) how can i make, that in the class selection, the player will be not enable to select the class without these points?..

Can you please describe more?

CalvinC
03/02/2015, 05:55 AM
Example:
case 1:
{
if(GetPlayerScore < 50) SendClientMessage(playerid, -1, "You need 50 score to be a cop.");
else
{
GameTextForPlayer(playerid, "~r~Cop", 4000, 3);
SetPlayerTeam(playerid, Cop);
}
}
Should make him unable to spawn as a cop if he has less than 50 score.

_GHT_MarK445
04/02/2015, 05:51 PM
Awesome! But.. if I am selecting skins, it is not working, it is not showing me the skin of the COP guy, and I need it like it will be normally enabled to be seen but if he press shift or Select, it will write him the message showed above.

_GHT_MarK445
10/02/2015, 12:14 PM
Bump...

Please, please help me.

Saize
10/02/2015, 12:16 PM
Use the Wiki maybe?

Check GetPlayerScore(); and SetPlayerScore();

CalvinC
10/02/2015, 12:25 PM
Then use OnPlayerKeyStateChange or GetPlayerKeys to check if a player presses a key.

DaniceMcHarley
10/02/2015, 12:26 PM
Are you saving their score, if yes then it's quite easy. Be sure to set their score upon connection and then check if their score is at the required amount by GetPlayerScore.

_GHT_MarK445
10/02/2015, 12:29 PM
Oh guys, i would not write here If i would not read wiki.

I tryed everything and its still the same, when I am selecting class, the server responds to me "You do not have enough score to use this character." but the character is not showing me up.

I need to do it like the every single character will be shown up in the class selection (even the character which cost more points, that the player got) and when he will want to press Shift on the character selection (select him) than it will check his points, and write him the message

I need the code help, because I do not understand english so much, that I can understand everything guys that you are explaining me.

CalvinC
10/02/2015, 12:34 PM
As i said, use OnPlayerKeyStateChange or GetPlayerKeys to detect which key a player presses.
http://wiki.sa-mp.com/wiki/GetPlayerKeys
http://wiki.sa-mp.com/wiki/OnPlayerKeyStateChange
Example:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if((newkeys & KEY_JUMP) && !(oldkeys & KEY_JUMP)) // Detects if the player presses KEY_JUMP (SHIFT by default)
{
// Codes
}
return 1;
}

_GHT_MarK445
10/02/2015, 01:02 PM
Solved.