player onDeath
#1

I have a register system filterscrip with onPlayerConnect i set the deaths to 0,

PHP код:
public OnPlayerConnect(playerid) {
    
playerinfo[MAX_PLAYERS][deaths] = 0;

but in my gamemode function onPlayerDeath i want to add to that value

should i save the value to a database in sqllight,
and get the deaths from db_query 'onPlayerDeath'
or
should i just set the values in the gamemode file so i dont have to use a database
Reply
#2

Did you try to add "playerinfo[playerid][deaths]++;" on "OnPlayerDeath" and then save it with your register system?
Reply
#3

You should increment the variable under OnPlayerDeath then save it either when they disconnect (OnPlayerDisconnect) or periodically (every 5 minutes or so).

Storing it as soon as it's increased wouldn't be a massive issue though. I do that for some 'important' stats that players wouldn't want to lose. This isn't really one of those though.
Reply
#4

Quote:
Originally Posted by MP2
Посмотреть сообщение
You should increment the variable under OnPlayerDeath then save it either when they disconnect (OnPlayerDisconnect) or periodically (every 5 minutes or so).

Storing it as soon as it's increased wouldn't be a massive issue though. I do that for some 'important' stats that players wouldn't want to lose. This isn't really one of those though.
Yea i dont think they would mine one or two missing.
I think ill up date it on player death,
but should i update it on both the register system and gamemode "onplayerDeath"
Reply
#5

Having the registration system in a filterscript isn't really the done thing. The gamemode is where it belongs. Filterscripts are for scripts running alongside the gamemode. Core stuff (such as this) should be in the gamemode.
Reply
#6

Quote:
Originally Posted by MP2
Посмотреть сообщение
Having the registration system in a filterscript isn't really the done thing. The gamemode is where it belongs. Filterscripts are for scripts running alongside the gamemode. Core stuff (such as this) should be in the gamemode.
Yea sorry im just starting off and im going with what i learn.
its sound right and alot easyier then it is but...is this what i should do ?

i should create a register system in gamemode
use filterscrips for Missions "trucking/gargage man"
any data need for filterscrips i can get with db_query

something like a "Bank" can i place inside gamemode
or should i make a filter scrips for that ?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)