/*  cavey.inc Revision 1  Latest version at http://gosh.ex.ac.uk/~py99jan/
                 I made this - Caveman ( ICQ 70710878 )                        */
 
#if defined _cavey_included
	#endinput
#endif
#define _cavey_included 1
 
stock bury(Data[]) {
	new Text[MAX_TEXT_LENGTH];
	if (check_user(Data) == 1) {
		new nIndex, nDead;
		new TargetName[MAX_NAME_LENGTH];
		get_userindex(Data, nIndex);
		playerinfo(nIndex, TargetName, MAX_NAME_LENGTH, _, _, _, nDead);
 
		if (nDead == 0) {
			new x, y, z;
			get_userorigin(TargetName, x, y, z);
			execclient(TargetName, "say Help! I'm stuck!");
			teleport(TargetName, x, y, (z-50));			
		} else {
			snprintf(Text, MAX_TEXT_LENGTH, "%s is dead. You can't bury them!", TargetName);
			selfmessage(Text);
		}
	} else {
		snprintf(Text, MAX_TEXT_LENGTH, "Unrecognized player: %s", Data);
		selfmessage(Text);
	}
}
 
stock plrinfo( iPlayerIndex, sName[], iLength, &iUserID = 0, sAuthID[MAX_AUTHID_LENGTH] = "", &iTeam = 0, &iDead = 0){
	new Dummy;
	if ( (iPlayerIndex <= maxplayercount()) && (iPlayerIndex >=1) ){
		return playerinfo(iPlayerIndex, sName, iLength, iUserID, Dummy, iTeam, iDead, sAuthID);
	}
	return 0;
}
 
stock split(sSource[], sToken[], sData1[], iLen1, sData2[], iLen2){
	new start = strcasestr(sSource,sToken);
	strncpy(sData1,sSource,start,iLen1);
	new j=0;
	for (new i=(start+strlen(sToken));((i<=strlen(sSource)) && (j<iLen2));i++){
		sData2[j++]=sSource[i];
	}
	sData2[j+1] = 0;
}
 
/*The following gets and store settings in the vault on init.*/
stock cavey_vault_init(sKey[], iDefault, &iValue){
	new cmnTemp[MAX_TEXT_LENGTH];
	strinit(cmnTemp);
	get_vaultdata(sKey, cmnTemp, MAX_TEXT_LENGTH);
	if (strlen(cmnTemp) != 0){
		iValue = strtonum(cmnTemp);
	} else {
		iValue = iDefault;
	}
	snprintf(cmnTemp,MAX_TEXT_LENGTH,"%d",iValue);
	set_vaultdata(sKey,cmnTemp);
 
}
 
/*Something to force a different error.  Ignore it*/
stock Update_Your_Cavey_Inc(sName[]){
	say(sName);
}