All pastes #352483 Raw Edit

Stuff

public text v1 · immutable
·published 2007-02-12 21:10 UTC
rendered paste body
// Parts from Dracoblue's Dprop (if you already have Dprop, just take the GetLevel function)


PropertyExists(name[])
{
    if (existproperty(0, "",dprop_PRIVATE_hash(name))) return true;
    return false;
}
#pragma unused PropertyExists


PropertyGet(name[])
{
    new value[255];
    getproperty(0, "", dprop_PRIVATE_hash(name), value);
    strunpack(value,value);
    return value;
}
#pragma unused PropertyGet


dprop_PRIVATE_hash(buf[])
{
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}
#pragma unused dprop_PRIVATE_hash




GetLevel(playerid)
{
    new xplayerid[20];
    format(xplayerid,20,"player%dlevel",playerid);
    if(!PropertyExists(xplayerid)) return 0;
    return strval(PropertyGet(xplayerid));
}
#pragma unused GetLevel