11.01.2014, 17:04
Hey guys
I am using this command for a house system:
The problem is when I type the "/house info" or "/house lock" it shows me what is the right form to write the command: (HELP: /house info [ ] | lock [ ] | takemoney [value] | putmoney [value])
Can someone help me plz ?
I am using this command for a house system:
pawn Код:
dcmd_house(playerid, params[])
{
new text[48]; new novac;// novac = money
if(sscanf(params, "s[48]i",text , novac))
{
SendClientMessage(playerid, WHITE, "HELP: /house info [ ] | lock [ ] | takemoney [value] | putmoney [value]");
return 1;
}
if(strcmp(text,"info",true) == 0) // apartment info.
{
for(new i = 0; i < sizeof(ApartmentInfo); i++)
{
new string[500];
if(IsPlayerInRangeOfPoint(playerid, 10,ApartmentInfo[i][sExitx], ApartmentInfo[i][sExity], ApartmentInfo[i][sExitz]) && strcmp(ApartmentInfo[i][sOwner], plname, false ) == 0)
{
SendClientMessage(playerid, YELLOW, "|========================================|");
if(ApartmentInfo[i][sLocked] == 1)
{
SendClientMessage(playerid, WHITE, "Locked: Yes");
}
if(ApartmentInfo[i][sLocked] == 0)
{
SendClientMessage(playerid, WHITE, "Locked: No");
}
format(string, sizeof(string), "Money in safe: %d $", ApartmentInfo[i][sMoney]);
SendClientMessage(playerid, WHITE, string);
format(string, sizeof(string), "House Price: %d $", ApartmentInfo[i][sPrice]);
SendClientMessage(playerid, WHITE, string);
SendClientMessage(playerid, YELLOW, "|========================================|");
return 1;
}
}
return 1;
}
if(strcmp(text,"lock",true) == 0) // lock/unlock apartment
{
for(new i = 0; i < sizeof(ApartmentInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3,ApartmentInfo[i][sEnterx], ApartmentInfo[i][sEntery], ApartmentInfo[i][sEnterz]) && InApartment[playerid] == 501)
{
GetPlayerName(playerid, plname, sizeof(plname));
if(strcmp(ApartmentInfo[i][sOwner], plname, false ) == 0)
{
if(ApartmentInfo[i][sLocked] == 1)
{
GameTextForPlayer(playerid, "~g~Unlocked", 5000, 6);
ApartmentInfo[i][sLocked] = 0;
return 1;
}
if(ApartmentInfo[i][sLocked] == 0)
{
GameTextForPlayer(playerid, "~r~Locked", 5000, 6);
ApartmentInfo[i][sLocked] = 1;
return 1;
}
}
}
if(IsPlayerInRangeOfPoint(playerid, 25,ApartmentInfo[i][sExitx], ApartmentInfo[i][sExity], ApartmentInfo[i][sExitz]))
{
if(IsPlayerInRangeOfPoint(playerid, 3,ApartmentInfo[i][sExitx], ApartmentInfo[i][sExity], ApartmentInfo[i][sExitz]) && InApartment[playerid] != 501)
{
GetPlayerName(playerid, plname, sizeof(plname));
if(strcmp(ApartmentInfo[i][sOwner], plname, false ) == 0)
{
if(ApartmentInfo[i][sLocked] == 1)
{
GameTextForPlayer(playerid, "~g~Unlocked", 5000, 6);
ApartmentInfo[i][sLocked] = 0;
return 1;
}
if(ApartmentInfo[i][sLocked] == 0)
{
GameTextForPlayer(playerid, "~r~Locked", 5000, 6);
ApartmentInfo[i][sLocked] = 1;
return 1;
}
}
}
else { SendClientMessage(playerid, WHITE,"You are not in front of doors."); return 1; }
}
}
return 1;
}
if(strcmp(text,"putmoney",true) == 0) // taking money from safe
{
new string[128];
if(novac < 0) { return 1; }
for(new i = 0; i < sizeof(ApartmentInfo); i++)
{
GetPlayerName(playerid, plname, sizeof(plname));
if(IsPlayerInRangeOfPoint(playerid, 10,ApartmentInfo[i][sExitx], ApartmentInfo[i][sExity], ApartmentInfo[i][sExitz]) && strcmp(ApartmentInfo[i][sOwner], plname, false ) == 0 && GetPlayerVirtualWorld(playerid) == ApartmentInfo[i][sWorld])
{
if(GetPlayerMoney(playerid) >= novac)
{
ApartmentInfo[i][sMoney] += novac;
GivePlayerMoney(playerid,-novac);
format(string, sizeof(string), "You have put %d $ in safe, now you have: %d", novac, ApartmentInfo[i][sMoney]);
SendClientMessage(playerid, YELLOW, string);
SaveApartment(i);
return 1;
}
else { SendClientMessage(playerid,GREY,"You don't have enoguht money!"); return 1; }
}
}
return 1;
}
if(strcmp(text,"takemoney",true) == 0) // puting money in safe
{
new string[128];
if(novac < 0) { return 1; }
for(new i = 0; i < sizeof(ApartmentInfo); i++)
{
GetPlayerName(playerid, plname, sizeof(plname));
if(IsPlayerInRangeOfPoint(playerid, 10,ApartmentInfo[i][sExitx], ApartmentInfo[i][sExity], ApartmentInfo[i][sExitz]) && strcmp(ApartmentInfo[i][sOwner], plname, false ) == 0 && GetPlayerVirtualWorld(playerid) == ApartmentInfo[i][sWorld])
{
if(ApartmentInfo[i][sMoney] >= novac)
{
ApartmentInfo[i][sMoney] -= novac;
GivePlayerMoney(playerid,novac);
format(string, sizeof(string), "You have take %d $ from safe, now you have: %d $", novac, ApartmentInfo[i][sMoney]);
SendClientMessage(playerid, YELLOW, string);
SaveApartment(i);
return 1;
}
else { SendClientMessage(playerid,GREY,"You don't have enoguht money!"); return 1; }
}
}
return 1;
}
return 1;
}
Can someone help me plz ?