• Welcome to Vice City Multiplayer.
 

Property System (With /c addprop)

Started by Robd, March 29, 2011, 02:31:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Robd

Please forgive me if anything is missing. If you get any errors please report them and I will probably know what's wrong.

Original GUPS property commands (the ones that are not modified)
else if (strcmp(cmd, "!buyprop", true) == 0) {
new szMsg[256],cost,prop,owner;
tmp = strtok(cmdtext,idx);
prop = dini_Int(file, "prop");
cost = dini_Int("/Properties/prices.ini", tmp);
    if (PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid,COLOR_GREEN,"You have to log in first");
    else if(!strlen(tmp)) SendClientMessage(playerid,COLOR_GREEN, "USAGE: !buyprop [PropertyID]");
    else if(prop == 2) SendClientMessage(playerid,COLOR_GREEN,"You can only own 2 props");
    else if(!IsPropertyForSale(tmp)) SendClientMessage(playerid,COLOR_GREEN, "Error: That prop is not for sale!");
else if (GetPlayerHandCash(gPlayers[playerid]) < cost) SendClientMessage(playerid,COLOR_GREEN,"Not enough money");
else {
new prop2;
prop2 = prop +1;
format(szMsg,sizeof(szMsg),"%d",prop2);
dini_Set(file, "Prop", szMsg);
dini_Set("/Properties/owners.ini", tmp, gPlayers[playerid]);
SendClientMessage(playerid,COLOR_GREEN,"You succesfully bought a property");
SendClientMessage(playerid,COLOR_GREEN,"You can use !propname to change its name");
DecPlayerHandCash(playerid,cost);
}
return 1;
}
else if (strcmp(cmd, "!sellprop", true) == 0) {
new prop;
prop = prop = dini_Int(file, "prop");
    tmp = strtok(cmdtext, idx);
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
else if(!strlen(tmp)) SendClientMessage(playerid,COLOR_GREEN, "USAGE: !sellprop [PropertyID]");
else if(!IsPropertyExist(tmp)) SendClientMessage(playerid,COLOR_GREEN, "Error: Unknown Property");
else if(!IsPropertyOwner(tmp,playerid)) SendClientMessage(playerid,COLOR_GREEN, "Error: That property is not yours!");
else {
new cost,prop2,szMsg[256]; cost = GetPropertyCost(tmp);
prop = prop -1;
format(szMsg,sizeof(szMsg),"%d",prop2);
dini_Set(file, "Prop", szMsg);
format(file, sizeof(file), "/Properties/owners.ini", "owners");
dini_Set(file, tmp, "none");
IncPlayerHandCash(playerid,cost);
format(szMsg,sizeof(szMsg),"Property Sold! Earned:[ $%d ]",cost);
SendClientMessage(playerid,COLOR_GREEN,szMsg);
}
return 1;
}
else if (strcmp(cmd, "!propname", true) == 0) {
new tmp2[256];
        tmp = strtok(cmdtext, idx),tmp2 = strtok(cmdtext, idx);
        if(!strlen(tmp2)) SendClientMessage(playerid,COLOR_GREEN,"Use !propname <propid> <name>");
else if(!IsPropertyOwner(tmp,playerid)) SendClientMessage(playerid,COLOR_GREEN, "Error: That property is not yours!");
else {
dini_Set("/Properties/names.ini",tmp,tmp2);
SendClientMessage(playerid,COLOR_GREEN,"Property name set");
}
}
else if (strcmp(cmd, "!shareprop", true) == 0) {
    new tmp2[256], plr; tmp = strtok(cmdtext, idx), tmp2 = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp2);
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
else if(!strlen(tmp2)) SendClientMessage(playerid,COLOR_GREEN, "USAGE: !shareprop [PropertyID] [Nick/ID]");
else if(!IsPropertyExist(tmp)) SendClientMessage(playerid,COLOR_GREEN, "Error: Unknown Property");
else if(!IsPropertyOwner(tmp,playerid)) SendClientMessage(playerid,COLOR_GREEN, "Error: You do not own that property!");
else if(plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
else if(IsPropertyShared(tmp)) SendClientMessage(playerid,COLOR_RED,"Error: Property already shared.");
else {
if(!IsPlayerRegistered(gPlayers[plr])) {
format(szMsg,sizeof(szMsg),"Error: %s is not a registered nick!",gPlayers[plr]);
SendClientMessageToAll(COLOR_GREEN,szMsg);
return 1;
}
format(file, sizeof(file), "/Properties/share.ini", "share");
dini_Set(file, tmp, gPlayers[plr]);

format(szMsg,sizeof(szMsg),"Property shared with:[ %s ]",gPlayers[plr]);
SendClientMessage(playerid,COLOR_GREEN,szMsg);
}
return 1;
}
else if (strcmp(cmd, "!delshareprop", true) == 0) {
    tmp = strtok(cmdtext, idx);
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
else if(!strlen(tmp)) SendClientMessage(playerid,COLOR_GREEN, "USAGE: !delshareprop [PropertyID]");
else if(!IsPropertyExist(tmp)) SendClientMessage(playerid,COLOR_GREEN, "Error: Unknown Property");
else if(!IsPropertyOwner(tmp,playerid)) SendClientMessage(playerid,COLOR_GREEN, "Error: You do not own that property!");
else if(!IsPropertyShared(tmp)) SendClientMessage(playerid,COLOR_RED,"Error: That property is not shared.");
else {
format(file, sizeof(file), "/Properties/share.ini", "share");
dini_Set(file, tmp, "none");

format(szMsg,sizeof(szMsg),"Property:[ %s ] share deleted.",tmp);
SendClientMessage(playerid,COLOR_GREEN,szMsg);
}
return 1;
}

**Modified from GUPS**

Before starting add the following INIs in /scriptfiles/properts (if you dont have this directory just make it)

  • sum.ini
  • income.ini
  • names.ini
  • prices.ini
  • owners.ini
  • share.ini
Add this somehwere below all the #define lines

enum picInfo
{
isprop,
propname,
income,
incomes,
collections
}

enum sInfo
{
incomes,
pickup
}

new ServerInfo[1][sInfo];
new PickupInfo[200][picInfo];


Add to OnGameModeInit

LoadProps()

Somewhere at the bottom of script

public LoadProps()
{
print("Loading props, please wait...");
new XU;
if(!dini_Exists("/Properties/sum.ini")) return -1;
new data[7][256];
for (XU=1; XU<=250; XU++) {
new pos[256],fm[6];
format(fm,sizeof(fm),"%d",XU);
pos = dini_Get("/Properties/sum.ini",fm);
if (strlen(pos)) {
split(pos,data,' ');
ServerInfo[0][pickup] = ServerInfo[0][pickup] +1;
AddStaticPickup(ServerInfo[0][pickup],407,strval(data[0]),floatstr(data[1]),floatstr(data[2]));
//printf("Creating Prop! Pickup ID:%d Prop ID: %d",ServerInfo[0][pickup],XU);
PickupInfo[ServerInfo[0][pickup]][isprop] = 1;
PickupInfo[ServerInfo[0][pickup]][propname] = XU;
new szMsg[256];
format(szMsg,sizeof(szMsg),"%d",XU);
PickupInfo[ServerInfo[0][pickup]][income] = dini_Int("/Properties/income.ini", szMsg);
ServerInfo[0][incomes] = 1;
}
}
printf("Props Loaded!");
return asp;
}


Add to OnPlayerCommandText

else if (strcmp(cmd, "addprop", true) == 0) {
new tmp2[256],tmp3[256],tmp4[256];
tmp = strtok(cmdtext,idx);
tmp2 = strtok(cmdtext,idx);
tmp3 = strtok(cmdtext,idx);
tmp4 = strtok(cmdtext,idx);
else if(!strlen(tmp4)) SendClientMessage(playerid,COLOR_GREEN,"Use /c addprop <cost> <income> <ID> <Name>");
else if (!IsNumeric(tmp) || !IsNumeric(tmp2) || !IsNumeric(tmp3)) SendClientMessage(playerid,COLOR_GREEN, "Cost, income, and ID must be numbers");
else {
new Float:x,Float:y,Float:z,szMsg[256],id[256];
format(szMsg,sizeof(szMsg),"Added - Cost: $%s Income: $%s ID: %s Name: %s",tmp,tmp2,tmp3,tmp4);
SendClientMessage(playerid,COLOR_GREEN,szMsg);
GetPlayerPos(playerid,x,y,z);
format(szMsg,sizeof(szMsg),"%f %f %f",x,y,z);
format(id,sizeof(id),"%d",strval(tmp3));
dini_Set("/Properties/sum.ini",id,szMsg);
dini_Set("/Properties/income.ini",id,tmp2);
dini_Set("/Properties/names.ini",id,tmp4);
dini_Set("/Properties/prices.ini",id,tmp);
dini_Set("/Properties/owners.ini",id,"none");
dini_Set("/Properties/share.ini",id,"none");
}
return 1;
}


Add to OnPickedUp

if (PickupInfo[pickupid][isprop] == 1) {
       new szMsg[256],owner[256],cost,shared[256],name[256];
owner = GetPropertyOwner(PickupInfo[pickupid][propname]);
cost = GetPropertyCost(IntToStr(PickupInfo[pickupid][propname]));
shared = GetPropertyShare(PickupInfo[pickupid][propname]);
name = GetPropertyName(PickupInfo[pickupid][propname]);

       new money,string[256],collects;
if(strcmp(owner, gPlayers[playerid], true) == 0) {
           PickupInfo[pickupid][collections] = PickupInfo[pickupid][collections] +1;
   collects = ServerInfo[0][incomes] -PickupInfo[pickupid][collections] +1;
   money = collects * PickupInfo[pickupid][income];
   if(collects == 0) {
       PickupInfo[pickupid][collections] = PickupInfo[pickupid][collections] -1;
format(szMsg,sizeof(szMsg),">>> %s <<<",name);
       SendClientMessage(playerid,COLOR_GREEN,szMsg);
format(szMsg,sizeof(szMsg),"ID:[ %d ] Value:[ %d ]",PickupInfo[pickupid][propname],cost);
SendClientMessage(playerid,COLOR_GREEN,szMsg);
SendClientMessage(playerid,COLOR_GREEN,"Earnings: $0");
}
else {
IncPlayerHandCash(playerid,money);
format(szMsg,sizeof(szMsg),">>> %s <<<",name);
       SendClientMessage(playerid,COLOR_GREEN,szMsg);
format(szMsg,sizeof(szMsg),"ID:[ %d ] Value:[ %d ]",PickupInfo[pickupid][propname],cost);
SendClientMessage(playerid,COLOR_GREEN,szMsg);
format(szMsg,sizeof(szMsg),"Earnings: $%d",money);
SendClientMessage(playerid,COLOR_GREEN,szMsg);
}
}
else if(strcmp(owner, "none", true) == 0) {
   format(szMsg,sizeof(szMsg),">>> %s <<<",name);
           SendClientMessage(playerid,COLOR_GREEN,szMsg);
format(szMsg,sizeof(szMsg),"ID:[ %d ] Cost:[ %d ]",PickupInfo[pickupid][propname],cost);
SendClientMessage(playerid,COLOR_GREEN,szMsg);
}
else if(strcmp(shared, "none", true) == 0) {
format(szMsg,sizeof(szMsg),">>> %s <<<",name);
SendClientMessage(playerid,COLOR_GREEN,szMsg);
format(szMsg,sizeof(szMsg),"ID:[ %d ] Owner:[ %s ]",PickupInfo[pickupid][propname],owner);
SendClientMessage(playerid,COLOR_GREEN,szMsg);
}
else {
format(szMsg,sizeof(szMsg),">>> %s <<<",name);
SendClientMessage(playerid,COLOR_GREEN,szMsg);
format(szMsg,sizeof(szMsg),"ID:[ %d ] Owner:[ %s ] Shared:[ %s ]",PickupInfo[pickupid][propname],owner,shared);
SendClientMessage(playerid,COLOR_GREEN,szMsg);
}
return 1;


And for the income to show up...
Add this to OnGameModInit

SetTimer("Payday",900000,true);

Back to the bottom of the script

public Payday()
{
   ServerInfo[0][incomes] = ServerInfo[0][incomes] +1;
   for(new i = 0; i <= MAX_PLAYERS; i++) {
       if(IsPlayerConnected(i) == 1) {
GameTextForAll("Payday!!!!");
}
}
}
Hello, this is Robd from the past.
If you are seeing this I have either posted something stupid, forgotten something, started a stupid topic, or a combination of the three.

Please forgive us for this mistake.

Regards, management

tato






<!-- Facebook Badge START --><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" style="font-family: &quot;lucida grande&quot;,tahoma,verdana,arial,sans-serif; font-size: 11px; font-variant: normal; font-style: normal; font-weight: normal; color: #3B5998; text-decoration: none;" title="Eduardo Estrada">Eduardo Estrada</a><br/><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" title="Eduardo Estrada"><img src="http://badge.facebook.com/badge/697470158.6069.1979465113.png" width="120" height="272" style="b

yazeen


yazeen

hmmmmmm ,
                  Man did u mean Payday only for Those who buyprop or for all?

yazeen

#4
Errors Found:

C:\Documents and Settings\yachu\Desktop\Vcmp\Gamemodes\RPG Server\RPG Server\gamemodes\FSRPG.pwn(2276) : error 033: array must be indexed (variable "pickup")
C:\Documents and Settings\yachu\Desktop\Vcmp\Gamemodes\RPG Server\RPG Server\gamemodes\FSRPG.pwn(2277) : error 033: array must be indexed (variable "pickup")
C:\Documents and Settings\yachu\Desktop\Vcmp\Gamemodes\RPG Server\RPG Server\gamemodes\FSRPG.pwn(2279) : error 033: array must be indexed (variable "pickup")
C:\Documents and Settings\yachu\Desktop\Vcmp\Gamemodes\RPG Server\RPG Server\gamemodes\FSRPG.pwn(2280) : error 033: array must be indexed (variable "pickup")
C:\Documents and Settings\yachu\Desktop\Vcmp\Gamemodes\RPG Server\RPG Server\gamemodes\FSRPG.pwn(2283) : error 033: array must be indexed (variable "pickup")



C:\Documents and Settings\yachu\Desktop\Vcmp\Gamemodes\RPG Server\RPG Server\gamemodes\FSRPG.pwn(68) : error 021: symbol already defined: "income"
C:\Documents and Settings\yachu\Desktop\Vcmp\Gamemodes\RPG Server\RPG Server\gamemodes\FSRPG.pwn(77) : error 021: symbol already defined: "pickup"


Errors  8)

Madara

#5
A property system cotain:
function to check who are owner, shared, cost, development consulte of date property, commands related to the same, is property in vent, is property exist, etc...

This would be only a 1/4 part.

also contains things GUPS (some things)

sseebbyy

but... /c sellprop, /c buyprop ?

I need Property System !

yazeen

Quote from: sseebbyy on March 29, 2011, 07:00:19 AM
but... /c sellprop, /c buyprop ?

I need Property System !

Dude Take From Gups

Madara


Robd

#9
This is actualy 90% GUPS that I modified, let me modify to add credits.
Quote from: yazeen on March 29, 2011, 06:17:09 AM
Errors Found:

C:\Documents and Settings\yachu\Desktop\Vcmp\Gamemodes\RPG Server\RPG Server\gamemodes\FSRPG.pwn(2276) : error 033: array must be indexed (variable "pickup")
C:\Documents and Settings\yachu\Desktop\Vcmp\Gamemodes\RPG Server\RPG Server\gamemodes\FSRPG.pwn(2277) : error 033: array must be indexed (variable "pickup")
C:\Documents and Settings\yachu\Desktop\Vcmp\Gamemodes\RPG Server\RPG Server\gamemodes\FSRPG.pwn(2279) : error 033: array must be indexed (variable "pickup")
C:\Documents and Settings\yachu\Desktop\Vcmp\Gamemodes\RPG Server\RPG Server\gamemodes\FSRPG.pwn(2280) : error 033: array must be indexed (variable "pickup")
C:\Documents and Settings\yachu\Desktop\Vcmp\Gamemodes\RPG Server\RPG Server\gamemodes\FSRPG.pwn(2283) : error 033: array must be indexed (variable "pickup")



C:\Documents and Settings\yachu\Desktop\Vcmp\Gamemodes\RPG Server\RPG Server\gamemodes\FSRPG.pwn(68) : error 021: symbol already defined: "income"
C:\Documents and Settings\yachu\Desktop\Vcmp\Gamemodes\RPG Server\RPG Server\gamemodes\FSRPG.pwn(77) : error 021: symbol already defined: "pickup"


Errors  8)
As far as I can tell, somewhere in the script that you started using someone already setup a variable named pickup, either rename mine or remove theirs. If anyone else gets this error please let me know.
Hello, this is Robd from the past.
If you are seeing this I have either posted something stupid, forgotten something, started a stupid topic, or a combination of the three.

Please forgive us for this mistake.

Regards, management

Madara

Quote from: Robd on March 29, 2011, 09:20:59 PM
This is actualy 90% GUPS that I modified, let me modify to add credits.

Ok, but need put rest commands with their duties of consultation relating to property, and so your system properties are 100% complete.

Robd

Quote from: Madara on March 29, 2011, 09:27:33 PM
Quote from: Robd on March 29, 2011, 09:20:59 PM
This is actualy 90% GUPS that I modified, let me modify to add credits.

Ok, but need put rest commands with their duties of consultation relating to property, and so your system properties are 100% complete.
Yes sir, please don't tell the admins on me  ):
Hello, this is Robd from the past.
If you are seeing this I have either posted something stupid, forgotten something, started a stupid topic, or a combination of the three.

Please forgive us for this mistake.

Regards, management

tato






<!-- Facebook Badge START --><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" style="font-family: &quot;lucida grande&quot;,tahoma,verdana,arial,sans-serif; font-size: 11px; font-variant: normal; font-style: normal; font-weight: normal; color: #3B5998; text-decoration: none;" title="Eduardo Estrada">Eduardo Estrada</a><br/><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" title="Eduardo Estrada"><img src="http://badge.facebook.com/badge/697470158.6069.1979465113.png" width="120" height="272" style="b

yazeen

ShareProp,Buyprop,SellProp,Unshareprop Are Easy to Make if u cant take From

**Cough** Gups **Cough**

Robd

I included the original Unmodified GUPS code at the top of my post.
Hello, this is Robd from the past.
If you are seeing this I have either posted something stupid, forgotten something, started a stupid topic, or a combination of the three.

Please forgive us for this mistake.

Regards, management