SA-MP Forums Archive
Score system - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Score system (/showthread.php?tid=561328)



Score system - _GHT_MarK445 - 02.02.2015

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.


Re: Score system - _GHT_MarK445 - 02.02.2015

Will someone be please enabled to help me with this?


Re: Score system - CalvinC - 02.02.2015

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.


Re: Score system - _GHT_MarK445 - 02.02.2015

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?


Re: Score system - CalvinC - 03.02.2015

Example:
pawn Код:
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.


Re: Score system - _GHT_MarK445 - 04.02.2015

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.


Re: Score system - _GHT_MarK445 - 10.02.2015

Bump...

Please, please help me.


AW: Score system - Saize - 10.02.2015

Use the Wiki maybe?

Check GetPlayerScore(); and SetPlayerScore();


Re: Score system - CalvinC - 10.02.2015

Then use OnPlayerKeyStateChange or GetPlayerKeys to check if a player presses a key.


Re: Score system - Beckett - 10.02.2015

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.