can't Save Weapon In Command Spec
#1

Hello
Command Spec Can't Save Weapon.
Please Help.
Код:
#pragma tabsize 0
#include <a_samp>
#include <core>
#include <float>

#include "../include/gl_common.inc"

#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFFF

//------------------------------------------------------------------------------------------------------

#define Spec_NONE 0
#define Spec_PLAYER 1
#define Spec_VEHICLE 2

new gSpectateID[MAX_PLAYERS];
new gSpectateType[MAX_PLAYERS];
//------------------------------------------------------------------------------------------------------

public OnFilterScriptInit()
{
}

//------------------------------------------------------------------------------------------------------

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	// IF ANYONE IS SPECTATING THIS PLAYER, WE'LL ALSO HAVE
	// TO CHANGE THEIR INTERIOR ID TO MATCH
	new x = 0;
	while(x!=MAX_PLAYERS) {
	    if( IsPlayerConnected(x) &&	GetPlayerState(x) == PLAYER_STATE_SPECTATING &&
			gSpectateID[x] == playerid && gSpectateType[x] == Spec_PLAYER )
   		{
   		    SetPlayerInterior(x,newinteriorid);
		}
		x++;
	}
}

//------------------------------------------------------------------------------------------------------

public OnPlayerCommandText(playerid, cmdtext[])
{
	new cmd[256];
	new specplayerid, idx;
	if(!IsPlayerAdmin(playerid)) return 0;
	cmd = strtok(cmdtext, idx);
 	if(strcmp(cmd, "/specplayer", true) == 0) {
	    new tmp[256];
		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp)) {
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /specplayer [playerid]");
			return 1;
		}
		specplayerid = strval(tmp);
		
		if(!IsPlayerConnected(specplayerid)) {
		    SendClientMessage(playerid, COLOR_RED, "specplayer: that player isn't active.");
			return 1;
		}
		TogglePlayerSpectating(playerid, 1);
		PlayerSpectatePlayer(playerid, specplayerid);
		SetPlayerInterior(playerid,GetPlayerInterior(specplayerid));
		gSpectateID[playerid] = specplayerid;
		gSpectateType[playerid] = Spec_PLAYER;
 		return 1;
	}
 	if(strcmp(cmd, "/specoff", true) == 0) {
		TogglePlayerSpectating(playerid, 0);
		gSpectateID[playerid] = INVALID_PLAYER_ID;
		gSpectateType[playerid] = Spec_NONE;
		return 1;
	}

	return 0;
}
//------------------------------------------------------------------------------------------------------
Reply
#2

You have to create2 player variables: for weapon and ammo and save it in this variables. Example here: https://sampwiki.blast.hk/wiki/GetPlayerWeaponData
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)