How do I modify other player's variables?

Posted by rggames
I'm using the 2d shooter gml example and I added an XP and level up system. That works, but I can't make it so when a player dies the other player's xp variable increases.
How do i do that. here's the code:

//Check whether we created the instance.. ..or the instance was created by someone on the
// same team.
if(other.owner != gms_self_playerid())
{
//If we didn't create the instance & it wasn't created by someone on the same team..
//..we get hit.
hp -= 5*choose(1, 2, 3)-def*2
effect_create_above(ef_explosion, x, y, 0, c_red);

if(hp < 0)//Show a message "... was killed by ..."
{
gms_chat(" was killed by " + gms_other_get_string(other.owner, "name"), c_red);
gms_p2p_send(p2p_kill, other.owner);

other.owner.xp+=10

instance_destroy();
}

with(other)
instance_destroy();
}

Replies (0)

Last message on 25 May 2020