InMissions + command problem
#1

Quote:

if(strcmp(cmd, "/enter", true) == 0)
{
for(new i = 0; i < sizeof(HouseInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 3,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
{
//printf("Found House :%d",i);
if(PlayerInfo[playerid][pPhousekey] == i || HouseInfo[i][hLock] == 0)
{
SetPlayerInterior(playerid,HouseInfo[i][hInt]);
SetPlayerPos(playerid,HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz]);
SetPlayerVirtualWorld(playerid,HouseInfo[i][hWorld]);
GameTextForPlayer(playerid, "~w~Welcome Home", 5000, 1);
PlayerInfo[playerid][pInt] = HouseInfo[i][hInt];
PlayerInfo[playerid][pLocal] = i;
}
else
{
GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
}
}
}
for(new i = 0; i < sizeof(BizzInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 3,BizzInfo[i][bEntrancex], BizzInfo[i][bEntrancey], BizzInfo[i][bEntrancez]))
{
//printf("Found House :%d",i);
if(PlayerInfo[playerid][pPbiskey] == i || GetPlayerMoney(playerid) >= BizzInfo[i][bEntcost] || (BizzInfo[i][bEntcost] > 20000 && PlayerInfo[playerid][pLevel] < 3))
{
if(PlayerInfo[playerid][pPbiskey] != i)
{
if(BizzInfo[i][bLock] == 1)
{
GameTextForPlayer(playerid, "~r~Closed", 5000, 1);
return 1;
}
if(BizzInfo[i][bProd] == 0)
{
GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
return 1;
}
SafeGivePlayerMoney(playerid,-BizzInfo[i][bEntcost]);
format(string, sizeof(string), "~r~-$%d~n~~w~type /exit~n~to get out~n~Type ~g~/buygun ~w~to buy weapons", BizzInfo[i][bEntcost]);
BizzInfo[i][bTakings] = BizzInfo[i][bTakings]+BizzInfo[i][bEntcost];
BizzInfo[i][bProd]--;
OnPropUpdate();
GameTextForPlayer(playerid, string, 5000, 3);
if(i == 7) //casino
{
gSpentCash[playerid] = GetPlayerMoney(playerid);
}
}
SetPlayerInterior(playerid,BizzInfo[i][bInt]);
SetPlayerPos(playerid,BizzInfo[i][bExitx],BizzInfo[i][bExity],BizzInfo[i][bExitz]);
PlayerInfo[playerid][pInt] = BizzInfo[i][bInt];
PlayerInfo[playerid][pLocal] = i+99;
new dood[MAX_PLAYER_NAME];
GetPlayerName(playerid, dood, sizeof(dood));
format(string, sizeof(string), "%s payed $%d to enter biz %d", dood, BizzInfo[i][bEntcost], i);
printf("%s", string);
PayLog(string);
//PlayerInfo[playerid][pLocal] = i;
}
else
{
GameTextForPlayer(playerid, "~r~You dont have the cash", 5000, 1);
}
}
}
for(new i = 0; i < sizeof(SBizzInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 3,SBizzInfo[i][sbEntrancex], SBizzInfo[i][sbEntrancey], SBizzInfo[i][sbEntrancez]))
{
if(PlayerInfo[playerid][pPbiskey] == i || GetPlayerMoney(playerid) >= SBizzInfo[i][sbEntcost] || (SBizzInfo[i][sbEntcost] > 20000 && PlayerInfo[playerid][pLevel] < 3))
{
if(PlayerInfo[playerid][pPbiskey] != i)
{
if(SBizzInfo[i][sbLock] == 1)
{
GameTextForPlayer(playerid, "~r~Closed", 5000, 1);
return 1;
}
if(SBizzInfo[i][sbProd] == 0)
{
GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
return 1;
}
if(i == 2 || i == //planes school
{
SetVehicleParamsForPlayerEx(66,playerid,0,0);
SetVehicleParamsForPlayerEx(67,playerid,0,0);
SetVehicleParamsForPlayerEx(68,playerid,0,0);
SetVehicleParamsForPlayerEx(69,playerid,0,0);
SetVehicleParamsForPlayerEx(70,playerid,0,0);
SetVehicleParamsForPlayerEx(71,playerid,0,0);
SetVehicleParamsForPlayerEx(72,playerid,0,0);
PLicence[playerid] = 1;
SendClientMessage(playerid, TEAM_GROVE_COLOR, "Pilots Licence: You can now fly any plane");
}
if(i == 0) //parachute
{

SetPlayerInterior(playerid,1);
SetPlayerPos(playerid,1.71875, 30.4062, 1200.34);
PlayerInfo[i][pInt] = 0;
gSkyDive[playerid] = 1;
}
if(i == 1) //wheele
{
//SetPlayerInterior(playerid,HouseInfo[i][hInt]);
if (GetPlayerState(playerid) == 2)
{
new tmpcar = GetPlayerVehicleID(playerid);
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
PlayerInfo[playerid][pLocal] = 10000;
SetVehiclePos(tmpcar, -2724.0,217.9,4.1);
}
else
{
GameTextForPlayer(playerid, "~w~You must be in a Street Racer", 1000, 1);
return 1;
}
Spectate[playerid] = 500;
GameTextForPlayer(playerid, "~w~To Exit type ~r~/exit", 5000, 1);
//PlayerInfo[playerid][pInt] = HouseInfo[i][hInt];
}
if(i == 3 || i == 7) //stealth school
{
Hidden[playerid] = 1;
SetPlayerToTeamColor(playerid);
GameTextForPlayer(playerid, "~w~Stealth Device~n~~g~Your icon is hidden", 5000, 3);
SendClientMessage(playerid, TEAM_GROVE_COLOR, "Stealth Active: Your icon is hidden.");
}
if(i == 4) //towcar school
{
GameTextForPlayer(playerid, "~w~breakdown service~n~~g~type /towcar", 5000, 3);
SendClientMessage(playerid, TEAM_GROVE_COLOR, "To use this service: type /towcar.");
return 1;
}
if(i == 5) //homeupgrade school
{
GameTextForPlayer(playerid, "~w~Home Supply~~g~type /houseupgrade", 5000, 3);
SendClientMessage(playerid, TEAM_GROVE_COLOR, "To use this service: type /houseupgrade.");
return 1;
}
if(i == 6) //sellcars school
{
GameTextForPlayer(playerid, "~w~Car Sales~n~~g~type /carupgrade", 5000, 3);
SendClientMessage(playerid, TEAM_GROVE_COLOR, "To use this service: type /carupgrade.");
return 1;
}
if(i == 9 || i == 10) //buy school
{
Locator[playerid] = 1;
GameTextForPlayer(playerid, "~w~Locator Device~n~~g~Your can locate best buys and sales", 5000, 3);
SendClientMessage(playerid, TEAM_GROVE_COLOR, "type /bestbuy or /bestsale");
}
if(i == 11 || i == 12) //buy school
{
SendClientMessage(playerid, TEAM_GROVE_COLOR, "type /jointeam <teamid> to use");
return 1;
}
SafeGivePlayerMoney(playerid,-SBizzInfo[i][sbEntcost]);
gSpentCash[playerid] = GetPlayerMoney(playerid);
SBizzInfo[i][sbProd]--;
SBizzInfo[i][sbTakings] = SBizzInfo[i][sbTakings]+SBizzInfo[i][sbEntcost];
new dood[MAX_PLAYER_NAME];
GetPlayerName(playerid, dood, sizeof(dood));
format(string, sizeof(string), "%s payed $%d to enter sbiz %d", dood, SBizzInfo[i][sbEntcost], i);
printf("%s", string);
PayLog(string);
OnPropUpdate();
}
}
else
{
GameTextForPlayer(playerid, "~r~You dont have the cash", 5000, 1);
}
}
}
return 1;
}

How can i make if someone is InMission[playerid] = 0; that he cant use the command /enter ?
Reply
#2

Try...
pawn Код:
if(strcmp(cmd, "/enter", true) == 0)
{
if(InMission[playerid] == 0)
{
SendClientMessage(playerid, REDCOLOR, "You can't use this command.");
return 1;
}
for(new i = 0; i < sizeof(HouseInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 3,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
{
//printf("Found House :%d",i);
if(PlayerInfo[playerid][pPhousekey] == i || HouseInfo[i][hLock] == 0)
{
SetPlayerInterior(playerid,HouseInfo[i][hInt]);
SetPlayerPos(playerid,HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz]);
SetPlayerVirtualWorld(playerid,HouseInfo[i][hWorld]);
GameTextForPlayer(playerid, "~w~Welcome Home", 5000, 1);
PlayerInfo[playerid][pInt] = HouseInfo[i][hInt];
PlayerInfo[playerid][pLocal] = i;
}
else
{
GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
}
}
}
for(new i = 0; i < sizeof(BizzInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 3,BizzInfo[i][bEntrancex], BizzInfo[i][bEntrancey], BizzInfo[i][bEntrancez]))
{
//printf("Found House :%d",i);
if(PlayerInfo[playerid][pPbiskey] == i || GetPlayerMoney(playerid) >= BizzInfo[i][bEntcost] || (BizzInfo[i][bEntcost] > 20000 && PlayerInfo[playerid][pLevel] < 3))
{
if(PlayerInfo[playerid][pPbiskey] != i)
{
if(BizzInfo[i][bLock] == 1)
{
GameTextForPlayer(playerid, "~r~Closed", 5000, 1);
return 1;
}
if(BizzInfo[i][bProd] == 0)
{
GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
return 1;
}
SafeGivePlayerMoney(playerid,-BizzInfo[i][bEntcost]);
format(string, sizeof(string), "~r~-$%d~n~~w~type /exit~n~to get out~n~Type ~g~/buygun ~w~to buy weapons", BizzInfo[i][bEntcost]);
BizzInfo[i][bTakings] = BizzInfo[i][bTakings]+BizzInfo[i][bEntcost];
BizzInfo[i][bProd]--;
OnPropUpdate();
GameTextForPlayer(playerid, string, 5000, 3);
if(i == 7) //casino
{
gSpentCash[playerid] = GetPlayerMoney(playerid);
}
}
SetPlayerInterior(playerid,BizzInfo[i][bInt]);
SetPlayerPos(playerid,BizzInfo[i][bExitx],BizzInfo[i][bExity],BizzInfo[i][bExitz]);
PlayerInfo[playerid][pInt] = BizzInfo[i][bInt];
PlayerInfo[playerid][pLocal] = i+99;
new dood[MAX_PLAYER_NAME];
GetPlayerName(playerid, dood, sizeof(dood));
format(string, sizeof(string), "%s payed $%d to enter biz %d", dood, BizzInfo[i][bEntcost], i);
printf("%s", string);
PayLog(string);
//PlayerInfo[playerid][pLocal] = i;
}
else
{
GameTextForPlayer(playerid, "~r~You dont have the cash", 5000, 1);
}
}
}
for(new i = 0; i < sizeof(SBizzInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 3,SBizzInfo[i][sbEntrancex], SBizzInfo[i][sbEntrancey], SBizzInfo[i][sbEntrancez]))
{
if(PlayerInfo[playerid][pPbiskey] == i || GetPlayerMoney(playerid) >= SBizzInfo[i][sbEntcost] || (SBizzInfo[i][sbEntcost] > 20000 && PlayerInfo[playerid][pLevel] < 3))
{
if(PlayerInfo[playerid][pPbiskey] != i)
{
if(SBizzInfo[i][sbLock] == 1)
{
GameTextForPlayer(playerid, "~r~Closed", 5000, 1);
return 1;
}
if(SBizzInfo[i][sbProd] == 0)
{
GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
return 1;
}
if(i == 2 || i ==  //planes school
{
SetVehicleParamsForPlayerEx(66,playerid,0,0);
SetVehicleParamsForPlayerEx(67,playerid,0,0);
SetVehicleParamsForPlayerEx(68,playerid,0,0);
SetVehicleParamsForPlayerEx(69,playerid,0,0);
SetVehicleParamsForPlayerEx(70,playerid,0,0);
SetVehicleParamsForPlayerEx(71,playerid,0,0);
SetVehicleParamsForPlayerEx(72,playerid,0,0);
PLicence[playerid] = 1;
SendClientMessage(playerid, TEAM_GROVE_COLOR, "Pilots Licence: You can now fly any plane");
}
if(i == 0) //parachute
{

SetPlayerInterior(playerid,1);
SetPlayerPos(playerid,1.71875, 30.4062, 1200.34);
PlayerInfo[i][pInt] = 0;
gSkyDive[playerid] = 1;
}
if(i == 1) //wheele
{
//SetPlayerInterior(playerid,HouseInfo[i][hInt]);
if (GetPlayerState(playerid) == 2)
{
new tmpcar = GetPlayerVehicleID(playerid);
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
PlayerInfo[playerid][pLocal] = 10000;
SetVehiclePos(tmpcar, -2724.0,217.9,4.1);
}
else
{
GameTextForPlayer(playerid, "~w~You must be in a Street Racer", 1000, 1);
return 1;
}
Spectate[playerid] = 500;
GameTextForPlayer(playerid, "~w~To Exit type ~r~/exit", 5000, 1);
//PlayerInfo[playerid][pInt] = HouseInfo[i][hInt];
}
if(i == 3 || i == 7) //stealth school
{
Hidden[playerid] = 1;
SetPlayerToTeamColor(playerid);
GameTextForPlayer(playerid, "~w~Stealth Device~n~~g~Your icon is hidden", 5000, 3);
SendClientMessage(playerid, TEAM_GROVE_COLOR, "Stealth Active: Your icon is hidden.");
}
if(i == 4) //towcar school
{
GameTextForPlayer(playerid, "~w~breakdown service~n~~g~type /towcar", 5000, 3);
SendClientMessage(playerid, TEAM_GROVE_COLOR, "To use this service: type /towcar.");
return 1;
}
if(i == 5) //homeupgrade school
{
GameTextForPlayer(playerid, "~w~Home Supply~~g~type /houseupgrade", 5000, 3);
SendClientMessage(playerid, TEAM_GROVE_COLOR, "To use this service: type /houseupgrade.");
return 1;
}
if(i == 6) //sellcars school
{
GameTextForPlayer(playerid, "~w~Car Sales~n~~g~type /carupgrade", 5000, 3);
SendClientMessage(playerid, TEAM_GROVE_COLOR, "To use this service: type /carupgrade.");
return 1;
}
if(i == 9 || i == 10) //buy school
{
Locator[playerid] = 1;
GameTextForPlayer(playerid, "~w~Locator Device~n~~g~Your can locate best buys and sales", 5000, 3);
SendClientMessage(playerid, TEAM_GROVE_COLOR, "type /bestbuy or /bestsale");
}
if(i == 11 || i == 12) //buy school
{
SendClientMessage(playerid, TEAM_GROVE_COLOR, "type /jointeam <teamid> to use");
return 1;
}
SafeGivePlayerMoney(playerid,-SBizzInfo[i][sbEntcost]);
gSpentCash[playerid] = GetPlayerMoney(playerid);
SBizzInfo[i][sbProd]--;
SBizzInfo[i][sbTakings] = SBizzInfo[i][sbTakings]+SBizzInfo[i][sbEntcost];
new dood[MAX_PLAYER_NAME];
GetPlayerName(playerid, dood, sizeof(dood));
format(string, sizeof(string), "%s payed $%d to enter sbiz %d", dood, SBizzInfo[i][sbEntcost], i);
printf("%s", string);
PayLog(string);
OnPropUpdate();
}
}
else
{
GameTextForPlayer(playerid, "~r~You dont have the cash", 5000, 1);
}
}
}
return 1;
}
I just add

pawn Код:
if(InMission[playerid] == 0)
{
SendClientMessage(playerid, REDCOLOR, "You can't use this command.");
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)