10.11.2011, 04:40
heey all,
I want to make a robhouse command if player is in someone's house.
But i dont know how i can define the owner of house and his deposited money.
Some codes:
Pls help me,this part is hard for me.
Thanks Admigo
I want to make a robhouse command if player is in someone's house.
But i dont know how i can define the owner of house and his deposited money.
Some codes:
Код:
dcmd_withdraw(playerid,params[]) { new withdraw; new file[100],Name[MAX_PLAYER_NAME]; GetPlayerName(playerid,Name,sizeof(Name)); format(file,sizeof(file),PlayerFile,Name); if(sscanf(params,"d",withdraw)) return SendClientMessage(playerid,COLOR_RED,"USAGE:/withdraw [Amount]"); else if(withdraw > pInfo[playerid][Deposit]) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount!"); else if(withdraw < 0) return SendClientMessage(playerid,COLOR_RED,"Invalid Amount!"); { } GivePlayerMoney(playerid, withdraw); pInfo[playerid][Deposit] -= withdraw; dini_IntSet(file,"Deposit",pInfo[playerid][Deposit]); SendClientMessage(playerid,COLOR_GREEN,"BANK"); new string[128]; format(string,sizeof(string),"You Have Withdrew : %d$",withdraw); SendClientMessage(playerid,COLOR_LIGHTBLUE,string); dini_IntSet(file,"Deposit",pInfo[playerid][Deposit]); new string2[128]; format(string2,128,"Your New Balance Is : %d$",pInfo[playerid][Deposit]); SendClientMessage(playerid,COLOR_LIGHTBLUE,string2); return 1; }
Код:
dcmd_enter(playerid,params[]) { #pragma unused params new str1[255],pname[24],housenumber; housenumber = GetHouseID(playerid); GetPlayerPos(playerid, housex, housey, housez); format(str1, sizeof(str1), "Houses/houseid%d", housenumber); GetPlayerName(playerid, pname, 24); if(strcmp(hInfo[housenumber][hName],pname,true)==0) { if(hInfo[housenumber][Locked]==1) return SendClientMessage(playerid, COLOR_RED, "Your house is Locked, if you want to unlock your house typ /hunlock !"); playerworld[playerid] = GetPlayerVirtualWorld(playerid); SendClientMessage(playerid, COLOR_LIGHTBLUE,"To exit the house typ /exit !"); SetPlayerVirtualWorld(playerid, hInfo[housenumber][Virtualworld]); SetPlayerInterior(playerid, hInfo[housenumber][Interior]); SetPlayerPos(playerid, hInfo[housenumber][InteriorX], hInfo[housenumber][InteriorY], hInfo[housenumber][InteriorZ]); playerinterior[playerid] = hInfo[housenumber][Interior]; SendClientMessage(playerid, COLOR_GREEN, "Welcome Home!"); IsInOwnHouse[playerid]=1; return 1; } if(hInfo[housenumber][Locked]==1) return SendClientMessage(playerid, COLOR_RED, "Your house is Locked, if you want to unlock your house typ /hunlock !"); playerworld[playerid] = GetPlayerVirtualWorld(playerid); SendClientMessage(playerid, COLOR_LIGHTBLUE,"To exit the house typ /exit !"); SetPlayerVirtualWorld(playerid, hInfo[housenumber][Virtualworld]); SetPlayerInterior(playerid, hInfo[housenumber][Interior]); SetPlayerPos(playerid, hInfo[housenumber][InteriorX], hInfo[housenumber][InteriorY], hInfo[housenumber][InteriorZ]); playerinterior[playerid] = hInfo[housenumber][Interior]; return 1; }
Thanks Admigo