Not Receiving Weapons On Spawn
#1

what is wrong,please help me to fix the bug i am not receiving weapons on spawn
Код:
   ResetPlayerWeapons(playerid);
		GivePlayerWeapon(playerid, gClass[pClass[playerid]][classWeapon1][0], gClass[pClass[playerid]][classWeapon1][1] * ((pStats[playerid][userPremium]) ? (3) : (1)));
		GivePlayerWeapon(playerid, gClass[pClass[playerid]][classWeapon2][0], gClass[pClass[playerid]][classWeapon2][1] * ((pStats[playerid][userPremium]) ? (3) : (1)));
		GivePlayerWeapon(playerid, gClass[pClass[playerid]][classWeapon3][0], gClass[pClass[playerid]][classWeapon3][1] * ((pStats[playerid][userPremium]) ? (3) : (1)));
		GivePlayerWeapon(playerid, gClass[pClass[playerid]][classWeapon4][0], gClass[pClass[playerid]][classWeapon4][1] * ((pStats[playerid][userPremium]) ? (3) : (1)));
		GivePlayerWeapon(playerid, gClass[pClass[playerid]][classWeapon5][0], gClass[pClass[playerid]][classWeapon5][1] * ((pStats[playerid][userPremium]) ? (3) : (1)));

		buf[0] = EOS;
		strcat(buf, "Class Weapons: ");
		new weapon_name[35];
	 	strcat(buf, SAMP_BLUE);
		GetWeaponName(gClass[pClass[playerid]][classWeapon1][0], weapon_name, sizeof(weapon_name));
	 	strcat(buf, weapon_name);
	 	strcat(buf, ""WHITE", ");

	 	strcat(buf, SAMP_BLUE);
		GetWeaponName(gClass[pClass[playerid]][classWeapon2][0], weapon_name, sizeof(weapon_name));
	 	strcat(buf, weapon_name);
	 	strcat(buf, ""WHITE", ");

	 	strcat(buf, SAMP_BLUE);
		GetWeaponName(gClass[pClass[playerid]][classWeapon3][0], weapon_name, sizeof(weapon_name));
	 	strcat(buf, weapon_name);
	 	strcat(buf, ""WHITE", ");

	 	strcat(buf, SAMP_BLUE);
		GetWeaponName(gClass[pClass[playerid]][classWeapon4][0], weapon_name, sizeof(weapon_name));
	 	strcat(buf, weapon_name);
	 	strcat(buf, ""WHITE", ");

	 	strcat(buf, SAMP_BLUE);
		GetWeaponName(gClass[pClass[playerid]][classWeapon5][0], weapon_name, sizeof(weapon_name));
	 	strcat(buf, weapon_name);
		strcat(buf, ""WHITE".");
		SendClientMessage(playerid, COLOR_WHITE, buf);
Full Spawn Code
Код:
public OnPlayerSpawn(playerid)
{
	SetPlayerTime(playerid, gServerTime, 0);
	SetPlayerWeather(playerid, gServerWeather);

	if (pSync[playerid])
	{
		pSync[playerid] = false;
	    return 1;
	}

	pPremiumSupply[playerid] = false;

	pTrapped[playerid] = false;
	KillTimer(pTrappedTimer[playerid]);
	if (IsValidDynamicObject(pTrappedObject[playerid]))
	{
		DestroyDynamicObject(pTrappedObject[playerid]);
	}

	for (new i, j = sizeof(menuInventoryModels); i < j; i++)
	{
	    pInventory[playerid][i] = 0;
	}

	if (IsValidDynamicObject(pNetTrapObject[playerid][0]))
	{
		DestroyDynamicObject(pNetTrapObject[playerid][0]);
		DestroyDynamicArea(pNetTrapArea[playerid][0]);
		DestroyDynamic3DTextLabel(pNetTrapLabel[playerid][0]);
		KillTimer(pNetTrapTimer[playerid][0]);
	}
	if (IsValidDynamicObject(pNetTrapObject[playerid][1]))
	{
		DestroyDynamicObject(pNetTrapObject[playerid][1]);
		DestroyDynamicArea(pNetTrapArea[playerid][1]);
		DestroyDynamic3DTextLabel(pNetTrapLabel[playerid][1]);
		KillTimer(pNetTrapTimer[playerid][1]);
	}

	if (IsValidDynamicObject(pDynamiteObject[playerid][0]))
	{
		DestroyDynamicObject(pDynamiteObject[playerid][0]);
		DestroyDynamic3DTextLabel(pDynamiteLabel[playerid][0]);
	}
	if (IsValidDynamicObject(pDynamiteObject[playerid][1]))
	{
		DestroyDynamicObject(pDynamiteObject[playerid][1]);
		DestroyDynamic3DTextLabel(pDynamiteLabel[playerid][1]);
	}
	if (IsValidDynamicObject(pDynamiteObject[playerid][2]))
	{
		DestroyDynamicObject(pDynamiteObject[playerid][2]);
		DestroyDynamic3DTextLabel(pDynamiteLabel[playerid][2]);
	}

	if (IsValidDynamicObject(pLandmineObject[playerid][0]))
	{
		DestroyDynamicObject(pLandmineObject[playerid][0]);
		DestroyDynamicArea(pLandmineAreaid[playerid][0]);
		DestroyDynamic3DTextLabel(pLandmineLabel[playerid][0]);
	}
	if (IsValidDynamicObject(pLandmineObject[playerid][1]))
	{
		DestroyDynamicObject(pLandmineObject[playerid][1]);
		DestroyDynamicArea(pLandmineAreaid[playerid][1]);
		DestroyDynamic3DTextLabel(pLandmineLabel[playerid][1]);
	}
	if (IsValidDynamicObject(pLandmineObject[playerid][2]))
	{
		DestroyDynamicObject(pLandmineObject[playerid][2]);
		DestroyDynamicArea(pLandmineAreaid[playerid][2]);
		DestroyDynamic3DTextLabel(pLandmineLabel[playerid][2]);
	}

	if (IsValidDynamicObject(pMusicBoxObject[playerid]))
	{
	    DestroyDynamicObject(pMusicBoxObject[playerid]);
	    foreach (new i : Player)
	    {
	        if (IsPlayerInDynamicArea(i, pMusicBoxAreaid[playerid]))
	        {
	            StopAudioStreamForPlayer(i);
	        }
	    }
	    DestroyDynamicArea(pMusicBoxAreaid[playerid]);
	    DestroyDynamic3DTextLabel(pMusicBoxLabel[playerid]);
	}

	if (pSpikeTimer[playerid][0])
	{
		SpikeStrip_Delete(pSpikeObject[playerid][0]);
		KillTimer(pSpikeTimer[playerid][0]);
        pSpikeTimer[playerid][0] = 0;
		DestroyDynamic3DTextLabel(pSpikeLabel[playerid][0]);
	}
	if (pSpikeTimer[playerid][1])
	{
		SpikeStrip_Delete(pSpikeObject[playerid][1]);
		KillTimer(pSpikeTimer[playerid][1]);
        pSpikeTimer[playerid][1] = 0;
		DestroyDynamic3DTextLabel(pSpikeLabel[playerid][1]);
	}
	if (pSpikeTimer[playerid][2])
	{
		SpikeStrip_Delete(pSpikeObject[playerid][2]);
		KillTimer(pSpikeTimer[playerid][2]);
        pSpikeTimer[playerid][2] = 0;
		DestroyDynamic3DTextLabel(pSpikeLabel[playerid][2]);
	}

    pAirstrike[playerid][asLastStrike] = 0;
    pCarepack[playerid][cpLastDrop] = 0;

    pAirstrike[playerid][asCalled] = false;
    pCarepack[playerid][cpCalled] = false;

    if (pDuel[playerid][duelActive])
	{
	    GivePlayerMoney(pDuel[playerid][duelPlayer], pDuel[playerid][duelBet]);

	    new weapon[35];
	    GetWeaponName(pDuel[playerid][duelWeapon], weapon, sizeof(weapon));
	    new string[144];
	    format(string, sizeof(string), "DUEL: %s(%i) have won the duel against opponent %s(%i) [weapon: %s, bet: $%i].", ReturnPlayerName(pDuel[playerid][duelPlayer]), pDuel[playerid][duelPlayer], ReturnPlayerName(playerid), playerid, weapon, pDuel[playerid][duelBet]);
	    SendClientMessageToAll(COLOR_YELLOW, string);
	    format(string, sizeof(string), "You won the duel against your opponent %s(%i) [weapon: %s, bet: $%i].", ReturnPlayerName(playerid), playerid, weapon, pDuel[playerid][duelBet]);
	    SendClientMessage(pDuel[playerid][duelPlayer], COLOR_GREEN, string);
	    format(string, sizeof(string), "You lost the duel against your opponent %s(%i) [weapon: %s, bet: $%i].", ReturnPlayerName(pDuel[playerid][duelPlayer]), pDuel[playerid][duelPlayer], weapon, pDuel[playerid][duelBet]);
	    SendClientMessage(playerid, COLOR_TOMATO, string);

		NotifyPlayer(playerid, "You ~r~LOST ~w~~h~the duel!", 3000);
		NotifyPlayer(pDuel[playerid][duelPlayer], "You ~g~WON ~w~~h~the duel!", 3000);

		pDuel[pDuel[playerid][duelPlayer]][duelActive] = false;
	 	pDuel[pDuel[playerid][duelPlayer]][duelPlayer] = INVALID_PLAYER_ID;
		pDuel[pDuel[playerid][duelPlayer]][duelWeapon] = 0;
		pDuel[pDuel[playerid][duelPlayer]][duelBet] = 0;

		SpawnPlayer(pDuel[playerid][duelPlayer]);
	}
	pDuel[playerid][duelActive] = false;
 	pDuel[playerid][duelPlayer] = INVALID_PLAYER_ID;
	pDuel[playerid][duelWeapon] = 0;
	pDuel[playerid][duelBet] = 0;

	TogglePlayerControllable(playerid, false);

    pKiller[playerid][0] = INVALID_PLAYER_ID;
    pKiller[playerid][1] = 0;

    pHasHelmet[playerid] = false;
    pHasMask[playerid] = false;

    pLastDamageTime[playerid] = 0;

    for (new i; i < 13; i++)
    {
    	pWeaponsSpree[playerid][i] = 0;
	}

	new count[MAX_TEAMS];
	foreach (new i : Player)
	{
	    if (0 <= GetPlayerTeam(i) < MAX_TEAMS)
	    {
	        count[GetPlayerTeam(i)]++;
	    }
	}

	new buf[450];

	format(buf, sizeof(buf), "%s~n~~y~~h~~h~Players: %i", gTeam[0][teamName], count[0]);
	TextDrawSetString(txtTeam[3], buf);
	format(buf, sizeof(buf), "%s~n~~y~~h~~h~Players: %i", gTeam[1][teamName], count[1]);
	TextDrawSetString(txtTeam[6], buf);
	format(buf, sizeof(buf), "%s~n~~y~~h~~h~Players: %i", gTeam[2][teamName], count[2]);
	TextDrawSetString(txtTeam[9], buf);
	format(buf, sizeof(buf), "%s~n~~y~~h~~h~Players: %i", gTeam[3][teamName], count[3]);
	TextDrawSetString(txtTeam[12], buf);
	format(buf, sizeof(buf), "%s~n~~y~~h~~h~Players: %i", gTeam[4][teamName], count[4]);
	TextDrawSetString(txtTeam[15], buf);
	format(buf, sizeof(buf), "%s~n~~y~~h~~h~Players: %i", gTeam[5][teamName], count[5]);
	TextDrawSetString(txtTeam[18], buf);
	format(buf, sizeof(buf), "%s~n~~y~~h~~h~Players: %i", gTeam[6][teamName], count[6]);
	TextDrawSetString(txtTeam[21], buf);

	if (! pLogged[playerid])
	{
		SetPlayerCameraPos(playerid, 158.8506, 2263.6631, 129.6489);
		SetPlayerCameraLookAt(playerid, 159.1849, 2264.6108, 129.3190);

		for (new i, j = sizeof(txtBase); i < j; i++)
		{
		    TextDrawShowForPlayer(playerid, txtBase[i]);
		}
		for (new i, j = sizeof(txtConnect); i < j; i++)
		{
		    TextDrawShowForPlayer(playerid, txtConnect[i]);
		}
		for (new i, j = sizeof(txtTeam); i < j; i++)
		{
		    TextDrawHideForPlayer(playerid, txtTeam[i]);
		}
		for (new i, j = sizeof(txtClass); i < j; i++)
		{
		    TextDrawHideForPlayer(playerid, txtClass[i]);
		}

		new SQLRow:rowid = yoursql_get_row(SQL:0, "users", "name = %s", ReturnPlayerName(playerid));
		if (rowid == SQL_INVALID_ROW)
		{
		    for (new i; i < 50; i++)
		    {
		        SendClientMessage(playerid, COLOR_WHITE, " ");
		    }
		    SendClientMessage(playerid, COLOR_GREEN, "Welcome to World War IV, SAMP gaming community.");
		    SendClientMessage(playerid, COLOR_GREEN, "This a little formality that every new user should complete, please register and continue to play and have fun!");
		    SendClientMessage(playerid, COLOR_GREEN, "After registeration, you will get $50000 and 15 score as a regiseration achievement.");

		    new info[450];
			strcat(info, ""WHITE"Welcome "RED"");
			strcat(info, ReturnPlayerName(playerid));
			strcat(info, " "WHITE", you are new to the server!\n\n");
			strcat(info, "Before registering, please read the main rules:\n");
			strcat(info, ""RED"1. "WHITE"No cheats/hacks/invalid ways of playing.\n");
			strcat(info, ""RED"2. "WHITE"No insulting in main chat, respect all.\n");
			strcat(info, ""RED"3. "WHITE"Read all the rules in /rules.\n\n");
			strcat(info, "Now please insert a password and register this account!");

		    ShowPlayerDialog(playerid, DIALOG_ID_REGISTER, DIALOG_STYLE_PASSWORD, "Account registration", info, "Register", "Quit");
		}
		else
		{
		    for (new i; i < 50; i++)
		    {
		        SendClientMessage(playerid, COLOR_WHITE, " ");
		    }
		    SendClientMessage(playerid, COLOR_GREEN, "Welcome back to World War IV, SAMP gaming community.");

		    new ip[18];
			yoursql_get_field(SQL:0, "users/ip", rowid, ip);
	  		if (yoursql_get_field_int(SQL:0, "users/auto_login", rowid) && ! strcmp(ip, ReturnPlayerIp(playerid)))
	  		{
			  	SendClientMessage(playerid, COLOR_GREEN, "Login session has automatically completed, thanks for joining us back!");
				SendClientMessage(playerid, COLOR_GREEN, "If you want to change your account settings, type /settings.");

				ResetPlayerMoney(playerid);
				GivePlayerMoney(playerid, yoursql_get_field_int(SQL:0, "users/money", rowid));
				SetPlayerScore(playerid, yoursql_get_field_int(SQL:0, "users/score", rowid));

				pRank[playerid] = GetPlayerRank(playerid);

				pLogged[playerid] = true;
				SpawnPlayer(playerid);
			}
			else
			{
			    for (new i; i < 50; i++)
			    {
			        SendClientMessage(playerid, COLOR_WHITE, " ");
			    }
		    	SendClientMessage(playerid, COLOR_GREEN, "Welcome back to World War IV, SAMP gaming community.");
				SendClientMessage(playerid, COLOR_GREEN, "You are already registered here, complete the login session and enjoy your stay!");

			    new info[450];
				strcat(info, ""WHITE"Welcome back "RED"");
				strcat(info, ReturnPlayerName(playerid));
				strcat(info, " "WHITE", you are already registerd!\n\n");
				strcat(info, "If you any problem logging in this account, you can do the following:\n");
				strcat(info, ""RED"1. "WHITE"Press 'PROBLEM' and enter the email registered with this account.\n");
				strcat(info, ""RED"2. "WHITE"Press 'PROBLEM' and click 'QUIT' there if this is not your account.\n\n");
				strcat(info, "Else, please insert your password and login this account!");

			    ShowPlayerDialog(playerid, DIALOG_ID_LOGIN, DIALOG_STYLE_PASSWORD, "Account login required", info, "Login", "Problem?");
			}
		}

		return 1;
	}
	else if (pInClass[playerid])
	{
		for (new i, j = sizeof(txtBase); i < j; i++)
		{
		    TextDrawShowForPlayer(playerid, txtBase[i]);
		}
		for (new i, j = sizeof(txtConnect); i < j; i++)
		{
		    TextDrawHideForPlayer(playerid, txtConnect[i]);
		}
		for (new i, j = sizeof(txtTeam); i < j; i++)
		{
		    TextDrawShowForPlayer(playerid, txtTeam[i]);
		}
		for (new i, j = sizeof(txtClass); i < j; i++)
		{
		    TextDrawShowForPlayer(playerid, txtClass[i]);
		}
		TextDrawHideForPlayer(playerid, txtNotify);

		PlayerTextDrawHide(playerid, ptxtStats[playerid]);

		TextDrawColor(txtClass[1], -1768515946);
		TextDrawColor(txtClass[4], -1768515946);
	 	TextDrawColor(txtClass[7], -1768515946);
		TextDrawColor(txtClass[10], -1768515946);
	   	TextDrawColor(txtClass[13], -1768515946);
		TextDrawColor(txtClass[16], -1768515946);

	    TextDrawShowForPlayer(playerid, txtClass[1]);
	    TextDrawShowForPlayer(playerid, txtClass[4]);
	    TextDrawShowForPlayer(playerid, txtClass[7]);
	    TextDrawShowForPlayer(playerid, txtClass[10]);
	    TextDrawShowForPlayer(playerid, txtClass[13]);
	    TextDrawShowForPlayer(playerid, txtClass[16]);

		SelectPlayerTeam(playerid, pTeam[playerid]);
		SetPlayerSkin(playerid, gTeam[pTeam[playerid]][teamSkin]);
		SetPlayerColor(playerid, gTeam[pTeam[playerid]][teamColor]);

    	SetPlayerCameraPos(playerid, gTeam[pTeam[playerid]][teamCam][0], gTeam[pTeam[playerid]][teamCam][1], gTeam[pTeam[playerid]][teamCam][2]);
        SetPlayerCameraLookAt(playerid, gTeam[pTeam[playerid]][teamCam2][0], gTeam[pTeam[playerid]][teamCam2][1], gTeam[pTeam[playerid]][teamCam2][2], CAMERA_MOVE);
		SetPlayerPos(playerid, gTeam[pTeam[playerid]][teamCam3][0], gTeam[pTeam[playerid]][teamCam3][1], gTeam[pTeam[playerid]][teamCam3][2]);
		SetPlayerFacingAngle(playerid, gTeam[pTeam[playerid]][teamCam3][3]);

		PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0);

		SelectPlayerTeam(playerid, pTeam[playerid]);
		SelectTextDraw(playerid, 0xFF0000FF);

		return 1;
	}

	TogglePlayerControllable(playerid, true);

	for (new i, j = sizeof(txtBase); i < j; i++)
	{
	    TextDrawHideForPlayer(playerid, txtBase[i]);
	}
	for (new i, j = sizeof(txtConnect); i < j; i++)
	{
	    TextDrawHideForPlayer(playerid, txtConnect[i]);
	}
	for (new i, j = sizeof(txtTeam); i < j; i++)
	{
	    TextDrawHideForPlayer(playerid, txtTeam[i]);
	}
	for (new i, j = sizeof(txtClass); i < j; i++)
	{
	    TextDrawHideForPlayer(playerid, txtClass[i]);
	}

	TextDrawShowForPlayer(playerid, txtNotify);

	PlayerTextDrawShow(playerid, ptxtStats[playerid]);

    if (pStats[playerid][userJailTime] > 0)
    {
		SetPlayerHealth(playerid, FLOAT_INFINITY);
		SetPlayerArmour(playerid, 0.0);
		SetPlayerInterior(playerid, 3);
		SetPlayerPos(playerid, 197.6661, 173.8179, 1003.0234);
		SetCameraBehindPlayer(playerid);

		format(buf, sizeof(buf), "You are still in jail for %i seconds.", pStats[playerid][userJailTime]);
	    SendClientMessage(playerid, COLOR_DODGER_BLUE, buf);
		return 1;
	}

	if (pStats[playerid][userOnDuty])
    {
        SendClientMessage(playerid, COLOR_WHITE, " ");
        SendClientMessage(playerid, COLOR_GREEN, "- You have spawned -");

        new i = random(sizeof(gAdminSpawn));
	    SetPlayerPos(playerid, gAdminSpawn[i][0], gAdminSpawn[i][1], gAdminSpawn[i][2]);
	    SetPlayerFacingAngle(playerid, gAdminSpawn[i][3]);

	    SetPlayerSkin(playerid, 217);
	    SetPlayerColor(playerid, COLOR_HOT_PINK);
	    SetPlayerTeam(playerid, 100);
	    ResetPlayerWeapons(playerid);
	    GivePlayerWeapon(playerid, 38, 999999);
	    if (! pStats[playerid][userGod])
	    {
	        pStats[playerid][userGod] = true;
	    }
	    if (! pStats[playerid][userGodCar])
	    {
    		pStats[playerid][userGodCar] = true;
    	}
	    SetPlayerHealth(playerid, FLOAT_INFINITY);
	    SetVehicleHealth(GetPlayerVehicleID(playerid), FLOAT_INFINITY);

	    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
        SendClientMessage(playerid, COLOR_WHITE, "You are currently "GREEN"ON Admin Duty"WHITE". To switch it off, type /offduty.");
        SendClientMessage(playerid, COLOR_WHITE, "For commands list for your respective level, type /acmds.");
        SendClientMessage(playerid, COLOR_WHITE, "Weapon recieved: Minigun (/aweaps for more weapons range)");

        SendClientMessage(playerid, COLOR_WHITE, " ");
	}
	else
	{
		SetPlayerInterior(playerid, 0);
		SetPlayerVirtualWorld(playerid, 0);

		SetPlayerSkin(playerid, gTeam[pTeam[playerid]][teamSkin]);
		SetPlayerColor(playerid, gTeam[pTeam[playerid]][teamColor]);
		SetPlayerTeam(playerid, pTeam[playerid]);

        SendClientMessage(playerid, COLOR_WHITE, " ");
        SendClientMessage(playerid, COLOR_GREEN, "- You have spawned -");

		format(buf, sizeof(buf), "You have spawned as {%06x}%s's %s %s"WHITE".", gTeam[pTeam[playerid]][teamColor] >>> 8, gTeam[pTeam[playerid]][teamName], gRank[pRank[playerid]][rankName], gClass[pClass[playerid]][className]);
		SendClientMessage(playerid, COLOR_WHITE, buf);

		switch (pClass[playerid])
		{
		    case 0:
		    {
	    		pActionTime[playerid] = 0;
		    }
		    case 1:
		    {
	    		pActionTime[playerid] = 0;
		    }
		    case 2:
		    {
		        SetPlayerColor(playerid, SET_ALPHA(gTeam[pTeam[playerid]][teamColor], 0));
		    }
		    case 3:
		    {
	    		pActionTime[playerid] = 0;
	    		if (IsValidVehicle(pBuildMode[playerid]))
	    		{
	    		    DestroyVehicle(pBuildMode[playerid]);
	    		}
	    		pBuildMode[playerid] = 0;
			}
		    case 4:
		    {
			}
		    case 5:
		    {
				pDisguizeKits[playerid] = 3;
			}
		}

	    ResetPlayerWeapons(playerid);
		GivePlayerWeapon(playerid, gClass[pClass[playerid]][classWeapon1][0], gClass[pClass[playerid]][classWeapon1][1] * ((pStats[playerid][userPremium]) ? (3) : (1)));
		GivePlayerWeapon(playerid, gClass[pClass[playerid]][classWeapon2][0], gClass[pClass[playerid]][classWeapon2][1] * ((pStats[playerid][userPremium]) ? (3) : (1)));
		GivePlayerWeapon(playerid, gClass[pClass[playerid]][classWeapon3][0], gClass[pClass[playerid]][classWeapon3][1] * ((pStats[playerid][userPremium]) ? (3) : (1)));
		GivePlayerWeapon(playerid, gClass[pClass[playerid]][classWeapon4][0], gClass[pClass[playerid]][classWeapon4][1] * ((pStats[playerid][userPremium]) ? (3) : (1)));
		GivePlayerWeapon(playerid, gClass[pClass[playerid]][classWeapon5][0], gClass[pClass[playerid]][classWeapon5][1] * ((pStats[playerid][userPremium]) ? (3) : (1)));

		buf[0] = EOS;
		strcat(buf, "Class Weapons: ");
		new weapon_name[35];
	 	strcat(buf, SAMP_BLUE);
		GetWeaponName(gClass[pClass[playerid]][classWeapon1][0], weapon_name, sizeof(weapon_name));
	 	strcat(buf, weapon_name);
	 	strcat(buf, ""WHITE", ");

	 	strcat(buf, SAMP_BLUE);
		GetWeaponName(gClass[pClass[playerid]][classWeapon2][0], weapon_name, sizeof(weapon_name));
	 	strcat(buf, weapon_name);
	 	strcat(buf, ""WHITE", ");

	 	strcat(buf, SAMP_BLUE);
		GetWeaponName(gClass[pClass[playerid]][classWeapon3][0], weapon_name, sizeof(weapon_name));
	 	strcat(buf, weapon_name);
	 	strcat(buf, ""WHITE", ");

	 	strcat(buf, SAMP_BLUE);
		GetWeaponName(gClass[pClass[playerid]][classWeapon4][0], weapon_name, sizeof(weapon_name));
	 	strcat(buf, weapon_name);
	 	strcat(buf, ""WHITE", ");

	 	strcat(buf, SAMP_BLUE);
		GetWeaponName(gClass[pClass[playerid]][classWeapon5][0], weapon_name, sizeof(weapon_name));
	 	strcat(buf, weapon_name);
		strcat(buf, ""WHITE".");
		SendClientMessage(playerid, COLOR_WHITE, buf);

		if (pStats[playerid][userPremium])
		{
		    SendClientMessage(playerid, COLOR_CYAN, "[VIP] Premium ammunation, 3x ammo for every weapon!");
		}

		new SQLRow:rowid = yoursql_get_row(SQL:0, "users", "name = %s", ReturnPlayerName(playerid));
		new weapon[5];
		weapon[0] = yoursql_get_field_int(SQL:0, "users/weapon1", rowid);
		weapon[1] = yoursql_get_field_int(SQL:0, "users/weapon2", rowid);
		weapon[2] = yoursql_get_field_int(SQL:0, "users/weapon3", rowid);

		for (new i; i < 3; i++)
		{
		    switch (weapon[i])
		    {
		        case 1..15:
		        {
		            GivePlayerWeapon(playerid, weapon[i], 1);
		        }
		        case 16..18, 39:
		        {
		            GivePlayerWeapon(playerid, weapon[i], 2);
		        }
		        case 22..24:
		        {
		            GivePlayerWeapon(playerid, weapon[i], 200);
		        }
		        case 25, 26, 27:
		        {
		            GivePlayerWeapon(playerid, weapon[i], 100);
		        }
		        case 28, 29, 32:
		        {
		            GivePlayerWeapon(playerid, weapon[i], 250);
		        }
		        case 30, 31:
		        {
		            GivePlayerWeapon(playerid, weapon[i], 300);
		        }
		        case 33, 34:
		        {
		            GivePlayerWeapon(playerid, weapon[i], 150);
		        }
		        case 35, 36:
		        {
		            GivePlayerWeapon(playerid, weapon[i], 2);
		        }
		        case 37:
		        {
		            GivePlayerWeapon(playerid, weapon[i], 500);
		        }
		        case 38:
		        {
		            GivePlayerWeapon(playerid, weapon[i], 100);
		        }
		    }
		}
		SendClientMessage(playerid, COLOR_GREY, "You can change your spawn by /ss, class by /sc and team by /st.");

		buf[0] = EOS;
		strcat(buf, "Personal weapons: ");
		if (weapon[0])
		{
			strcat(buf, SAMP_BLUE);
		    GetWeaponName(weapon[0], weapon_name, sizeof(weapon_name));
			strcat(buf, weapon_name);
			strcat(buf, ""WHITE", ");
		}
		else
		{
			strcat(buf, TOMATO);
			strcat(buf, "No Weapon");
			strcat(buf, ""WHITE", ");
		}

		if (weapon[1])
		{
			strcat(buf, SAMP_BLUE);
		    GetWeaponName(weapon[1], weapon_name, sizeof(weapon_name));
			strcat(buf, weapon_name);
			strcat(buf, ""WHITE", ");
		}
		else
		{
			strcat(buf, TOMATO);
			strcat(buf, "No Weapon");
			strcat(buf, ""WHITE", ");
		}

		if (weapon[2])
		{
			strcat(buf, SAMP_BLUE);
		    GetWeaponName(weapon[2], weapon_name, sizeof(weapon_name));
			strcat(buf, weapon_name);
		}
		else
		{
			strcat(buf, TOMATO);
			strcat(buf, "No Weapon");
		}
		strcat(buf, ""WHITE".");
		SendClientMessage(playerid, COLOR_WHITE, buf);
		SendClientMessage(playerid, COLOR_GREY, "You can change your personal weapon by /weapons. To modify your weapons or add extensions, type /extensions.");

		buf[0] = EOS;
		strcat(buf, "Spawn place: ");
		if (pSpawn[playerid] == sizeof(gZone))
		{
		    strcat(buf, ""SAMP_BLUE"Team base.");
		}
		else if (gZone[pSpawn[playerid]][zoneOwner] != pTeam[playerid])
		{
		    strcat(buf, ""TOMATO"Team base (the zone you were supposed to spawn in is no more under our control).");
		    pSpawn[playerid] = sizeof(gZone);
		}
		else if (gZone[pSpawn[playerid]][zoneAttacker] != INVALID_PLAYER_ID)
		{
		    strcat(buf, ""TOMATO"Team base (the zone you were supposed to spawn in is under attack).");
		    pSpawn[playerid] = sizeof(gZone);
		}
		else
		{
			strcat(buf, SAMP_BLUE);
			strcat(buf, gZone[pSpawn[playerid]][zoneName]);
			strcat(buf, ".");
		}
		SendClientMessage(playerid, COLOR_WHITE, buf);

        SendClientMessage(playerid, COLOR_WHITE, " ");

		if (pSpawn[playerid] == sizeof(gZone))
		{
		    switch (random(3))
			{
				case 0:
				{
					SetPlayerPos(playerid, gTeam[pTeam[playerid]][teamSpawn1][0], gTeam[pTeam[playerid]][teamSpawn1][1], gTeam[pTeam[playerid]][teamSpawn1][2]);
					SetPlayerFacingAngle(playerid, gTeam[pTeam[playerid]][teamSpawn1][3]);
				}
				case 1:
				{
					SetPlayerPos(playerid, gTeam[pTeam[playerid]][teamSpawn2][0], gTeam[pTeam[playerid]][teamSpawn2][1], gTeam[pTeam[playerid]][teamSpawn2][2]);
					SetPlayerFacingAngle(playerid, gTeam[pTeam[playerid]][teamSpawn2][3]);
				}
				case 2:
				{
					SetPlayerPos(playerid, gTeam[pTeam[playerid]][teamSpawn3][0], gTeam[pTeam[playerid]][teamSpawn3][1], gTeam[pTeam[playerid]][teamSpawn3][2]);
					SetPlayerFacingAngle(playerid, gTeam[pTeam[playerid]][teamSpawn3][3]);
				}
			}
		}
		else
		{
			SetPlayerPos(playerid, gZone[pSpawn[playerid]][zoneSpawn][0], gZone[pSpawn[playerid]][zoneSpawn][1], gZone[pSpawn[playerid]][zoneSpawn][2]);
			SetPlayerFacingAngle(playerid, gZone[pSpawn[playerid]][zoneSpawn][3]);
		}

 		if (pStats[playerid][userGod])
	    {
	        SetPlayerHealth(playerid, FLOAT_INFINITY);
	        SendClientMessage(playerid, COLOR_DODGER_BLUE, "Your godmode is active, type /god to deactivate.");
		}
		else
		{
		    if (pStats[playerid][userPremium])
			{
			    SetPlayerArmour(playerid, 100.0);
			}
			else
			{
				SetPlayerArmour(playerid, gRank[pRank[playerid]][rankArmour]);
			}
			SetPlayerHealth(playerid, FLOAT_INFINITY);

			pProtectTick[playerid] = 10;
			SendClientMessage(playerid, COLOR_WHITE, "Anti-Spawnkill Protection: 10 seconds. (if you shoot, protection will end instantly)");
			NotifyPlayer(playerid, "Your spawn protection will end in ~y~10 seconds", 0);

			pProtectLabel[playerid] = CreateDynamic3DTextLabel("AntiSK for 10 seconds", COLOR_RED, 0.0, 0.0, 0.0, 35.0, playerid);
			UpdateDynamic3DTextLabelText(pRankLabel[playerid], COLOR_WHITE, "*");
		}

 		if (pStats[playerid][userGodCar])
	    {
	        SetVehicleHealth(GetPlayerVehicleID(playerid), FLOAT_INFINITY);
	        SendClientMessage(playerid, COLOR_DODGER_BLUE, "Your godcar mode is active, type /godcar to deactivate.");
		}
	}
	for (new i, j = sizeof(gZone); i < j; i++)
	{
	    if (gZone[i][zoneAttacker] != INVALID_PLAYER_ID)
	    {
			GangZoneFlashForPlayer(playerid, gZone[i][zoneId], SET_ALPHA(gTeam[GetPlayerTeam(gZone[i][zoneAttacker])][teamColor], 100));
		}
	}

	return 1;
}
Reply
#2

use this!

Код:
new x = random(5);
switch(x)
{
    case 0:
    {
        //Weapon1
        //Weapon2
        //Weapon3
        //Weapon4
    }
    case 1:
    {
        //Weapon1
        //Weapon2
        //Weapon3
        //Weapon4
    }
    case 2:
    {
        //Weapon1
        //Weapon2
        //Weapon3
        //Weapon4
    }
    case 3:
    {
        //Weapon1
        //Weapon2
        //Weapon3
        //Weapon4
    }
    case 4:
    {
        //Weapon1
        //Weapon2
        //Weapon3
        //Weapon4
    }
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)