OnPlayerGiveDemage..
#1

Hello everyone, I am currently developing a 'different' gamemode, as I never seen before, and I am wondering...how can I give the weapons higher demage? Let's say 1 hit will take down, 500 HP?

And another problem of mine, is that the playerscore won't save..I don't know why tho'.
Here's my disconnect.

pawn Код:
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);
And here's my login..
pawn Код:
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
And yet, it won't save the score. (The score is given once you kill someone.)

Thanks in advance!
Reply
#2

pawn Код:
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;
}
Reply
#3

I guess you can set the amount of a weapon like so:
pawn Код:
if(weaponid == 34) amount = 500.0; // If hit with sniper, the damage taking will be 500HP
Reply
#4

Quote:
Originally Posted by CesarLT
Посмотреть сообщение
And yet, it won't save the score. (The score is given once you kill someone.)
In money, you use GetPlayerMoney, on score why don't use GetPlayerScore too?
Reply
#5

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",GetPlayerScore(playerid));
return 1;
}
When player login
Код:
SetPlayerScore(playerid,INI_Int("Score"),PlayerInfo[playerid][pScore]);
+Rep if it works
Reply
#6

Quote:
Originally Posted by ]Rafaellos[
Посмотреть сообщение
In money, you use GetPlayerMoney, on score why don't use GetPlayerScore too?
Quote:
Originally Posted by iFiras
Посмотреть сообщение
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;
}
When player login
Код:
SetPlayerScore(playerid,INI_Int("Score"),PlayerInfo[playerid][pScore]);
+Rep if it works
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?
Reply
#7

Quote:
Originally Posted by CesarLT
Посмотреть сообщение
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?
Reply
#8

Quote:
Originally Posted by iFiras
Посмотреть сообщение
Man, it works for me fine but i don't know why it doesn't for you, it may be problems with your GM?
How could it be? :O
Lol, let me show to you the errors..
pawn Код:
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
Reply
#9

I don't see any "name" to his code so it's not from his code. Show us line 1611.

And GetPlayerScore returns the player's score (similar to GetPlayerMoney function).
Reply
#10

Can you show me error line 1611 please?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)