30.03.2011, 17:16
I am really bad at putting commands into commands...
So i was wondering if someone could please add this:
AND
Into:
So i was wondering if someone could please add this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext)
{
if (strcmp("/buy", cmdtext, true, 10) == 0)
{
for(new i; i<MAX_HOUSES; i++)
{
if(!IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][PickupX], HouseInfo[i][PickupY], HouseInfo[i][PickupZ])) continue;
new Pname[24]; GetPlayerName(playerid, Pname, 24);
for(new S; S<MAX_HOUSES; S++)
{
if(!strcmp(dini_Get("Owned.ini", HouseInfo[S][HouseNames]), Pname)) return SendClientMessage(playerid, 0xF60000AA, "You already have a house!");
}
if(GetPlayerMoney(playerid) < HouseInfo[i][HouseCost]) return SendClientMessage(playerid, 0xF60000AA, "You don't have enough money to buy this house");
if(HouseInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xF60000AA, "This house is already owned!");
GivePlayerMoney(playerid, - HouseInfo[i][HouseCost]);
GameTextForPlayer(playerid, "~r~House Purchased!", 2000, 3);
HouseInfo[i][Owned] = 1;
GetPlayerName(playerid, Pname, 24);
format(HouseInfo[i][HouseOwner], 24, "%s", Pname);
dini_Set("Owners.ini", HouseInfo[i][HouseNames], Pname);
return 1;
}
SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house");
return 1;
}
if (strcmp("/sell", cmdtext, true, 10) == 0)
{
for(new i; i<MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][PickupX], HouseInfo[i][PickupY], HouseInfo[i][PickupZ]))
{
new Pname[24]; GetPlayerName(playerid, Pname, 24);
if(strcmp(Pname, HouseInfo[i][HouseOwner])) return SendClientMessage(playerid, 0xF60000AA, "You don't own this house!");
GivePlayerMoney(playerid, HouseInfo[i][HouseSell]);
GameTextForPlayer(playerid, "~r~House Sold!", 2000, 3);
HouseInfo[i][Owned] = 0;
format(HouseInfo[i][HouseOwner], 24, "0943jt3u9*egjlfd");
dini_Unset("Owners.ini", HouseInfo[i][HouseNames]);
return 1;
}
}
SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house");
return 1;
}
return 0;
}
pawn Код:
public OnPlayerCommandText(playerid, cmdtext)
{
if (strcmp("/enter", cmdtext, true, 10) == 0)
{
for(new i; i<MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][PickupX], HouseInfo[i][PickupY], HouseInfo[i][PickupZ]))
{
new Pname[24]; GetPlayerName(playerid, Pname, 24);
if(strcmp(Pname, HouseInfo[i][HouseOwner])) return SendClientMessage(playerid, 0xF60000AA, "You don't own this house!");
SetPlayerPos(playerid, HouseInfo[i][TeleX], HouseInfo[i][TeleY], HouseInfo[i][TeleZ]);
SetPlayerInterior(playerid, HouseInfo[i][Interior]);
InHouse[playerid] = i;
SetPlayerVirtualWorld(playerid, HouseInfo[i][Virtual]);
SendClientMessage(playerid, 0x00C4F6AA, "You have entered your house");
return 1;
}
}
SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house");
return 1;
}
if (strcmp("/exit", cmdtext, true, 10) == 0)
{
if(InHouse[playerid] == -1) return SendClientMessage(playerid, 0xF60000AA, "You are not in a house");
SetPlayerPos(playerid, HouseInfo[InHouse[playerid]][PickupX], HouseInfo[InHouse[playerid]][PickupY], HouseInfo[InHouse[playerid]][PickupZ]);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SendClientMessage(playerid, 0x00C4F6AA, "You have exited your house");
InHouse[playerid] = -1;
return 1;
}
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/startengine",true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
return 1;
}
if(strcmp(cmdtext, "/stopengine",true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
}
return 1;
}
if(strcmp(cmdtext, "/Teleport", true) == 0)
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Teleport Menu", "Unity Station \n Los Santos Police Department", "Select", "Cancel");
return 1;
}
if(strcmp(cmdtext, "/lightsonn",true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
}
return 1;
}
if(strcmp(cmdtext, "/lightsoff",true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
}
return 1;
}
if(strcmp(cmdtext, "/turnonobjective",true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,VEHICLE_PARAMS_ON);
}
return 1;
}
if(strcmp(cmdtext, "/turnoffobjective",true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,VEHICLE_PARAMS_OFF);
}
return 1;
}
if(strcmp(cmdtext, "/closedoors",true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
}
return 1;
}
if(strcmp(cmdtext, "/opendoors",true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective);
}
return 1;
}
if(strcmp(cmdtext, "/alarmon",true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
}
return 1;
}
if(strcmp(cmdtext, "/alarmoff",true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,VEHICLE_PARAMS_OFF,doors,bonnet,boot,objective);
}
return 1;
}
if(strcmp(cmdtext, "/openbonnet",true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective);
}
return 1;
}
if(strcmp(cmdtext, "/closebonnet",true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective);
}
return 1;
}
if(strcmp(cmdtext, "/openboot",true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
}
return 1;
}
if(strcmp(cmdtext, "/closeboot",true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective);
}
return 1;
}
if (strcmp("/kill", cmdtext, true, 10) == 0)
{
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, 0xC2A2DAAA, "You Have Comitted Suicide");
return 1;
}
if (!strcmp("/refuel",cmdtext,true,7)) {
if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFC800FF,"You are not in an vehicle!"); //if a player isnt in a vehicle, it stops here
if (isrefuelling[playerid]) return SendClientMessage(playerid,0xFFC800FF,"You are already refuelling!"); //if a player is already refuelling, it stops here
if (GetPlayerMoney(playerid) - 80 <0) return SendClientMessage(playerid,0xFFC800FF,"You dont have enough money!"); //if a player doesnt have $80 anymore, it stops here
GivePlayerMoney(playerid,-80); //Sets the player's cash -$80
SetCameraBehindPlayer(playerid); //Sets the camera behind the player (looks better because the player will be frozen for a few secs)
TogglePlayerControllable(playerid,0); //freezes the player so he cant drive and refuel at the same time
isrefuelling[playerid] = 1; //setting isrefuelling to 1 so the player cant spam /refuel
TextDrawSetString(td_fuel[playerid],"Refuelling..."); //changing textdraw to /refuel
SetTimerEx("timer_refuel",4500,false,"i",playerid); //setting refueltimer
return 1;
}
return 0;
}