16.10.2011, 14:15
hello folks
I'm making a business system, and I got pretty far whitout any errors until now...
ok so this is a command to enter your business
and here is a part of the command to buy a business:
this works
now when I go ingame it should give an error message when u tried to enter the business
there for this line in the Enter command:
but when I go ingame it does the opposite of what I ask...
I get the message when the player is the owner, but not when the player isn't owner...
I know I can just solve this by adding ! infront of the strcmp
but then I didn't learn anything...
Thanks in advance
I'm making a business system, and I got pretty far whitout any errors until now...
pawn Код:
dcmd_enter(playerid, params[])
{
#pragma unused params
new DialogTitle[50],
string[1000];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if (GetPlayerVehicleSeat(playerid) == 1) return SendClientMessage(playerid,COLOR_RED,"*You enter businesses in a vehicle!");
for(new u;u<sizeof(bInfo);u++)
{
if (IsPlayerInRangeOfPoint(playerid, 2.5, bInfo[u][bus_x], bInfo[u][bus_y], bInfo[u][bus_z]))
{
if(bInfo[u][bus_owned] == true)
{
if(strcmp(bInfo[u][bus_owner], name, false))
{
pInBus[playerid] = true;
SetPlayerCameraPos(playerid, bInfo[u][bus_x], bInfo[u][bus_y], bInfo[u][bus_z]+59);
SetPlayerCameraLookAt(playerid, bInfo[u][bus_x], bInfo[u][bus_y], bInfo[u][bus_z]);
format(DialogTitle, sizeof(DialogTitle), "%s", bInfo[u][bus_name]);
format(string, sizeof(string), "%sUpgrade business\n", string);
format(string, sizeof(string), "%sSell business\n", string);
format(string, sizeof(string), "%sExit menu\n", string);
ShowPlayerDialog(playerid, 100, DIALOG_STYLE_LIST, DialogTitle, string, "Select", "Cancel");
}
else
SendClientMessage(playerid,COLOR_RED,"*You do not own this business!");
}
}
else
SendClientMessage(playerid,COLOR_RED,"*You are not near any business!");
}
return 1;
}
and here is a part of the command to buy a business:
pawn Код:
format(bInfo[u][bus_owner], MAX_PLAYER_NAME, name);
now when I go ingame it should give an error message when u tried to enter the business
there for this line in the Enter command:
pawn Код:
if(strcmp(bInfo[u][bus_owner], name, false))
{
I get the message when the player is the owner, but not when the player isn't owner...
I know I can just solve this by adding ! infront of the strcmp
but then I didn't learn anything...
Thanks in advance