Another problem
#1

Hey , i have another problem with a vip system , it works when i try to give vip to others all comands works but when player leave server and join again he has no longer vip , it doesnt save . I try to resolv the problem but didn't succeded.Here its the code.
Код:
#include <a_samp>
#include <dudb>
#include <ladmin>
#include <CPLoader>
#include <lethaldudb2>
#include <JunkBusterFS>

#define blue 0x375FFFFF
#define red 0xFF0000AA
#define green 0x33FF33AA
#define yellow 0xFFFF00AA
#define grey 0xC0C0C0AA
#define blue1 0x2641FEAA
#define lightblue 0x33CCFFAA
#define orange 0xFF9900AA
#define black 0x2C2727AA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_PURPLE 0x800080AA
#define COLOR_BLACK 0x000000AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_GREEN1 0x33AA33AA
#define COLOR_BROWN 0xA52A2AAA
#define COLOR_ULTRARED 0xE60000FF

#define ENABLE_SPEC

// Spec
#define ADMIN_SPEC_TYPE_NONE 0
#define ADMIN_SPEC_TYPE_PLAYER 1
#define ADMIN_SPEC_TYPE_VEHICLE 2

// DCMD
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

enum PlayerData
{
	Vip,
	Level,
	SpecID,
	SpecType
};

new Float:Pos[MAX_PLAYERS][4];

new name[MAX_PLAYER_NAME];

new PlayerInfo[MAX_PLAYERS][PlayerData];

new avcc[MAX_PLAYERS];
AntiDeAMX()
{
	new a[][] =
	{
		"Unarmed (Fist)",
		"Brass K"
	};
	#pragma unused a
}

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	AntiDeAMX();
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public OnPlayerConnect(playerid)
{
	avcc[playerid]=0;
	PlayerInfo[playerid][Vip] = (dUserINT(PlayerName2(playerid)).("Vip"));
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    PlayerInfo[playerid][Vip] = 0;
	avcc[playerid]=0;
	#if defined ENABLE_SPEC
	for(new x=0; x<MAX_PLAYERS; x++)
	    if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
   		   	AdvanceSpectate(x);
	#endif
	return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
	#if defined ENABLE_SPEC
	for(new x=0; x<MAX_PLAYERS; x++)
	    if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
	       AdvanceSpectate(x);
	#endif
	return 1;
}
forward ACC(playerid);
public ACC(playerid)
{
	if (avcc[playerid]==1)
	{
	if (IsPlayerInAnyVehicle(playerid)&&(GetPlayerState(playerid)==PLAYER_STATE_DRIVER))
	{
	new vehicleid;
	vehicleid = GetPlayerVehicleID(playerid);
	new rand = random(126)+0;
	new rand1 = random(126)+0;
	ChangeVehicleColor(vehicleid, rand, rand1);
	}
	}
	return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(saveskin,8,cmdtext);
	dcmd(outskin,7,cmdtext);
	dcmd(vipgoto,7,cmdtext);
	dcmd(givevip,7,cmdtext);
	dcmd(scoatevip,9,cmdtext);
	dcmd(spawnme,7,cmdtext);
	dcmd(carcolor,8,cmdtext);
	dcmd(vips,4,cmdtext);
	#if defined ENABLE_SPEC
	dcmd(spec,4,cmdtext);
	dcmd(specoff,8,cmdtext);
	#endif
	
	new cmd[256], string[128], tmp[256], idx;
	cmd = strtok(cmdtext, idx);
	
	if(strcmp(cmdtext, "/ltunedcar2", true)==0 || strcmp(cmdtext, "/ltc2", true)==0)	{
	if(PlayerInfo[playerid][Vip] == 1) {
		if(IsPlayerInAnyVehicle(playerid)) {
		SendClientMessage(playerid,red,"Error: You already have a vehicle");
		} else  {
		new Float:X,Float:Y,Float:Z,Float:Angle,VehiclulRt;	GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle);
        VehiclulRt = CreateVehicle(560,X,Y,Z,Angle,1,-1,-1);	PutPlayerInVehicle(playerid,VehiclulRt,0);	    AddVehicleComponent(VehiclulRt, 1028);	AddVehicleComponent(VehiclulRt, 1030);	AddVehicleComponent(VehiclulRt, 1031);	AddVehicleComponent(VehiclulRt, 1138);	AddVehicleComponent(VehiclulRt, 1140);  AddVehicleComponent(VehiclulRt, 1170);
	    AddVehicleComponent(VehiclulRt, 1028);	AddVehicleComponent(VehiclulRt, 1030);	AddVehicleComponent(VehiclulRt, 1031);	AddVehicleComponent(VehiclulRt, 1138);	AddVehicleComponent(VehiclulRt, 1140);  AddVehicleComponent(VehiclulRt, 1170);
	    AddVehicleComponent(VehiclulRt, 1080);	AddVehicleComponent(VehiclulRt, 1086); AddVehicleComponent(VehiclulRt, 1087); AddVehicleComponent(VehiclulRt, 1010);	PlayerPlaySound(playerid,1133,0.0,0.0,0.0);	ChangeVehiclePaintjob(VehiclulRt,1);
	   	SetVehicleVirtualWorld(VehiclulRt, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(VehiclulRt, GetPlayerInterior(playerid));
		}
	} else SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
	return 1;	}
//------------------------------------------------------------------------------
	if(strcmp(cmdtext, "/ltunedcar3", true)==0 || strcmp(cmdtext, "/ltc3", true)==0)	{
	if(PlayerInfo[playerid][Vip] == 1) {
		if(IsPlayerInAnyVehicle(playerid)) {
		SendClientMessage(playerid,red,"Error: You already have a vehicle");
		} else  {
		
		new Float:X,Float:Y,Float:Z,Float:Angle,VehiclulRt;	GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle);
        VehiclulRt = CreateVehicle(560,X,Y,Z,Angle,1,-1,-1);	PutPlayerInVehicle(playerid,VehiclulRt,0);	    AddVehicleComponent(VehiclulRt, 1028);	AddVehicleComponent(VehiclulRt, 1030);	AddVehicleComponent(VehiclulRt, 1031);	AddVehicleComponent(VehiclulRt, 1138);	AddVehicleComponent(VehiclulRt, 1140);  AddVehicleComponent(VehiclulRt, 1170);
	    AddVehicleComponent(VehiclulRt, 1080);	AddVehicleComponent(VehiclulRt, 1086); AddVehicleComponent(VehiclulRt, 1087); AddVehicleComponent(VehiclulRt, 1010);	PlayerPlaySound(playerid,1133,0.0,0.0,0.0);	ChangeVehiclePaintjob(VehiclulRt,2);
	   	SetVehicleVirtualWorld(VehiclulRt, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(VehiclulRt, GetPlayerInterior(playerid));
		
		}
	} else SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
	return 1;	}
//------------------------------------------------------------------------------
	if(strcmp(cmdtext, "/ltunedcar4", true)==0 || strcmp(cmdtext, "/ltc4", true)==0)	{
	if(PlayerInfo[playerid][Vip] == 1) {
		if(IsPlayerInAnyVehicle(playerid)) {
		SendClientMessage(playerid,red,"Error: You already have a vehicle");
		} else  {
		
		new Float:X,Float:Y,Float:Z,Float:Angle,carid;	GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle);
        carid = CreateVehicle(559,X,Y,Z,Angle,1,-1,-1);	PutPlayerInVehicle(playerid,carid,0);
    	AddVehicleComponent(carid,1065);    AddVehicleComponent(carid,1067);    AddVehicleComponent(carid,1162); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1073);	ChangeVehiclePaintjob(carid,1);
	   	SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
		}
	} else SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
	return 1;	}
//------------------------------------------------------------------------------
	if(strcmp(cmdtext, "/ltunedcar5", true)==0 || strcmp(cmdtext, "/ltc5", true)==0)	{
	if(PlayerInfo[playerid][Vip] == 1) {
		if(IsPlayerInAnyVehicle(playerid)) {
		SendClientMessage(playerid,red,"Error: You already have a vehicle");
		} else  {
		
		new Float:X,Float:Y,Float:Z,Float:Angle,carid;	GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle);
        carid = CreateVehicle(565,X,Y,Z,Angle,1,-1,-1);	PutPlayerInVehicle(playerid,carid,0);
	    AddVehicleComponent(carid,1046); AddVehicleComponent(carid,1049); AddVehicleComponent(carid,1053); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1073); ChangeVehiclePaintjob(carid,1);
	   	SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
		
		}
	} else SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
	return 1;	}
//------------------------------------------------------------------------------
	if(strcmp(cmdtext, "/ltunedcar6", true)==0 || strcmp(cmdtext, "/ltc6", true)==0)	{
	if(PlayerInfo[playerid][Vip] == 1) {
		if(IsPlayerInAnyVehicle(playerid)) {
		SendClientMessage(playerid,red,"Error: You already have a vehicle");
		} else  {
		
		new Float:X,Float:Y,Float:Z,Float:Angle,carid;	GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle);
        carid = CreateVehicle(558,X,Y,Z,Angle,1,-1,-1);	PutPlayerInVehicle(playerid,carid,0);
    	AddVehicleComponent(carid,1088); AddVehicleComponent(carid,1092); AddVehicleComponent(carid,1139); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1073); ChangeVehiclePaintjob(carid,1);
 	   	SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
		
		}
	} else SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
	return 1;	}
//------------------------------------------------------------------------------
	if(strcmp(cmdtext, "/ltunedcar7", true)==0 || strcmp(cmdtext, "/ltc7", true)==0)	{
	if(PlayerInfo[playerid][Vip] == 1) {
		if(IsPlayerInAnyVehicle(playerid)) {
		SendClientMessage(playerid,red,"Error: You already have a vehicle");
		} else  {
		
		new Float:X,Float:Y,Float:Z,Float:Angle,carid;	GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle);
        carid = CreateVehicle(561,X,Y,Z,Angle,1,-1,-1);	PutPlayerInVehicle(playerid,carid,0);
    	AddVehicleComponent(carid,1055); AddVehicleComponent(carid,1058); AddVehicleComponent(carid,1064); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1073); ChangeVehiclePaintjob(carid,1);
	   	SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
		
		}
	} else SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
	return 1;	}
//------------------------------------------------------------------------------
	if(strcmp(cmdtext, "/ltunedcar8", true)==0 || strcmp(cmdtext, "/ltc8", true)==0)	{
	if(PlayerInfo[playerid][Vip] == 1) {
		if(IsPlayerInAnyVehicle(playerid)) {
		SendClientMessage(playerid,red,"Error: You already have a vehicle");
		} else  {
		
		new Float:X,Float:Y,Float:Z,Float:Angle,carid;	GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle);
        carid = CreateVehicle(562,X,Y,Z,Angle,1,-1,-1);	PutPlayerInVehicle(playerid,carid,0);
	    AddVehicleComponent(carid,1034); AddVehicleComponent(carid,1038); AddVehicleComponent(carid,1147); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1073); ChangeVehiclePaintjob(carid,1);
	   	SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
		
		}
	} else SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
	return 1;	}
//------------------------------------------------------------------------------
	if(strcmp(cmdtext, "/ltunedcar9", true)==0 || strcmp(cmdtext, "/ltc9", true)==0)	{
	if(PlayerInfo[playerid][Vip] == 1) {
		if(IsPlayerInAnyVehicle(playerid)) {
		SendClientMessage(playerid,red,"Error: You already have a vehicle");
		} else  {
		
		new Float:X,Float:Y,Float:Z,Float:Angle,carid;	GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle);
        carid = CreateVehicle(567,X,Y,Z,Angle,1,-1,-1);	PutPlayerInVehicle(playerid,carid,0);
	    AddVehicleComponent(carid,1102); AddVehicleComponent(carid,1129); AddVehicleComponent(carid,1133); AddVehicleComponent(carid,1186); AddVehicleComponent(carid,1188); ChangeVehiclePaintjob(carid,1); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1085); AddVehicleComponent(carid,1087); AddVehicleComponent(carid,1086);
	   	SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
		
		}
	} else SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
	return 1;	}
//------------------------------------------------------------------------------
	if(strcmp(cmdtext, "/ltunedcar10", true)==0 || strcmp(cmdtext, "/ltc10", true)==0)	{
	if(PlayerInfo[playerid][Vip] == 1) {
		if(IsPlayerInAnyVehicle(playerid)) {
		SendClientMessage(playerid,red,"Error: You already have a vehicle");
		} else  {
		
		new Float:X,Float:Y,Float:Z,Float:Angle,carid;	GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle);
        carid = CreateVehicle(558,X,Y,Z,Angle,1,-1,-1);	PutPlayerInVehicle(playerid,carid,0);
   		AddVehicleComponent(carid,1092); AddVehicleComponent(carid,1166); AddVehicleComponent(carid,1165); AddVehicleComponent(carid,1090);
	    AddVehicleComponent(carid,1094); AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1087); AddVehicleComponent(carid,1163);//SPOILER
	    AddVehicleComponent(carid,1091); ChangeVehiclePaintjob(carid,2);
	   	SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
		
		}
	} else SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
	return 1;	}

//------------------------------------------------------------------------------
	if(strcmp(cmdtext, "/ltunedcar11", true)==0 || strcmp(cmdtext, "/ltc11", true)==0)	{
	if(PlayerInfo[playerid][Vip] == 1) {
		if(IsPlayerInAnyVehicle(playerid)) {
		SendClientMessage(playerid,red,"Error: You already have a vehicle");
		} else {
		
		new Float:X,Float:Y,Float:Z,Float:Angle,carid;	GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle);
        carid = CreateVehicle(557,X,Y,Z,Angle,1,1,-1);	PutPlayerInVehicle(playerid,carid,0);
		AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1081);
	   	SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
		
		}
	} else SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
	return 1;	}
//------------------------------------------------------------------------------
	if(strcmp(cmdtext, "/ltunedcar12", true)==0 || strcmp(cmdtext, "/ltc12", true)==0)	{
	if(PlayerInfo[playerid][Vip] == 1) {
		if(IsPlayerInAnyVehicle(playerid)) {
		SendClientMessage(playerid,red,"Error: You already have a vehicle");
		} else  {
		
		new Float:X,Float:Y,Float:Z,Float:Angle,carid;	GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle);
        carid = CreateVehicle(535,X,Y,Z,Angle,1,-1,-1);	PutPlayerInVehicle(playerid,carid,0);
		ChangeVehiclePaintjob(carid,1); AddVehicleComponent(carid,1109); AddVehicleComponent(carid,1115); AddVehicleComponent(carid,1117); AddVehicleComponent(carid,1073); AddVehicleComponent(carid,1010);
	    AddVehicleComponent(carid,1087); AddVehicleComponent(carid,1114); AddVehicleComponent(carid,1081); AddVehicleComponent(carid,1119); AddVehicleComponent(carid,1121);
	   	SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
		
		}
	} else SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
	return 1;	}
//------------------------------------------------------------------------------
	if(strcmp(cmdtext, "/ltunedcar13", true)==0 || strcmp(cmdtext, "/ltc13", true)==0)	{
	if(PlayerInfo[playerid][Vip] == 1) {
		if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid,red,"Error: You already have a vehicle");
		else {
		
		new Float:X,Float:Y,Float:Z,Float:Angle,carid;	GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle);
        carid = CreateVehicle(562,X,Y,Z,Angle,1,-1,-1);	PutPlayerInVehicle(playerid,carid,0);
  		AddVehicleComponent(carid,1034); AddVehicleComponent(carid,1038); AddVehicleComponent(carid,1147);
		AddVehicleComponent(carid,1010); AddVehicleComponent(carid,1073); ChangeVehiclePaintjob(carid,0);
	   	SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
		}
	} else SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
	return 1;	}
	
	if ( strcmp ( cmd , "/acc", true)==0)
    {
    if(PlayerInfo[playerid][Vip] >= 1)
	{
    new acctime;
    if (avcc[playerid]==0)
    {
    avcc[playerid]=1;
    acctime=SetTimerEx("ACC",100,1,"i",playerid);
    SendClientMessage(playerid, COLOR_ULTRARED, "AutoVehicleChangeColor System is actived.For Dezactived type again /acc.");
    }else if (avcc[playerid]==1)
    {
    avcc[playerid]=0;
    KillTimer(acctime);
    SendClientMessage(playerid, COLOR_ULTRARED,"AutoVehicleChangeColor System is Dezactived.For actived type again /acc.");
    }
    }else return SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
    return 1;
    }

    if ( strcmp ( cmd , "/weather", true)==0)
    {
    if(PlayerInfo[playerid][Vip] == 1 ) {
    new tmp2[256], Index; tmp = strtok(cmdtext,Index), tmp2 = strtok(cmdtext,Index);
    if(!strlen(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /weather [weather id]");
	new weather = strval(tmp2);
	format(string, sizeof(string), "You have set you weather to '%d", weather); SendClientMessage(playerid,blue,string);
	SetPlayerWeather(playerid,weather); PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
	PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
    } else return SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
	return 1;
	}
	
    if(strcmp(cmdtext, "/dw", true)==0)
	{
        if(PlayerInfo[playerid][Vip] == 1 )
        {
		FS_GivePlayerWeapon(playerid, 8, 99999);
		FS_GivePlayerWeapon(playerid, 18, 99999);
		FS_GivePlayerWeapon(playerid, 24, 99999);
		FS_GivePlayerWeapon(playerid, 26, 99999);
		FS_GivePlayerWeapon(playerid, 28, 99999);
		FS_GivePlayerWeapon(playerid, 31, 99999);
		FS_GivePlayerWeapon(playerid, 34, 99999);
		FS_GivePlayerWeapon(playerid, 35, 99999);
		FS_GivePlayerWeapon(playerid, 46, 99999);
		FS_SetPlayerHealth(playerid,100);
        SendClientMessage(playerid,COLOR_GREEN, "Did you get a set of special weapons because you are V.I.P !");
        } else return SendClientMessage(playerid,red,"ERROR: You are not donator or V.I.P.");
		return 1;
		}
		
    if(strcmp(cmdtext,"/vcmds",true)==0)
	{
	    SendClientMessage(playerid, 0x33CCFFAA, "|=====================|Vcmds|========================|");
	    SendClientMessage(playerid, 0x33CCFFAA, "|Vip Commands|-> /vipgoto /cmenu /setmytime /spec /name");
	    SendClientMessage(playerid, 0x33CCFFAA, "|Vip Commands|-> /spawnme /vcar /ltc [1-13] /name");
	    SendClientMessage(playerid, 0x33CCFFAA, "|Vip Commands|-> /saveskin /useskin /weather");
        SendClientMessage(playerid, 0x33CCFFAA, "|Vip Commands|-> /carcolor /vcmds /mytime /dw");
	    SendClientMessage(playerid, 0x33CCFFAA, "|Scrieti cu ! pentru VIP Chat! ");
	 	SendClientMessage(playerid, 0x33CCFFAA, "|=====================================================|");
		return 1;
	}

    if ( strcmp ( cmd , "/name", true)==0)
    {
    if(IsPlayerAdmin(playerid)) {
    new tmp2[256], Index; tmp = strtok(cmdtext,Index), tmp2 = strtok(cmdtext,Index);
    if(!strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /name [name]");
	new length = strlen(tmp2);
	if(length < 3 || length > MAX_PLAYER_NAME) return SendClientMessage(playerid,red,"ERROR: Incorrect Name Length");
	format(string, sizeof(string), "You have set \"%s's\" name to \"%s\" ", pName(playerid), tmp2); SendClientMessage(playerid,blue,string);
	SetPlayerName(playerid, tmp2);
	OnPlayerConnect(playerid);
	} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
    return 1;
	}

    if ( strcmp ( cmd , "/mytime", true)==0)
    {
    if(PlayerInfo[playerid][Vip] == 1) {
    new tmp2[256], Index; tmp = strtok(cmdtext,Index), tmp2 = strtok(cmdtext,Index);
    if(!strlen(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /mytime [time]");
	new time = strval(tmp2);
	format(string, sizeof(string), "You have set you time to '%d", time); SendClientMessage(playerid,blue,string);
	SetPlayerTime(playerid,time,0);
	PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
    } else return SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
	return 1;
    }

    if ( strcmp ( cmd , "/vcar", true)==0)
    {
    if(PlayerInfo[playerid][Vip] == 1) {
    if(IsPlayerInAnyVehicle(playerid)) {
		SendClientMessage(playerid,red,"Error: You already have a vehicle");
		} else  {
		
		new Float:X,Float:Y,Float:Z,Float:Angle,VehiclulRt;	GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle);
        VehiclulRt = CreateVehicle(409,X,Y,Z,Angle,0,0,0);
		PutPlayerInVehicle(playerid,VehiclulRt,0);
		PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
		TuneLCar(VehiclulRt);
	   	SetVehicleVirtualWorld(VehiclulRt, GetPlayerVirtualWorld(playerid));
        LinkVehicleToInterior(VehiclulRt, GetPlayerInterior(playerid));
		}
    } else return SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
	return 1;
    }
    if ( strcmp ( cmd , "/mycolor", true)==0)
    {
    if(PlayerInfo[playerid][Vip] >= 1)
	{
	new tmp2[256], Index; tmp = strtok(cmdtext,Index), tmp2 = strtok(cmdtext,Index);
    if(!strlen(tmp2) || !IsNumeric(tmp2)) {
	SendClientMessage(playerid, red, "USAGE: /mycolour [Colour]");
	return SendClientMessage(playerid, red, "Colours: 0=black 1=white 2=red 3=orange 4=yellow 5=green 6=blue 7=purple 8=brown 9=pink");
	}
	new Colour = strval(tmp2), colour[24];
	if(Colour > 9) return SendClientMessage(playerid, red, "Colours: 0=black 1=white 2=red 3=orange 4=yellow 5=green 6=blue 7=purple 8=brown 9=pink");
	switch (Colour)
	{
    case 0: { SetPlayerColor(playerid,black); colour = "Black"; }
    case 1: { SetPlayerColor(playerid,COLOR_WHITE); colour = "White"; }
    case 2: { SetPlayerColor(playerid,red); colour = "Red"; }
    case 3: { SetPlayerColor(playerid,orange); colour = "Orange"; }
	case 4: { SetPlayerColor(playerid,orange); colour = "Yellow"; }
	case 5: { SetPlayerColor(playerid,COLOR_GREEN1); colour = "Green"; }
	case 6: { SetPlayerColor(playerid,COLOR_BLUE); colour = "Blue"; }
	case 7: { SetPlayerColor(playerid,COLOR_PURPLE); colour = "Purple"; }
	case 8: { SetPlayerColor(playerid,COLOR_BROWN); colour = "Brown"; }
	case 9: { SetPlayerColor(playerid,COLOR_PINK); colour = "Pink"; }
    }
    }else return SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator.");
    return 1;
    }
	return 0;
}
dcmd_givevip(playerid,params[]) {
	    	if(IsPlayerAdmin(playerid)) {
		    new tmp[256], tmp2[256], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /givevip [playerid]");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);
            if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			if(PlayerInfo[player1][Vip] == 1) return SendClientMessage(playerid,red,"ERROR: Player is already V.I.P member");
			GetPlayerName(player1, playername, sizeof(playername));	GetPlayerName(playerid, adminname, sizeof(adminname));
    	    new year,month,day;   getdate(year, month, day); new hour,minute,second; gettime(hour,minute,second);
			format(string,sizeof(string),"Administrator %s has set you V.I.P member",adminname);
			SendClientMessage(player1,blue,string);
			GameTextForPlayer(player1,"Promoted", 2000, 3);
			dUserSetINT(PlayerName2(player1)).("Vip",(1));
			PlayerInfo[player1][Vip] = 1;
			return PlayerPlaySound(player1,1057,0.0,0.0,0.0);
			} else return SendClientMessage(playerid, red, "Player is not connected");
		    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
dcmd_scoatevip(playerid,params[]) {
		if(IsPlayerAdmin(playerid)) {
		    new tmp[256], tmp2[256], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /scoatevip [playerid]");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);
			if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
					if(PlayerInfo[player1][Vip] == 0) return SendClientMessage(playerid,red,"ERROR: Player is already simple player");
					GetPlayerName(player1, playername, sizeof(playername));	GetPlayerName(playerid, adminname, sizeof(adminname));
			       	new year,month,day;   getdate(year, month, day); new hour,minute,second; gettime(hour,minute,second);

					format(string,sizeof(string),"Administrator %s has set you to Player Status ",adminname);
					SendClientMessage(player1,blue,string);
                    GameTextForPlayer(player1,"Demoted", 2000, 3);
					dUserSetINT(PlayerName2(player1)).("Vip",(0));
					PlayerInfo[player1][Vip] = 0;
					return PlayerPlaySound(player1,1057,0.0,0.0,0.0);
			} else return SendClientMessage(playerid, red, "Player is not connected");
		} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
dcmd_vipgoto(playerid,params[]) {
    if( PlayerInfo[playerid][Vip] == 1) {
	    if(!strlen(params)) return SendClientMessage(playerid,red,"USAGE: /vipgoto [playerid]");
	    new player1, string[128];
		if(!IsNumeric(params)) player1 = ReturnPlayerID(params);
	   	else player1 = strval(params);
	 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid) {
			new Float:x, Float:y, Float:z;	GetPlayerPos(player1,x,y,z); SetPlayerInterior(playerid,GetPlayerInterior(player1));
			SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(player1));
			if(GetPlayerState(playerid) == 2) {
				SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z);	LinkVehicleToInterior(GetPlayerVehicleID(playerid),GetPlayerInterior(player1));
				SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),GetPlayerVirtualWorld(player1));
			} else SetPlayerPos(playerid,x+2,y,z);
			format(string,sizeof(string),"You have teleported to \"%s\"", pName(player1));
			return SendClientMessage(playerid,blue,string);
		} else return SendClientMessage(playerid, red, "Player is not connected or is yourself");
	} else return SendClientMessage(playerid,red,"ERROR: You are not V.I.P member or Administrator.");
}
//==========================[ Spectate Commands ]===============================
#if defined ENABLE_SPEC
dcmd_spec(playerid,params[]) {
    if(PlayerInfo[playerid][Vip] == 1) {
	    if(!strlen(params) || !IsNumeric(params)) return SendClientMessage(playerid, red, "USAGE: /spec [playerid]");
		new specplayerid = strval(params);
        if(IsPlayerConnected(specplayerid) && specplayerid != INVALID_PLAYER_ID) {
			if(specplayerid == playerid) return SendClientMessage(playerid, red, "ERROR: You cannot spectate yourself");
			if(GetPlayerState(specplayerid) == PLAYER_STATE_SPECTATING && PlayerInfo[specplayerid][SpecID] != INVALID_PLAYER_ID) return SendClientMessage(playerid, red, "Spectate: Player spectating someone else");
			if(GetPlayerState(specplayerid) != 1 && GetPlayerState(specplayerid) != 2 && GetPlayerState(specplayerid) != 3) return SendClientMessage(playerid, red, "Spectate: Player not spawned");
			StartSpectate(playerid, specplayerid);
			GetPlayerPos(playerid,Pos[playerid][0],Pos[playerid][1],Pos[playerid][2]);
			GetPlayerFacingAngle(playerid,Pos[playerid][3]);
			return SendClientMessage(playerid,blue,"Now Spectating");
		} else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} else return SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator");
}
dcmd_specoff(playerid,params[]) {
	#pragma unused params
    if(PlayerInfo[playerid][Vip] == 1) {
        if(PlayerInfo[playerid][SpecType] != ADMIN_SPEC_TYPE_NONE) {
			StopSpectate(playerid);
			SetTimerEx("PosAfterSpec",3000,0,"d",playerid);
			return SendClientMessage(playerid,blue,"No Longer Spectating");
		} else return SendClientMessage(playerid,red,"ERROR: You are not spectating");
	} else return SendClientMessage(playerid,red,"ERROR: You are not V.I.P Member or Administrator");
}
#endif
dcmd_carcolor(playerid,params[]) {
	if(PlayerInfo[playerid][Vip] == 1) {
    new tmp2[256], tmp3[256], Index; tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);
    if(!strlen(tmp2) || !strlen(tmp3) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /carcolour [colour1] [colour2]");
	new colour1, colour2, string[128];
	if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
	if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);
    if(IsPlayerInAnyVehicle(playerid)) {
	format(string, sizeof(string), "You have changed tou colour to color %d,%d'", pName(playerid), colour1, colour2 ); SendClientMessage(playerid,blue,string);
	return ChangeVehicleColor(GetPlayerVehicleID(playerid), colour1, colour2);
	} else return SendClientMessage(playerid,red,"ERROR: You are not in a vehicle");
	} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
dcmd_spawnme(playerid,params[]) {
    #pragma unused params
	if(PlayerInfo[playerid][Vip] == 1) {
		    SendClientMessage(playerid,blue,"You have ReSpawned ");
			SetPlayerPos(playerid, 0.0, 0.0, 0.0);
			return SpawnPlayer(playerid);
	} else return SendClientMessage(playerid,red,"ERROR: You are not V.I.P or Administrator.");
}
stock IsNumeric(string[])
{
	for (new i = 0, j = strlen(string); i < j; i++)
	{
		if (string[i] > '9' || string[i] < '0') return 0;
	}
	return 1;
}
dcmd_saveskin(playerid,params[]) {
    #pragma unused params
 	if(PlayerInfo[playerid][Vip] == 1) {
    new string[128], SkinID;
    SkinID = GetPlayerSkin(playerid);
    dUserSetINT(PlayerName2(playerid)).("Skin",SkinID);
 	format(string, sizeof(string), "You have successfully saved this skin (ID %d)",SkinID);
 	SendClientMessage(playerid,yellow,string);
 	SendClientMessage(playerid,yellow,"Type /outskin for leave the skin.");
	} else return SendClientMessage(playerid,red,"ERROR: You are not V.I.P member or Administrator.");
	return 1;
}

dcmd_outskin(playerid,params[]) {
    #pragma unused params
	if(PlayerInfo[playerid][Vip] == 1) {
	    dUserSetINT(PlayerName2(playerid)).("Skin",-1);
	} else return SendClientMessage(playerid,red,"ERROR: You are not V.I.P member or Administrator.");
	return 1;
}

stock pName(playerid)
{
  GetPlayerName(playerid, name, sizeof(name));
  return name;
}
stock ReturnPlayerID(PlayerName[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if(strfind(pName(i),PlayerName,true)!=-1) return i;
		}
	}
	return INVALID_PLAYER_ID;
}
stock PlayerName2(playerid) {
  GetPlayerName(playerid, name, sizeof(name));
  return name;
}
forward TuneLCar(VehicleID);
public TuneLCar(VehicleID)
{
	ChangeVehicleColor(VehicleID,0,0);
	AddVehicleComponent(VehicleID, 1010);  AddVehicleComponent(VehicleID, 1087);
}
#if defined ENABLE_SPEC

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	new x = 0;
	while(x!=MAX_PLAYERS) {
	    if( IsPlayerConnected(x) &&	GetPlayerState(x) == PLAYER_STATE_SPECTATING &&
			PlayerInfo[x][SpecID] == playerid && PlayerInfo[x][SpecType] == ADMIN_SPEC_TYPE_PLAYER )
   		{
   		    SetPlayerInterior(x,newinteriorid);
		}
		x++;
	}
}

//==============================================================================
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && PlayerInfo[playerid][SpecID] != INVALID_PLAYER_ID)
	{
		if(newkeys == KEY_JUMP) AdvanceSpectate(playerid);
		else if(newkeys == KEY_SPRINT) ReverseSpectate(playerid);
	}
	return 1;
}

//==============================================================================
public OnPlayerEnterVehicle(playerid, vehicleid) {
	for(new x=0; x<MAX_PLAYERS; x++) {
	    if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid) {
	        TogglePlayerSpectating(x, 1);
	        PlayerSpectateVehicle(x, vehicleid);
	        PlayerInfo[x][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
		}
	}
	return 1;
}

//==============================================================================
public OnPlayerStateChange(playerid, newstate, oldstate) {
	switch(newstate) {
		case PLAYER_STATE_ONFOOT: {
			switch(oldstate) {
				case PLAYER_STATE_DRIVER: OnPlayerExitVehicle(playerid,255);
				case PLAYER_STATE_PASSENGER: OnPlayerExitVehicle(playerid,255);
			}
		}
	}
	return 1;
}

#endif
#if defined ENABLE_SPEC

stock StartSpectate(playerid, specplayerid)
{
	for(new x=0; x<MAX_PLAYERS; x++) {
	    if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid) {
	       AdvanceSpectate(x);
		}
	}
	SetPlayerInterior(playerid,GetPlayerInterior(specplayerid));
	TogglePlayerSpectating(playerid, 1);

	if(IsPlayerInAnyVehicle(specplayerid)) {
		PlayerSpectateVehicle(playerid, GetPlayerVehicleID(specplayerid));
		PlayerInfo[playerid][SpecID] = specplayerid;
		PlayerInfo[playerid][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
	}
	else {
		PlayerSpectatePlayer(playerid, specplayerid);
		PlayerInfo[playerid][SpecID] = specplayerid;
		PlayerInfo[playerid][SpecType] = ADMIN_SPEC_TYPE_PLAYER;
	}
	new string[100], Float:hp, Float:ar;
	GetPlayerName(specplayerid,string,sizeof(string));
	GetPlayerHealth(specplayerid, hp);	GetPlayerArmour(specplayerid, ar);
	format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~w~%s - id:%d~n~< sprint - jump >~n~hp:%0.1f ar:%0.1f $%d", string,specplayerid,hp,ar,GetPlayerMoney(specplayerid) );
	GameTextForPlayer(playerid,string,25000,3);
	return 1;
}

stock StopSpectate(playerid)
{
	TogglePlayerSpectating(playerid, 0);
	PlayerInfo[playerid][SpecID] = INVALID_PLAYER_ID;
	PlayerInfo[playerid][SpecType] = ADMIN_SPEC_TYPE_NONE;
	GameTextForPlayer(playerid,"~n~~n~~n~~w~Spectate mode ended",1000,3);
	return 1;
}

stock AdvanceSpectate(playerid)
{
    if(ConnectedPlayers() == 2) { StopSpectate(playerid); return 1; }
	{
	if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && PlayerInfo[playerid][SpecID] != INVALID_PLAYER_ID)
	    for(new x=PlayerInfo[playerid][SpecID]+1; x<=MAX_PLAYERS; x++)
		{
	    	if(x == MAX_PLAYERS) x = 0;
	        if(IsPlayerConnected(x) && x != playerid)
			{
				if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(x) != 1 && GetPlayerState(x) != 2 && GetPlayerState(x) != 3))
				{
					continue;
				}
				else
				{
					StartSpectate(playerid, x);
					break;
				}
			}
		}
	}
	return 1;
}
stock ReverseSpectate(playerid)
{
    if(ConnectedPlayers() == 2) { StopSpectate(playerid); return 1; }
	if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && PlayerInfo[playerid][SpecID] != INVALID_PLAYER_ID)
	{
	    for(new x=PlayerInfo[playerid][SpecID]-1; x>=0; x--)
		{
	    	if(x == 0) x = MAX_PLAYERS;
	        if(IsPlayerConnected(x) && x != playerid)
			{
				if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(x) != 1 && GetPlayerState(x) != 2 && GetPlayerState(x) != 3))
				{
					continue;
				}
				else
				{
					StartSpectate(playerid, x);
					break;
				}
			}
		}
	}
	return 1;
}

//-------------------------------------------
forward PosAfterSpec(playerid);
public PosAfterSpec(playerid)
{
	SetPlayerPos(playerid,Pos[playerid][0],Pos[playerid][1],Pos[playerid][2]);
	SetPlayerFacingAngle(playerid,Pos[playerid][3]);
}
#endif
//==============================================================================
public OnPlayerExitVehicle(playerid, vehicleid)
{
	#if defined ENABLE_SPEC
	for(new x=0; x<MAX_PLAYERS; x++) {
    	if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid && PlayerInfo[x][SpecType] == ADMIN_SPEC_TYPE_VEHICLE) {
        	TogglePlayerSpectating(x, 1);
	        PlayerSpectatePlayer(x, playerid);
    	    PlayerInfo[x][SpecType] = ADMIN_SPEC_TYPE_PLAYER;
		}
	}
	#endif

	return 1;
}
forward ConnectedPlayers();
public ConnectedPlayers()
{
	new Connected;
	for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) Connected++;
	return Connected;
}
dcmd_vips(playerid, params[])
{
	#pragma unused params
	new string[128];
	if(IsPlayerConnected(playerid))
	{
		for (new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if(PlayerInfo[i][Vip] >= 1)
				{
					format(string, sizeof(string),"Vips : %s(%d)", PlayerName2(i), i);
					SendClientMessage(playerid, green, string);

                    //ShowPlayerDialog(playerid, ADMIN_LIST, DIALOG_STYLE_LIST,"Online Admins: (command unstable)", string, "Send PM", "Close");
    			}
			}
		}
	}
	return 1;
}
public OnPlayerText(playerid, text[])
{
	if(text[0] == '!' && PlayerInfo[playerid][Vip] == 1) {
	    new string[128]; GetPlayerName(playerid,string,sizeof(string));
		format(string,sizeof(string),"Vip Chat: %s: %s",string,text[1]); MessageToVip(green,string);
	    return 0;
	}
	return 1;
}
forward MessageToVip(color,const string[]);
public MessageToVip(color,const string[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) == 1) if (PlayerInfo[i][Vip] == 1) SendClientMessage(i, color, string);
	}
	return 1;
}
Pls help me ....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)