new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]);
INI_Close(File);
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID && weaponid == 34) //weaponid == 34 = sniper rifle you can change that
{
//Small example if player shooted by sniper from first shoot he will die , you can edit that
SetPlayerHealth(playerid, 0.0); //and here you can edit the damage you want
}
return 1;
}
if(weaponid == 34) amount = 500.0; // If hit with sniper, the damage taking will be 500HP
And yet, it won't save the score. (The score is given once you kill someone.)
|
public OnPlayerDisconnect(playerid, reason) { INI_WriteInt(File,"Score",GetPlayerScore(playerid)); return 1; }
SetPlayerScore(playerid,INI_Int("Score"),PlayerInfo[playerid][pScore]);
In money, you use GetPlayerMoney, on score why don't use GetPlayerScore too?
|
Take a look at this for damage thing
https://sampforum.blast.hk/showthread.php?tid=330005 and for the score thing do this Код:
public OnPlayerDisconnect(playerid, reason) { INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]); return 1; } Код:
SetPlayerScore(playerid,INI_Int("Score"),PlayerInfo[playerid][pScore]); |
Both didn't work, and iFiras, I got like 4 errors when I used your code..
How for gods sake do I save the score lol? |
Man, it works for me fine but i don't know why it doesn't for you, it may be problems with your GM?
|
C:\Users\\Desktop\\gamemodes\zombie.pwn(1611) : error 029: invalid expression, assumed zero
C:\Users\\Desktop\\gamemodes\zombie.pwn(1611) : warning 202: number of arguments does not match definition
C:\Users\\Desktop\\gamemodes\zombie.pwn(1611) : error 017: undefined symbol "name"
C:\Users\\Desktop\\gamemodes\zombie.pwn(1611) : error 029: invalid expression, assumed zero
C:\Users\\Desktop\\gamemodes\zombie.pwn(1611) : fatal error 107: too many error messages on one line