server 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)
+--- Thread: server score (
/showthread.php?tid=293057)
server score -
hitman% - 26.10.2011
hi all
i need an help in my serevr i cant save score i am using satdm server
can any one giveb the code of savign score
Re: server score -
grand.Theft.Otto - 27.10.2011
You have to use DINI / YINI to save data to a text editing file.
When your score data is saved with one of those on disconnect, it will write the score to your userfile in your server directory. When you connect next, your file will be read, therefore the score that was written to your userfile, should load.
Search some tutorials for dini / yini.
Re: server score -
hitman% - 28.10.2011
can you make an filterscript of save score and send plz...
Re: server score -
SmiT - 28.10.2011
Here is an example:
pawn Код:
#include <a_samp>
#include <YSI\y_ini>
enum PLAYER_ENUM
{
pScore
}
new pVar[ MAX_PLAYERS ][ PLAYER_ENUM ];
forward load_user_score(playerid,name[],value[]);
public load_user_score(playerid,name[],value[])
{
INI_Int("Score", pVar[ playerid ][ pScore ]);
return true;
}
stock USER_PATH(playerid)
{
new
_str[ 128 ],P_NAME[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, P_NAME, MAX_PLAYER_NAME );
format( _str, sizeof ( _str ), "%s.ini", P_NAME );
return _str;
}
public OnPlayerConnect( playerid )
{
pVar[ playerid ][ pScore ] = 0;
INI_ParseFile( USER_PATH ( playerid ), "load_user_%s", .bExtra = true, .extra = playerid );
SetPlayerScore( playerid, pVar[ playerid ][ pScore ] );
return true;
}
public OnPlayerDisconnect( playerid, reason )
{
new INI:File = INI_Open( USER_PATH ( playerid ));
INI_SetTag(File,"score");
INI_WriteInt(File,"Score", GetPlayerScore( playerid ));
INI_Close(File);
return true;
}
public OnPlayerDeath( playerid, killerid, reason )
{
if ( killerid != INVALID_PLAYER_ID )
{
SetPlayerScore( killerid, GetPlayerScore( killerid ) + 1 );
}
return true;
}
Re: server score -
hitman% - 28.10.2011
i need to download - <YSI\y_ini>
any one can give link
Re: server score -
hitman% - 28.10.2011
it showing some error
Quote:
C:\Users\hp\Desktop\test\Gamemodes\SATDM~RP13.pwn( 37799) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\hp\Desktop\test\Gamemodes\SATDM~RP13.pwn( 37801) : error 035: argument type mismatch (argument 2)
C:\Users\hp\Desktop\test\Gamemodes\SATDM~RP13.pwn( 37816) : error 021: symbol already defined: "Streamer_OnPlayerConnect"
C:\Users\hp\Desktop\test\Gamemodes\SATDM~RP13.pwn( 37824) : error 021: symbol already defined: "Streamer_OnPlayerDisconnect"
C:\Users\hp\Desktop\test\Gamemodes\SATDM~RP13.pwn( 37833) : error 021: symbol already defined: "OnPlayerDeath"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
|
Re: server score -
hitman% - 01.11.2011
helwwww nyone plsssssss help
Re: server score -
GAMER_PS2 - 01.11.2011
Dude are you blind the error will help you to figure out the answer it gives you error because
OnPlayerConnect is already there delete your old OnPlayerConnect
OnPlayerDeath is also already there you need to delete the old OnPlayerDeath
this is the reason why you have those 2 errors the other one is idk...
Re: server score -
Unte99 - 01.11.2011
There are two variables with the same naming. You have to change one to:
pawn Код:
new name2[MAX_PLAYER_NAME]; or new name2[24];
Just use search (Ctrl+f) and change the naming. And show us the 37801 line.
Re: server score -
hitman% - 02.11.2011
Thnx Alll!!!!!!!!