ZH 3 R 0
ZH 3 R 0
[ Credits ]
Y_Less - Y_Ini, SSCANF
Zeex - ZCMD
Dracoblue - Set, strreplace, pName, Encode, INI_Exist
Zh3r0 - Building up this system using the above functions...
!!!
INI_Exist Function is not from Y_Ini, i transformed it from DINI to this.
Remove the credits, and you are a complete moron. Do it! You will be a moron!
!!!
Changelog:
//
#include < a_samp >
#include < ZCMD >
#include < sscanf >
#include <YSI/y_ini>
//0.3c Colors
#define COL_RED "{F81414}"
#define COL_LIGHTBLUE "{00C0FF}"
#define COL_LRED "{FFA1A1}"
#define COL_GREEN "{6EF83C}"
#define COL_GREY "{C3C3C3}"
//Dialogs
#define DIALOG_REG 1995
#define DIALOG_REG_REQ 1996
#define DIALOG_LOGIN 1997
#define DIALOG_LOGIN2 1998
#define DIALOG_LOG_DONE 1999
#define DIALOG_LOG 2000
#define DIALOG_STATS 2001
#define INFO_BOX 2002
CMD:vinf(playerid, params[])
{
if ( GetPVarInt( playerid, "VIP Level" ) < 3 )
return SendClientMessage( playerid, -1, "You must be an VIP Level 3 to
use this command");
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
if ( !IsValidSkin( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} Invalid
skin ID.");
new Password[ 20 ],
String[ 129 ]
;
GetPVarString( playerid, "pPass", Password, 20 );
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
ResetPlayerMoney( params[ 0 ] );
GivePlayerMoney( params[ 0 ], params[ 1 ] );
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
if (GetPVarInt( playerid, "Level" ) < GetPVarInt( params[ 0 ], "Level" ) )
return SendClientMessage( playerid, -1, "You are not allowed to use this
command on this admin."),SendClientMessage( playerid, -1, "REASON: Player is higher
in grade than you.");
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
if ( !IsPlayerConnected( params[ 0 ] ) )
return SendClientMessage( playerid, -1, ""COL_RED"Player is not
connected");
SpawnPlayer( params[ 0 ] );
"COL_LIGHTBLUE"Level {FFFFFF}1\n\
/vipgod\n\n\
"COL_LIGHTBLUE"Level {FFFFFF}2\n\
/vipgod /vipcargod\n\n\
"COL_LIGHTBLUE"Level {FFFFFF}3\n\
format( CBox, sizeof CBox, "%s-Your job is to ensure nobody abuses the
commands, or insults players\n\
you must take control over mean players and
punish them.\n\n\
"COL_RED"Level {FFFFFF}3 "COL_RED"- {FFFFFF}
( "COL_RED""Level3" {FFFFFF})\n\
-The "Level3" can do whatever they want, you
cannot judge their actions.\n\n\n\
Please take a look at the Admin
Commands -> "COL_RED"/acmds", CBox);
ShowPlayerDialog( playerid, INFO_BOX, DIALOG_STYLE_MSGBOX, "{FFFFFF}Admin
Commands", CBox, "Oke", "");
return 1;
}
CMD:stats( playerid, paramz[ ] )
{
if ( GetPVarInt( playerid, "Logged" ) == 0 )
return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} To view
your stats you must be logged in ");
new
iBox[ 1024 ],
RegDate[ 40 ],
pLastOn[ 20 + 20 ],
pLevel = GetPVarInt( playerid, "Level")
;
GetPVarString( playerid, "Date", RegDate, sizeof RegDate );
GetPVarString( playerid, "On", pLastOn, sizeof pLastOn );
GetPlayerLevelName( playerid ),
pLevel,
GetPlayerVLevel(
playerid ),
GetPlayerMoney( playerid ),
GetPlayerScore( playerid ),
GetPVarInt( playerid,"Kills" ),
GetPVarInt( playerid,"Deaths" ),
RegDate,
GetPlayerInterior( playerid ) );
GetPlayerVirtualWorld( playerid ),
GetMySkin( playerid ),
GetMyTime( playerid ),
GetMyWeather( playerid ),
pLastOn,
">>>", "Exit");
if ( strlen( inputtext[ 0 ] ) < 3 || strlen( inputtext[ 0 ] ) >
20 )
return ShowPlayerDialog( playerid, DIALOG_REG,
DIALOG_STYLE_INPUT, "{FFFFFF}Password", ""COL_RED"Error!\n\
"COL_RED"#{FFFFFF}Min. 3
Char. Max. 20 Char.",
">>>", "Exit");
new
PlayerFile[ 13 + MAX_PLAYER_NAME ],
pDate[ 8 + 15 ], //HH:MM:SS + DD.MM.YYYY = 18
pYear,
pMonth,
pDay,
pHour,
pMinute,
pSecond,
pIP[ 20 ],
InfBox[ 512 ]
;
getdate(pYear, pMonth, pDay ),gettime(pHour, pMinute,
pSecond );
GetPlayerIp( playerid, pIP, 20 );
"COL_LIGHTBLUE"Password: {FFFFFF}%s\n\n\
You received
"COL_GREEN"$5000{FFFFFF} for registering.\n\
Would you like to
login?", pName( playerid ),
inputtext );
ShowPlayerDialog( playerid, DIALOG_LOG,
DIALOG_STYLE_MSGBOX, "Login", InfBox, "Yes", "No" );
new
INI:PlayerAcc = INI_Open( PlayerFile );
INI_Close( PlayerAcc );
}
}
case DIALOG_REG_REQ:
{
if ( response ) cmd_register( playerid, "");
if ( !response ) return 0;
}
"Login", "Kick");
case DIALOG_LOG:
{
if ( response )
ShowPlayerDialog( playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT,
"{FFFFFF}Password", "{FFFFFF}Please write your current
password.","Login","Kick");
}
case DIALOG_LOGIN2:
{
if ( !response ) return Kick( playerid );
if ( response )
{
if ( strlen( inputtext ) == 0 )
return ShowPlayerDialog( playerid, DIALOG_LOGIN2,
DIALOG_STYLE_INPUT, "{FFFFFF}Password", ""COL_RED"Error!\n\
"Login", "Kick");
new
PlayerFile[ 13 + MAX_PLAYER_NAME ],
Password[ 20 + 1 ]
;
format( PlayerFile , sizeof PlayerFile, "Accounts/%s.ini",
Encode( pName( playerid ) ) );
INI_ParseFile( PlayerFile, "ParsePlayerPass", false, true,
playerid );
GetPVarString( playerid, "pPass", Password, sizeof Password );
GetPlayerLevelName( playerid ),
GetPlayerVLevel( playerid ),
GetPVarInt( playerid,
"Score" ),
Pdata );
}
if ( GetPVarInt( playerid, "Level" ) > 1 )
{
format( sBoxInfo, sizeof sBoxInfo, "{FFFFFF}These are your
stats:\n\n\
{FFFFFF}Level:
"COL_LIGHTBLUE"%s\n\
{FFFFFF}VIP Level:
"COL_LIGHTBLUE"%d\n\
{FFFFFF}Score:
"COL_LIGHTBLUE"%d\n\
{FFFFFF}Registered on:
"COL_LIGHTBLUE"%s\n\n",
GetPlayerLevelName( playerid ),
GetPlayerVLevel( playerid ),
GetPVarInt( playerid,
"Score" ),
Pdata );
}
else ShowPlayerDialog(playerid, DIALOG_LOGIN2,
DIALOG_STYLE_INPUT, ""COL_RED"Wrong password...", ""COL_RED"Wrong password!\
n{FFFFFF}Please try again.", "Login", "Kick");
}
}
}
return 1;
}
public OnPlayerConnect(playerid)
{
if ( !INI_Exist( pName( playerid ) ) )
ShowPlayerDialog( playerid, DIALOG_REG_REQ, DIALOG_STYLE_MSGBOX,
"{FFFFFF}Password", "{FFFFFF}To play you must register an account!", "Ok", "");
else
ShowPlayerDialog( playerid, DIALOG_LOGIN, DIALOG_STYLE_MSGBOX,
"{FFFFFF}Password", "{FFFFFF}Your name is registered, would you like to login?",
"Yes", "No");
return 1;
}
public OnPlayerRequestSpawn( playerid )
{
SetTimerEx("LoadFav", 200, false , "i" , playerid );
return 1;
}
forward LoadFav( playerid );
public LoadFav( playerid )
{
GivePlayerMoney ( playerid, GetPVarInt( playerid, "Moneys" ) );
SetPlayerScore ( playerid, GetPVarInt( playerid, "Score" ) );
SetPlayerWeather( playerid, GetPVarInt( playerid, "Weather" ) );
SetPlayerTime ( playerid, GetPVarInt( playerid, "Time" ), 0 );
SetPlayerSkin ( playerid, GetPVarInt( playerid, "Skin" ) );
new
INI:PlayerAcc = INI_Open( PlayerFile );
stock INI_Exist(nickname[])
{
new tmp[255];
format(tmp,sizeof(tmp),"Accounts/%s.ini",Encode( nickname ) );
return fexist(tmp);
}
//DracoBlue
stock Encode(nickname[])
{
new tmp[255];
set(tmp,nickname);
tmp=strreplace("_","_00",tmp);
tmp=strreplace(";","_01",tmp);
tmp=strreplace("!","_02",tmp);
tmp=strreplace("/","_03",tmp);
tmp=strreplace("\\","_04",tmp);
tmp=strreplace("[","_05",tmp);
tmp=strreplace("]","_06",tmp);
tmp=strreplace("?","_07",tmp);
tmp=strreplace(".","_08",tmp);
tmp=strreplace("*","_09",tmp);
tmp=strreplace("<","_10",tmp);
tmp=strreplace(">","_11",tmp);
tmp=strreplace("{","_12",tmp);
tmp=strreplace("}","_13",tmp);
tmp=strreplace(" ","_14",tmp);
tmp=strreplace("\"","_15",tmp);
tmp=strreplace(":","_16",tmp);
tmp=strreplace("|","_17",tmp);
tmp=strreplace("=","_18",tmp);
return tmp;
}
stock set(dest[],source[]) {
new count = strlen(source);
new i=0;
for (i=0;i<count;i++) {
dest[i]=source[i];
}
dest[count]=0;
}
stock strreplace(trg[],newstr[],src[]) {
new f=0;
new s1[255];
new tmp[255];
format(s1,sizeof(s1),"%s",src);
f = strfind(s1,trg);
tmp[0]=0;
while (f>=0) {
strcat(tmp,ret_memcpy(s1, 0, f));
strcat(tmp,newstr);
format(s1,sizeof(s1),"%s",ret_memcpy(s1, f+strlen(trg), strlen(s1)-f));
f = strfind(s1,trg);
}
strcat(tmp,s1);
return tmp;
}
ret_memcpy(source[],index=0,numbytes) {
new tmp[255];
new i=0;
tmp[0]=0;
if (index>=strlen(source)) return tmp;
if (numbytes+index>=strlen(source)) numbytes=strlen(source)-index;
if (numbytes<=0) return tmp;
for (i=index;i<numbytes+index;i++) {
tmp[i-index]=source[i];
if (source[i]==0) return tmp;
}
tmp[numbytes]=0;
return tmp;
}
forward GodTimer( playerid );
public GodTimer( playerid )
{
if ( GetPVarInt( playerid, "God" ) == 0 ) KillTimer( God[ playerid ] );
SetPlayerHealth( playerid, 999999999.0 );
}
forward CarGodTimer( playerid );
public CarGodTimer( playerid )
{
if ( GetPVarInt( playerid, "CGod" ) == 0 ) KillTimer( CGod[ playerid ] );
if ( IsPlayerInAnyVehicle( playerid ) == 1 )
{
RepairVehicle( GetPlayerVehicleID( playerid ) );
SetVehicleHealth( GetPlayerVehicleID( playerid ), 9999.0 );
}
}
forward CallInfernus(playerid);
public CallInfernus(playerid)
{
if(IsPlayerInAnyVehicle(playerid)) RemovePlayerFromVehicle(playerid);
new Float: X, Float: Y, Float: Z, Float: Ang;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Ang);
PutPlayerInVehicle(playerid, pInfernus[playerid], 0);
SetVehiclePos(pInfernus[playerid], X, Y, Z);
SetVehicleZAngle(pInfernus[playerid], Ang);
SetVehicleHealth(pInfernus[playerid], 1000.0);
LinkVehicleToInterior(pInfernus[playerid], GetPlayerInterior(playerid));
SendClientMessage( playerid, -1, "-Personal "COL_LIGHTBLUE"Infernus{FFFFFF}
called!");
}
forward CreateInfernus( playerid );
public CreateInfernus(playerid)
{
if(IsPlayerInAnyVehicle(playerid)) RemovePlayerFromVehicle(playerid);
new Float: X, Float: Y, Float: Z, Float: Ang;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Ang);
pInfernus[playerid] = CreateVehicle(411, X, Y, Z+3, Ang, 75,3, 5000000);
PutPlayerInVehicle(playerid, pInfernus[playerid], 0);
LinkVehicleToInterior(pInfernus[playerid], GetPlayerInterior(playerid));
printf("Personal Infernus created for %s.", pName(playerid));
SendClientMessage( playerid, -1, "-Personal "COL_LIGHTBLUE"Infernus{FFFFFF}
created!");
for(new i=0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) && i != playerid)
{
SetVehicleParamsForPlayer(pInfernus[playerid], i, 0, 1);
}
}
}
forward CallNRG(playerid);
public CallNRG(playerid)
{
if(IsPlayerInAnyVehicle(playerid)) RemovePlayerFromVehicle(playerid);
new Float: X, Float: Y, Float: Z, Float: Ang;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Ang);
PutPlayerInVehicle(playerid, pNrg500[playerid], 0);
SetVehiclePos(pNrg500[playerid], X, Y, Z);
SetVehicleZAngle(pNrg500[playerid], Ang);
SetVehicleHealth(pNrg500[playerid], 1000.0);
LinkVehicleToInterior(pNrg500[playerid], GetPlayerInterior(playerid));
SendClientMessage( playerid, -1, "-Personal "COL_LIGHTBLUE"NRG-500{FFFFFF}
called");
}
forward CreateNRG(playerid);
public CreateNRG(playerid)
{
if(IsPlayerInAnyVehicle(playerid)) RemovePlayerFromVehicle(playerid);
new Float: X, Float: Y, Float: Z, Float: Ang;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Ang);
pNrg500[playerid] = CreateVehicle(522, X, Y, Z+3, Ang, 75,3, 5000000);
PutPlayerInVehicle(playerid, pNrg500[playerid], 0);
LinkVehicleToInterior(pNrg500[playerid], GetPlayerInterior(playerid));
printf("Personal NRG created for %s.", pName(playerid));
SendClientMessage( playerid, -1, "-Personal "COL_LIGHTBLUE"NRG-500{FFFFFF}
created!");
for(new i=0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) && i != playerid)
{
SetVehicleParamsForPlayer(pNrg500[playerid], i, 0, 1);
}
}
}