Ti l-am facut eu ca FS.
Код:
#include <a_samp>
#include <core>
#include <float>
#include <file>
#include <utils>
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_LIGHTRED 0xFF6347AA
forward ProxDetectorS(Float:radi, playerid, targetid);
enum pInfo
{
pKey[128],
pLevel,
pAdmin,
pDonateRank,
gPupgrade,
pConnectTime,
pReg,
pSex,
pAge,
pOrigin,
pCK,
pMuted,
pExp,
pCash,
pAccount,
pCrimes,
pKills,
pDeaths,
pArrested,
pWantedDeaths,
pPhoneBook,
pLottoNr,
pFishes,
pBiggestFish,
pJob,
pPayCheck,
pHeadValue,
pJailed,
pJailTime,
pMats,
pDrugs,
pLeader,
pMember,
pFMember,
pRank,
pChar,
pContractTime,
pDetSkill,
pSexSkill,
pBoxSkill,
pLawSkill,
pMechSkill,
pJackSkill,
pCarSkill,
pNewsSkill,
pDrugsSkill,
pCookSkill,
pFishSkill,
pRobSkill,
Float:pHealth,
Float:pSHealth,
pInt,
pLocal,
pTeam,
pModel,
pPnumber,
pPhousekey,
pPbiskey,
Float:pPos_x,
Float:pPos_y,
Float:pPos_z,
pTow,
pRob,
pSf,
pGangteam,
pCarLic,
pFlyLic,
pBoatLic,
pFishLic,
pGunLic,
pMatsLic,
pPassport,
pGun1,
pGun2,
pGun3,
pGun4,
pAmmo1,
pAmmo2,
pAmmo3,
pAmmo4,
pCarTime,
pPayDay,
pPayDayHad,
pCDPlayer,
pWins,
pLoses,
pAlcoholPerk,
pDrugPerk,
pMiserPerk,
pPainPerk,
pTraderPerk,
pTut,
pMissionNr,
pWarns,
pAdjustable,
pFuel,
pMarried,
pMarriedTo[128],
};
new PlayerInfo[MAX_PLAYERS][pInfo];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" /fine by iNT3X ");
print("--------------------------------------\n");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new tmp[256];
new giveplayerid, moneys, idx;
new giveplayer[MAX_PLAYER_NAME];
new sendername[MAX_PLAYER_NAME];
new string[256];
if(strcmp(cmdtext, "/fine", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 3)
{
SendClientMessage(playerid, COLOR_GREY, " You are not an Admin!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /fine [playerid/PartOfName] [price] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /fine [playerid/PartOfName] [price] [reason]");
return 1;
}
moneys = strval(tmp);
if(moneys < 1 || moneys > 999999999) { SendClientMessage(playerid, COLOR_GREY, " Fine Money can't be below 1 or higher then 999999999 !"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
moneys = strvalEx(tmp);
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /fine [playerid/PartOfName] [price] [reason]");
return 1;
}
format(string, sizeof(string), "AdmCmd: %s was fined by an admin, reason: %s", giveplayer, sendername, cmdtext);
SendClientMessageToAll(COLOR_LIGHTRED, string);
GivePlayerMoney(giveplayer, -moneys);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
return 1;
}
}
return 1;
}
return 0;
}
public ProxDetectorS(Float:radi, playerid, targetid)
{
if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
//radi = 2.0; //Trigger Radius
GetPlayerPos(targetid, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
stock strvalEx( const string[] )
{
//Register Protection
if( strlen( string ) >= 50 ) return 0;
return strval(string);
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Da o eroare dar nu reusesc s-o fac.
Daca si la tine da eroarea, copii doar comanda din ce ti-am facut eu in GM-ul tau. Adica asta:
Код:
if(strcmp(cmdtext, "/fine", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 3)
{
SendClientMessage(playerid, COLOR_GREY, " You are not an Admin!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /fine [playerid/PartOfName] [price] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /fine [playerid/PartOfName] [price] [reason]");
return 1;
}
moneys = strval(tmp);
if(moneys < 1 || moneys > 999999999) { SendClientMessage(playerid, COLOR_GREY, " Fine Money can't be below 1 or higher then 999999999 !"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
moneys = strvalEx(tmp);
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /fine [playerid/PartOfName] [price] [reason]");
return 1;
}
format(string, sizeof(string), "AdmCmd: %s was fined by an admin, reason: %s", giveplayer, sendername, cmdtext);
SendClientMessageToAll(COLOR_LIGHTRED, string);
GivePlayerMoney(giveplayer, -moneys);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
return 1;
}
}
return 1;
}