if(strcmp(cmd, "/breakin", true) == 0 || strcmp(cmd, "/lockpick", true) == 0) { if(PlayerInfo[playerid][pScrew] >= 1 || PlayerInfo[playerid][pAdmin] >= 1337) { new biz = IsPlayerNearBiz(playerid); new house = IsPlayerNearHouse(playerid); new car = -1; new Float:vX, Float:vY, Float:vZ; for(new i = 0; i < MAX_VEHICLES; i++) { GetVehiclePos(i, vX, vY, vZ); if(IsPlayerInRangeOfPoint(playerid, 5.0, vX, vY, vZ)) { car = i; break; } } strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME); if(biz == -1 && house == -1 && car == -1) return SendClientMessage(playerid, COLOR_GREY, " You aren't at a house/business/vehicle."); if(LockPickingBiz[playerid] != 999) return SendClientMessage(playerid, COLOR_GREY, " You are already lockpicking a business."); if(LockPickingHouse[playerid] != 999) return SendClientMessage(playerid, COLOR_GREY, " You are already lockpicking a house."); if(LockPickingCar[playerid] != 999) return SendClientMessage(playerid, COLOR_GREY, " You are already lockpicking a car."); if(biz != -1) //they are picking a biz { if(BizInfo[biz][bOwned] == 0) return SendClientMessage(playerid,COLOR_GREY," This business is not owned."); if(BizInfo[biz][bLocked] == 0) return SendClientMessage(playerid,COLOR_GREY," This business is already unlocked."); // for(new i = 0; i < MAX_PLAYERS; i++) foreach (Player, i) { if(IsPlayerConnected(i)) { if(PlayerInfo[i][pBizKey] == biz) { format(string, sizeof(string), "SMS: This is an automated message informing you that your business alarm has been activated.",giveplayer); SendClientMessage(i, COLOR_YELLOW, string); break; } } } if(PlayerInfo[playerid][pMask] == 1){ sendername = "Stranger"; } format(string, sizeof(string), "* %s pulls out a screwdriver and begins picking at the lock on the business.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); LockPickingBiz[playerid] = biz; } else if(house != -1) //they are picking a home { if(HouseInfo[house][hOwned] == 0) return SendClientMessage(playerid,COLOR_GREY," This house is not owned."); if(HouseInfo[house][hLocked] == 0) return SendClientMessage(playerid,COLOR_GREY," This house is already unlocked."); // for(new i = 0; i < MAX_PLAYERS; i++) foreach (Player, i) { if(IsPlayerConnected(i)) { if(PlayerInfo[i][pHouseID] == house) { format(string, sizeof(string), "SMS: This is an automated message informing you that your house alarm has been activated.",giveplayer); SendClientMessage(i, COLOR_YELLOW, string); break; } } } if(PlayerInfo[playerid][pMask] == 1){ sendername = "Stranger"; } format(string, sizeof(string), "* %s pulls out a screwdriver and begins picking at the lock on the house.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); LockPickingHouse[playerid] = house; } else if(car != -1) //they are picking a car { new Float:X, Float:Y, Float:Z; GetVehiclePos(car, X, Y, Z); if(gCarLock[car] == 0) return SendClientMessage(playerid,COLOR_GREY," This vehicle is already unlocked."); foreach (Player, i) { if(IsPlayerConnected(i)) { if(CarInfo[PlayerInfo[playerid][pCar][0]][c_ID] == car) { if(CarInfo[PlayerInfo[playerid][pCar][0]][c_Alarm] != 1) break; format(string, sizeof(string), "SMS: This is an automated message informing you that your vehicle alarm has been activated.",giveplayer); SendClientMessage(i, COLOR_YELLOW, string); SetPlayerCheckpoint(playerid, X, Y, Z, 3.0); CP[playerid] = CHECKPOINT_CAR_ALARM; break; } else if(CarInfo[PlayerInfo[playerid][pCar][1]][c_ID] == car) { if(CarInfo[PlayerInfo[playerid][pCar][1]][c_Alarm] != 1) break; format(string, sizeof(string), "SMS: This is an automated message informing you that your vehicle alarm has been activated.",giveplayer); SendClientMessage(i, COLOR_YELLOW, string); SetPlayerCheckpoint(playerid, X, Y, Z, 3.0); CP[playerid] = CHECKPOINT_CAR_ALARM; break; } } } if(PlayerInfo[playerid][pMask] == 1){ sendername = "Stranger"; } format(string, sizeof(string), "* %s pulls out a screwdriver and begins picking at the lock on the vehicle.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); LockPickingCar[playerid] = car; } PlayerInfo[playerid][pScrew] -= 1; } else { return SendClientMessage(playerid, COLOR_GREY, " You do not have a screwdriver! You may purchase one from any 24/7."); } }
CMD:breakin(playerid,params[])
{
if(PlayerInfo[playerid][pScrew] >= 1 || PlayerInfo[playerid][pAdmin] >= 1337)
{
new biz = IsPlayerNearBiz(playerid);
new house = IsPlayerNearHouse(playerid);
new car = -1;
new Float:vX, Float:vY, Float:vZ;
for(new i = 0; i < MAX_VEHICLES; i++)
{
GetVehiclePos(i, vX, vY, vZ);
if(IsPlayerInRangeOfPoint(playerid, 5.0, vX, vY, vZ))
{
car = i;
break;
}
}
strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
if(biz == -1 && house == -1 && car == -1) return SendClientMessage(playerid, COLOR_GREY, " You aren't at a house/business/vehicle.");
if(LockPickingBiz[playerid] != 999) return SendClientMessage(playerid, COLOR_GREY, " You are already lockpicking a business.");
if(LockPickingHouse[playerid] != 999) return SendClientMessage(playerid, COLOR_GREY, " You are already lockpicking a house.");
if(LockPickingCar[playerid] != 999) return SendClientMessage(playerid, COLOR_GREY, " You are already lockpicking a car.");
if(biz != -1) //they are picking a biz
{
if(BizInfo[biz][bOwned] == 0) return SendClientMessage(playerid,COLOR_GREY," This business is not owned.");
if(BizInfo[biz][bLocked] == 0) return SendClientMessage(playerid,COLOR_GREY," This business is already unlocked.");
// for(new i = 0; i < MAX_PLAYERS; i++)
foreach (Player, i)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pBizKey] == biz)
{
format(string, sizeof(string), "SMS: This is an automated message informing you that your business alarm has been activated.",giveplayer);
SendClientMessage(i, COLOR_YELLOW, string);
break;
}
}
}
if(PlayerInfo[playerid][pMask] == 1){ sendername = "Stranger"; }
format(string, sizeof(string), "* %s pulls out a screwdriver and begins picking at the lock on the business.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
LockPickingBiz[playerid] = biz;
}
else if(house != -1) //they are picking a home
{
if(HouseInfo[house][hOwned] == 0) return SendClientMessage(playerid,COLOR_GREY," This house is not owned.");
if(HouseInfo[house][hLocked] == 0) return SendClientMessage(playerid,COLOR_GREY," This house is already unlocked.");
// for(new i = 0; i < MAX_PLAYERS; i++)
foreach (Player, i)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pHouseID] == house)
{
format(string, sizeof(string), "SMS: This is an automated message informing you that your house alarm has been activated.",giveplayer);
SendClientMessage(i, COLOR_YELLOW, string);
break;
}
}
}
if(PlayerInfo[playerid][pMask] == 1){ sendername = "Stranger"; }
format(string, sizeof(string), "* %s pulls out a screwdriver and begins picking at the lock on the house.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
LockPickingHouse[playerid] = house;
}
else if(car != -1) //they are picking a car
{
new Float:X, Float:Y, Float:Z;
GetVehiclePos(car, X, Y, Z);
if(gCarLock[car] == 0) return SendClientMessage(playerid,COLOR_GREY," This vehicle is already unlocked.");
foreach (Player, i)
{
if(IsPlayerConnected(i))
{
if(CarInfo[PlayerInfo[playerid][pCar][0]][c_ID] == car)
{
if(CarInfo[PlayerInfo[playerid][pCar][0]][c_Alarm] != 1) break;
format(string, sizeof(string), "SMS: This is an automated message informing you that your vehicle alarm has been activated.",giveplayer);
SendClientMessage(i, COLOR_YELLOW, string);
SetPlayerCheckpoint(playerid, X, Y, Z, 3.0);
CP[playerid] = CHECKPOINT_CAR_ALARM;
break;
}
else if(CarInfo[PlayerInfo[playerid][pCar][1]][c_ID] == car)
{
if(CarInfo[PlayerInfo[playerid][pCar][1]][c_Alarm] != 1) break;
format(string, sizeof(string), "SMS: This is an automated message informing you that your vehicle alarm has been activated.",giveplayer);
SendClientMessage(i, COLOR_YELLOW, string);
SetPlayerCheckpoint(playerid, X, Y, Z, 3.0);
CP[playerid] = CHECKPOINT_CAR_ALARM;
break;
}
}
}
if(PlayerInfo[playerid][pMask] == 1){ sendername = "Stranger"; }
format(string, sizeof(string), "* %s pulls out a screwdriver and begins picking at the lock on the vehicle.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
LockPickingCar[playerid] = car;
}
PlayerInfo[playerid][pScrew] -= 1;
}
else
{
return SendClientMessage(playerid, COLOR_GREY, " You do not have a screwdriver! You may purchase one from any 24/7.");
}
return 1;
}
CMD:lockpick(playerid, params[])
return cmd_breakin(playerid, params);
CMD:pay(playerid, params[]) { new moneys,giveplayerid; if(IsPlayerConnected(playerid)) { if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [playerid/PartOfName] [amount]"); return 1; } giveplayerid = ReturnUser(tmp); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [playerid/PartOfName] [amount]"); return 1; } moneys = strvalEx(tmp); if(moneys > 1000 && PlayerInfo[playerid][pLevel] < 2) { SendClientMessage(playerid, COLOR_GRAD1, " You must be level 2 to pay more than $1000 at a time !"); return 1; } if(moneys < 1 || moneys > 100000) { SendClientMessage(playerid, COLOR_GRAD1, " You can't pay under $1 or more than $100,000 at a time !"); return 1; } if(IsPlayerConnected(giveplayerid)) { if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, " You can't pay money to yourself !"); return 1; } if(giveplayerid != INVALID_PLAYER_ID) { if(IsPlayerInRangeOfPlayer(5.0, playerid, giveplayerid) && (GetPlayerState(giveplayerid) != PLAYER_STATE_SPECTATING)) { strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME); strmid(giveplayer, PlayerRPName(giveplayerid), 0, MAX_PLAYER_NAME); new playermoney = PlayerInfo[playerid][pCash]; if(moneys > 0 && playermoney >= moneys) { PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-moneys; GivePlayerMoney(playerid, (0 - moneys)); PlayerInfo[giveplayerid][pCash] = PlayerInfo[giveplayerid][pCash]+moneys; GivePlayerMoney(giveplayerid, moneys); format(string, sizeof(string), " You have paid $%d to %s.",moneys,giveplayer); SendClientMessage(playerid, COLOR_GRAD1, string); format(string, sizeof(string), " You have recieved $%d from %s.", moneys,sendername); SendClientMessage(giveplayerid, COLOR_GRAD1, string); if(PlayerInfo[playerid][pMask] == 1) format(string, sizeof(string), "* Stranger takes out some cash, and hands it to %s.",giveplayer); else format(string, sizeof(string), "* %s takes out some cash, and hands it to %s.", sendername,giveplayer); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0); new plrIP[16]; new giveplrIP[16]; GetPlayerIp(playerid, plrIP, sizeof(plrIP)); GetPlayerIp(giveplayerid, giveplrIP, sizeof(giveplrIP)); format(string, sizeof(string), "%s (IP:%s) (Key:%s) (ConTime:%d) has paid $%d to %s (IP:%s) (Key:%s)", sendername,plrIP,PlayerInfo[playerid][pKey], PlayerInfo[playerid][pConnectTime],moneys,giveplayer,giveplrIP,PlayerInfo[giveplayerid][pKey]); PayLog(string); strmid(LastPaid[playerid],giveplayer,0,strlen(giveplayer)); } else { SendClientMessage(playerid, COLOR_GRAD1, " Invalid transaction amount !"); } } else { SendClientMessage(playerid, COLOR_GRAD1, " You're too far away !"); } } } else { format(string, sizeof(string), " %d is not an active player !", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; }
i did convert from strcmp is that is right ?
Код:
CMD:pay(playerid, params[]) { new moneys,giveplayerid; if(IsPlayerConnected(playerid)) { if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [playerid/PartOfName] [amount]"); return 1; } giveplayerid = ReturnUser(tmp); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [playerid/PartOfName] [amount]"); return 1; } moneys = strvalEx(tmp); if(moneys > 1000 && PlayerInfo[playerid][pLevel] < 2) { SendClientMessage(playerid, COLOR_GRAD1, " You must be level 2 to pay more than $1000 at a time !"); return 1; } if(moneys < 1 || moneys > 100000) { SendClientMessage(playerid, COLOR_GRAD1, " You can't pay under $1 or more than $100,000 at a time !"); return 1; } if(IsPlayerConnected(giveplayerid)) { if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, " You can't pay money to yourself !"); return 1; } if(giveplayerid != INVALID_PLAYER_ID) { if(IsPlayerInRangeOfPlayer(5.0, playerid, giveplayerid) && (GetPlayerState(giveplayerid) != PLAYER_STATE_SPECTATING)) { strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME); strmid(giveplayer, PlayerRPName(giveplayerid), 0, MAX_PLAYER_NAME); new playermoney = PlayerInfo[playerid][pCash]; if(moneys > 0 && playermoney >= moneys) { PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-moneys; GivePlayerMoney(playerid, (0 - moneys)); PlayerInfo[giveplayerid][pCash] = PlayerInfo[giveplayerid][pCash]+moneys; GivePlayerMoney(giveplayerid, moneys); format(string, sizeof(string), " You have paid $%d to %s.",moneys,giveplayer); SendClientMessage(playerid, COLOR_GRAD1, string); format(string, sizeof(string), " You have recieved $%d from %s.", moneys,sendername); SendClientMessage(giveplayerid, COLOR_GRAD1, string); if(PlayerInfo[playerid][pMask] == 1) format(string, sizeof(string), "* Stranger takes out some cash, and hands it to %s.",giveplayer); else format(string, sizeof(string), "* %s takes out some cash, and hands it to %s.", sendername,giveplayer); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0); new plrIP[16]; new giveplrIP[16]; GetPlayerIp(playerid, plrIP, sizeof(plrIP)); GetPlayerIp(giveplayerid, giveplrIP, sizeof(giveplrIP)); format(string, sizeof(string), "%s (IP:%s) (Key:%s) (ConTime:%d) has paid $%d to %s (IP:%s) (Key:%s)", sendername,plrIP,PlayerInfo[playerid][pKey], PlayerInfo[playerid][pConnectTime],moneys,giveplayer,giveplrIP,PlayerInfo[giveplayerid][pKey]); PayLog(string); strmid(LastPaid[playerid],giveplayer,0,strlen(giveplayer)); } else { SendClientMessage(playerid, COLOR_GRAD1, " Invalid transaction amount !"); } } else { SendClientMessage(playerid, COLOR_GRAD1, " You're too far away !"); } } } else { format(string, sizeof(string), " %d is not an active player !", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; } |
CMD:charity(playerid, params[]) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /charity [amount]"); return 1; } moneys = strvalEx(tmp); if(moneys < 0) { SendClientMessage(playerid, COLOR_GRAD1, " That is not enough !"); return 1; } if(PlayerInfo[playerid][pCash] < moneys) { SendClientMessage(playerid, COLOR_GRAD1, " You don't have that much money !"); return 1; } PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-moneys; GivePlayerMoney(playerid, -moneys); strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME); format(string, sizeof(string), "%s Thank you for you donation of $%d.",sendername, moneys); SendClientMessage(playerid, COLOR_GRAD1, string); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); PayLog(string); } return 1; }