SA-MP Forums Archive
Player score - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Player score (/showthread.php?tid=228882)



Player score - ajwar - 20.02.2011

I have a timer which works every minute. I wan't to make a script which adds player score ir player position has changed from the old checking. But this one won't work. Any id'eas what is wrong?
pawn Код:
public plusscore(playerid)
{

    if(!IsPlayerConnected(playerid)){KillTimer(timer1[playerid]); return 1;}
    new Float: pPos[3];

    if(pPos[0] != GetPVarFloat(playerid, "posX") || pPos[1] != GetPVarFloat(playerid, "posY") || pPos[2] != GetPVarFloat(playerid, "posZ"))
    {
         SetPlayerScore(playerid,GetPlayerScore(playerid)+random(2)+1);
    }
    GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
    SetPVarFloat(playerid, "posX", pPos[0]);
    SetPVarFloat(playerid, "posY", pPos[1]);
    SetPVarFloat(playerid, "posZ", pPos[2]);
    return 1;
}



Re: Player score - Cameltoe - 20.02.2011

Quote:
Originally Posted by ajwar
Посмотреть сообщение
I have a timer which works every minute. I wan't to make a script which adds player score ir player position has changed from the old checking. But this one won't work. Any id'eas what is wrong?
I would make an stock.
pawn Код:
stock IsInNewPos(playerid, Pos[])
{
     new nPos[3];
     GetPlayerPos(playerid, nPos[0], nPos[1], nPos[2]);
     if(Pos[0] != nPos[0] && Pos[1] != nPos[1] && Pos[2] != nPos[2]) return 1;
     return 0;
}
Then check doing :

pawn Код:
new Float:PlayerPos[MAX_PLAYERS][3];
public AddScore(playerid)
{
     if(IsInNewPos(playerid, PlayerPos[playerid]))
     {
          // Give points here
     }
     GetPlayerPos(playerid, PlayerPos[playerid][0], PlayerPos[playerid][1], PlayerPos[playerid][2]);
}



Re: Player score - ajwar - 20.02.2011

pawn Код:
if(IsInNewPos(playerid, PlayerPos[playerid]))
I get tag mismatch here.


Re: Player score - Cameltoe - 20.02.2011

Quote:
Originally Posted by ajwar
Посмотреть сообщение
pawn Код:
if(IsInNewPos(playerid, PlayerPos[playerid]))
I get tag mismatch here.
Yes ofc, should be :

pawn Код:
stock IsInNewPos(playerid, Float: Pos[])
{
     new Float: nPos[3];
     GetPlayerPos(playerid, nPos[0], nPos[1], nPos[2]);
     if(Pos[0] != nPos[0] && Pos[1] != nPos[1] && Pos[2] != nPos[2]) return 1;
     return 0;
}
Sorry, my bad


Re: Player score - ajwar - 20.02.2011

Thank you


Re: Player score - Cameltoe - 20.02.2011

Quote:
Originally Posted by ajwar
Посмотреть сообщение
Thank you
You're welcome, tell me if there's any luck with this script